1 registered members (henrybane),
1,499
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
vec_for_vertex and animation
#128474
05/07/07 15:55
05/07/07 15:55
|
Joined: Apr 2006
Posts: 265
vartan_s
OP
Member
|
OP
Member
Joined: Apr 2006
Posts: 265
|
I have a simple hit box system in the works. An head hitbox entity (passable for now) is created by the enemy entity and aligned to the head every frame - this is done successfully when the enemy entity moves. However, when the entity plays its death animation, the head entity does not move according to the animation. here is code: Code:
function me_die() { var die_percentage = 0; while (die_percentage >= 0) // death_percentage will range from 0 to 100 here { ent_animate(my, "DeathA", die_percentage, 0); // "death" one-shot animation die_percentage += 5 * time; // 3 = animation speed for "death" wait (1); } }
function handle_hit_me() { if (you.skill1 == 4) { effect(blood_cloud1,cloud_number,target.x,nullvector); my.skill20 -= 10; effect(blood_dropsspezial,blood_dropsAnzahlPartikel,target.x,nullvector); if (my.skill20 <= 0) { me_die(); my.passable = on; } } }
function hit_head() { var target_look; var target_ver; my.passable = on; while(you) { vec_for_vertex (target_ver, you, 240); vec_for_vertex (my.x, you, 239); vec_sub(target_ver,my.x); vec_to_angle(my.pan,target_ver); // now MY looks at YOU wait(1); } }
action dummy { my.enable_impact = on; my.event = handle_hit_me; my.skill96 = 1; my.skill20 = 100; ent_create(headhitbox,my.x,hit_head); main_ai(); }
The code is very experimental at the moment and is not meant to be tidy. What I want to know, how do I make it align to animation? I know this is possible, it is mentioned in the vattach file which I downloaded when I first found that it didn't work, only to find it used the same concept.
|
|
|
Re: vec_for_vertex and animation
[Re: vartan_s]
#128476
05/07/07 16:10
05/07/07 16:10
|
Joined: Oct 2003
Posts: 702
zazang
User
|
User
Joined: Oct 2003
Posts: 702
|
|
|
|
Re: vec_for_vertex and animation
[Re: vartan_s]
#128478
05/07/07 16:25
05/07/07 16:25
|
Joined: Oct 2003
Posts: 702
zazang
User
|
User
Joined: Oct 2003
Posts: 702
|
oh indeed I screwed the expressions ..maybe your main_ai or any function that it calls has a proc_kill somehwhere ?
I like good 'views' because they have no 'strings' attached..
|
|
|
Re: vec_for_vertex and animation
[Re: zazang]
#128481
05/08/07 09:17
05/08/07 09:17
|
Joined: Apr 2002
Posts: 4,801 Richmond B.C., Canada
Captain_Kiyaku
Dichotomic
|
Dichotomic
Joined: Apr 2002
Posts: 4,801
Richmond B.C., Canada
|
i had problems with the "you" pointer yesterday too.
What happens if you write this:
function hit_head() { var target_look; var target_ver; my.passable = on; my.skill1 = handle(you); while(ptr_for_handle(my.skill1)) { vec_for_vertex (target_ver, you, 240); vec_for_vertex (my.x, you, 239); vec_sub(target_ver,my.x); vec_to_angle(my.pan,target_ver); // now MY looks at YOU wait(1); } }
action dummy { my.enable_impact = on; my.event = handle_hit_me; my.skill96 = 1; my.skill20 = 100; ent_create(headhitbox,my.x,hit_head); main_ai(); }
not sure if i wrote it correct
My Blog"Tag und Nacht schrei ich mich heiser, Wind weht alle Worte fort, Tag und Nacht schrei ich mein Krähenwort!"Subway To Sally - Krähenkönig
|
|
|
|