3 registered members (AndrewAMD, VoroneTZ, dpn),
1,346
guests, and 10
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Problem: weapon attachment doesn´t fit animation
#255688
03/11/09 21:08
03/11/09 21:08
|
Joined: Jan 2005
Posts: 30
fp
OP
Newbie
|
OP
Newbie
Joined: Jan 2005
Posts: 30
|
i am working through the KH movement tutorial at the moment and it goes well. I added some new animations, for example an equip / unequip sword animation and a second stand or idle animation, because there should be another stand animation if the player has unequipped his sword an put it on his back. Blending the animations goes well , that means the blending or playing the animation itself is not a problem. But now i´ve got a problem. The weapon attachment does not fit to the animation. that means now the code does: he holds the sword in hand, next it is still on his back while it is playing the animation. How can I fix it? Can anybody help me please? ACTION attach_weapon {
my.passable = on;
my.scale_x = 2.5;
my.scale_y = 2.5;
my.scale_z = 2.5;
proc_late();
WHILE (you != null) {
IF (equip_sword == 1)
{
vec_for_vertex(temp.x,you,152); //hand palm base
vec_for_vertex(temp2.x,you,124); //hand palm tip
vec_set(my.x,temp.x);
vec_diff(temp.x,temp2.x,temp.x);
vec_to_angle(temp.pan,temp.x);
vec_set(my.pan,temp.pan);
wait(1);
}
ELSE
{
vec_for_vertex(temp.x,you,269); // sword on
vec_for_vertex(temp2.x,you,720); // his back
vec_set(my.x,temp.x);
vec_diff(temp.x,temp2.x,temp.x);
vec_to_angle(temp.pan,temp.x);
vec_set(my.pan,temp.pan);
wait(1);
}
}
}
FUNCTION handle_movement()
.
.
.
IF(key_1 == 0 && key1_press ==1) { key1_press = 0;}
IF(equip_sword ==1)
{
IF(key_1 == 1 && key1_press ==0 && my.animblend >= stand){ my.blendframe = equip; key1_press = 1; equip_sword = 0;}
}
ELSE
{
IF(key_1 == 1 && key1_press ==0 && my.animblend >= stand){ my.blendframe = equip; key1_press = 1; equip_sword = 1;}
}
.
.
. thank you in advance, bye
|
|
|
Re: Problem: weapon attachment doesn´t fit animation
[Re: fp]
#255689
03/11/09 21:29
03/11/09 21:29
|
Joined: Mar 2009
Posts: 112 Germany
KDuke
Member
|
Member
Joined: Mar 2009
Posts: 112
Germany
|
Hi fp,
you have to wait until the unequip animation has ended before you set equip_sword to 0.
greetings KDuke
Using A7 Free Click and join the 3dgs irc community! Room: #3dgs
|
|
|
Re: Problem: weapon attachment doesn´t fit animation
[Re: KDuke]
#255696
03/11/09 22:10
03/11/09 22:10
|
Joined: Jan 2005
Posts: 30
fp
OP
Newbie
|
OP
Newbie
Joined: Jan 2005
Posts: 30
|
thanks KDuke, but i don´t know why? that is the animation code: IF (my.animblend == equip) {
var i= 0;
ent_animate(my,"equip",my.animate,0);
my.animate += 5 * animation_speed * time;
my.currentframe = equip;
IF (my.animate >= 60)
{
ent_animate(my,"equip",60,0);
my.animate = 60;
i= 1;
IF (equip_sword == 1) {my.blendframe = stand;} ELSE { my.blendframe = idle;}
IF (my.move_x != 0 || my.move_y !=0) {
IF (key_shift == 1) { my.blendframe = walk; } ELSE { my.blendframe = run; }
}
}
} i tried it with IF(my.animate...) but it doesn´t work. what do i wrong?
|
|
|
Re: Problem: weapon attachment doesn´t fit animation
[Re: fp]
#255713
03/12/09 04:23
03/12/09 04:23
|
Joined: Mar 2009
Posts: 112 Germany
KDuke
Member
|
Member
Joined: Mar 2009
Posts: 112
Germany
|
Well... first of why you need to wait until the animation is finished. It is if you instantly put equip_sword on 0 the moment the program leaves this function to do other stuff (the wait(1)-statement) I guess the position of the sword is put on his back because equip_sword is 0.
Though I'm at loss how to check if an animation has finished. I hope someone can state this.
greetings KDuke
Using A7 Free Click and join the 3dgs irc community! Room: #3dgs
|
|
|
Re: Problem: weapon attachment doesn´t fit animation
[Re: KDuke]
#255758
03/12/09 11:55
03/12/09 11:55
|
Joined: Jan 2005
Posts: 30
fp
OP
Newbie
|
OP
Newbie
Joined: Jan 2005
Posts: 30
|
yes, got it, works now, thank you. i did not have to do it in handle_movement(). (player.wdl) i had to do it in handle_animation() in the animation.wld IF (my.animblend == equip) {
ent_animate(my,"equip",my.animate,0);
my.animate += 5 * animation_speed * time;
my.currentframe = equip;
IF (my.animate >= 60)
{
ent_animate(my,"equip",60,0);
my.animate = 60;
IF (equip_sword == 1) {equip_sword = 0;} ELSE{ equip_sword = 1;}
IF (equip_sword == 1) {my.blendframe = stand;} ELSE { my.blendframe = idle;}
IF (my.move_x != 0 || my.move_y !=0) {
IF (key_shift == 1) { my.blendframe = walk; } ELSE { my.blendframe = run; }
}
}
}
|
|
|
Re: Problem: weapon attachment doesn´t fit animation
[Re: fp]
#255807
03/12/09 17:49
03/12/09 17:49
|
Joined: Mar 2009
Posts: 112 Germany
KDuke
Member
|
Member
Joined: Mar 2009
Posts: 112
Germany
|
Did you try your old code and the "extended" one you made because of my proposal?
I just would like to know if it works now because of going to animation.wld only or because of both, going to animation.wld AND checking if the animation finished.
Just would like to know if the way I was thinking was right.
greetings KDuke
Using A7 Free Click and join the 3dgs irc community! Room: #3dgs
|
|
|
|