|
3d zelda based game
#405975
08/11/12 20:48
08/11/12 20:48
|
Joined: Dec 2010
Posts: 100
Dega
OP
Member
|
OP
Member
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.
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
Serious User
|
Serious User
Joined: Dec 2011
Posts: 1,823
Netherlands
|
I am still bit of a novice, but this should do the trick
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:
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
Dega
OP
Member
|
OP
Member
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;
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|