Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 642 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 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