Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, 7th_zorro, ozgur, Quad), 841 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
3d zelda based game #405975
08/11/12 20:48
08/11/12 20:48
Joined: Dec 2010
Posts: 100
D
Dega Offline OP
Member
Dega  Offline OP
Member
D

Joined: Dec 2010
Posts: 100
I am trying to make a game where you are a guy with a sword that swings around in front of the characters hand. I cannot figure out how to create the sword at the right spot(the players hand) and follow the player's pan while it is not deleted yet. May I have some tips or example with this code? I really don't know where to start.
Code:
action sword()
{
	var percent;
	var sword_life_timer = 10;

	while(1)
	{
		percent += 0;
		ent_animate(player,"atk",percent,NULL);
		sword_life_timer -= 1 * time_step;
		if (sword_life_timer <= 0)
		{
			ent_remove(me);
			return;
		}
		wait(1);
	} 
}




boolean my.awesomeness = so true;
Re: 3d zelda based game [Re: Dega] #405994
08/12/12 10:16
08/12/12 10:16
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
I am still bit of a novice, but this should do the trick
Code:
vec_for_bone(VECTOR*,ENTITY*,STRING* name)

for positioning e.g. weapons in the players hand.
If your Zelda model has bones, you can use the code below:

Code:
action sword()
{
        VECTOR bone_attach;
	var percent;
	var sword_life_timer = 10;

	while(1)
	{
                vec_for_bone(bone_attach,player, "BoneRightArm"); // in MDL editor, rename the bone of the model's right arm to "BoneRightArm"
	        my.pan = player.pan;
		percent += 0;
		ent_animate(player,"atk",percent,NULL);
		sword_life_timer -= 1 * time_step;
		if (sword_life_timer <= 0)
		{
			ent_remove(me);
			return;
		}
		wait(1);
	} 
}


If you dont know about bones, you should learn about them, it is very handy (see Lite-C Workshop 23: Bones).

Last edited by Reconnoiter; 08/12/12 10:17.
Re: 3d zelda based game [Re: Reconnoiter] #406024
08/12/12 20:35
08/12/12 20:35
Joined: Dec 2010
Posts: 100
D
Dega Offline OP
Member
Dega  Offline OP
Member
D

Joined: Dec 2010
Posts: 100
That didnt work. However it got me on the right track for accomplishing it. So thank you very much and for a newbie like me that was very impressive! I think I am figuring it out!


boolean my.awesomeness = so true;
Re: 3d zelda based game [Re: Dega] #406029
08/12/12 21:31
08/12/12 21:31
Joined: Jul 2005
Posts: 1,002
Trier, Deutschland
Nowherebrain Offline
Serious User
Nowherebrain  Offline
Serious User

Joined: Jul 2005
Posts: 1,002
Trier, Deutschland
a very simple trick is to animate the sword with the player....other than that you can attach the sword to a vertex and align it along another vertex(or vertexes...roll and tilt)...this is provided you have the vertexes to work with, pre-meditated ....but as you seem new to coding in general, or just 3dgs, I recommend animating it with the player. Then just copy the players coords and pan to the sword every frame and you're good to go.


Everybody Poops.
here are some tutorials I made.
http://www.acknexturk.com/blender/

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