Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
6 registered members (AndrewAMD, Ayumi, degenerate_762, 7th_zorro, VoroneTZ, HoopyDerFrood), 1,268 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19053 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Problem: weapon attachment doesn´t fit animation #255688
03/11/09 21:08
03/11/09 21:08
Joined: Jan 2005
Posts: 30
F
fp Offline OP
Newbie
fp  Offline OP
Newbie
F

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?

Code:
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
K
KDuke Offline
Member
KDuke  Offline
Member
K

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
F
fp Offline OP
Newbie
fp  Offline OP
Newbie
F

Joined: Jan 2005
Posts: 30
thanks KDuke, but i don´t know why?

that is the animation code:

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
K
KDuke Offline
Member
KDuke  Offline
Member
K

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
F
fp Offline OP
Newbie
fp  Offline OP
Newbie
F

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

Code:
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
K
KDuke Offline
Member
KDuke  Offline
Member
K

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
Re: Problem: weapon attachment doesn´t fit animation [Re: KDuke] #255829
03/12/09 20:56
03/12/09 20:56
Joined: Jan 2005
Posts: 30
F
fp Offline OP
Newbie
fp  Offline OP
Newbie
F

Joined: Jan 2005
Posts: 30
you were absolutly right.
the animation ends here:

IF (my.animate >= 60)
{
ent_animate(my,"equip",60,0);
my.animate = 60; /// animation ends here

Then what you have said:

IF (equip_sword == 1) {equip_sword = 0;} ELSE{ equip_sword = 1;}

bye
fp


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1