|
3 registered members (EvanTJ, Quad, AndrewAMD),
4,715
guests, and 3
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: New guy needs help please :)
[Re: EvilSOB]
#262800
04/25/09 22:53
04/25/09 22:53
|
Joined: Apr 2009
Posts: 81
JakeBilbe
OP
Junior Member
|
OP
Junior Member
Joined: Apr 2009
Posts: 81
|
Thanks its looking better now  just one thing left I cant figure out is how to play two different animations I have been reading the workshop again and again but I think I need a break cause I cant understand it lol, but I want a stand still animation and the walk one but either the walk plays non stop or if I have the stand one on then that plays over the walk non stop aswell. action main_player() //not player, since it's a global pointer
{
while(1)
{
my.pan += 19*(key_a-key_d)*time_step;
var dist_ahead = 2*(key_w-key_s)*time_step; //wiki
dist_ahead = sign(dist_ahead)*(abs(dist_ahead) + 0.5); // adapt the speed on slopes
c_move(me,vector(dist_ahead,0,0),vector(0,0,0),GLIDE); // move the player
ent_animate(me,"walk",walk_percentage,ANM_CYCLE); // walk animation loop
walk_percentage += 4 * time_step;
ent_animate(me,"stand",walk_percentage, 0); //standing still animation
walk_percentage = 0 * time_step;
if (key_space) me.z +=10;
if (me.z > 20) me.z -=0.8;
camera.x = my.x - 60; // keep the camera 200 quants behind the player
camera.y = my.y; // using the same y with the player
camera.z = my.z+30; // and place it at z = 700 quants
camera.tilt = -25; // make it look downwards
wait (1);
}
} Sorry for the double post as well did not remember I already posted :S.
Last edited by JakeBilbe; 04/26/09 00:21.
|
|
|
Re: New guy needs help please :)
[Re: JakeBilbe]
#262807
04/26/09 01:03
04/26/09 01:03
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
No problem with the double posting, I needed your code anyway. Try this untested adjustments to your code and tell me what happens. action main_player() //not player, since it's a global pointer
{
var dist_ahead, walk_percentage=0, stand_percentage=0;
while(1)
{
my.pan += 19*(key_a-key_d)*time_step;
dist_ahead = 2*(key_w-key_s)*time_step;
if(dist_ahead) //if dist is NOT zero
{
dist_ahead = sign(dist_ahead)*(abs(dist_ahead) + 0.5); // adapt the speed on slopes
c_move(me,vector(dist_ahead,0,0),NULL,GLIDE); // move the player
ent_animate(me,"walk",walk_percentage,ANM_CYCLE); // walk animation loop
walk_percentage += 4 * time_step;
stand_percentage = 0;
}
else
{
ent_animate(me,"stand",stand_percentage, 0); //standing still animation, now allows stand to have "figit-ing"
stand_percentage += 4 * time_step;
walk_percentage = 0;
}
if((key_space)&&(me.z<=20)) c_move(me,vector(0,0,+10),NULL,GLIDE); //only add jump when "on-ground"( Im guessing my.z=20 is on the ground? )
else if(me.z > 20) c_move(me,vector(0,0,-0.8),NULL,GLIDE); //fall now allows you to land "on" things
//
camera.x = my.x - 60; // keep the camera 200 quants behind the player
camera.y = my.y; // using the same y with the player
camera.z = my.z+30; // and place it at z = 700 quants
camera.tilt = -25; // make it look downwards
wait (1);
}
}
Sorry if its gotten "alot" more complex, I got carried away  Any questions on what Ive added or modded just ask... PS :: Try looking for models etc on the Acknex Unlimited site. Link is at the bottom of the forum pages as resources
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: New guy needs help please :)
[Re: JakeBilbe]
#262809
04/26/09 01:55
04/26/09 01:55
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Ah, my bad, sorry. Remember I re-coded yours straight out of my head, so I think I did well. Keep the numbers you want to get the effect you want. I wasnt sure if your "my.z=0" was ACTUALLY the ground. My syntax error in this line is because of the "vector(0,0,+10)" entry. 3DGS lets you use "-" in front of a number, but cries if you use "+". The vector SHOULD be "vector(0,0,10)" and that will take the error away.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: New guy needs help please :)
[Re: EvilSOB]
#262810
04/26/09 02:01
04/26/09 02:01
|
Joined: Apr 2009
Posts: 81
JakeBilbe
OP
Junior Member
|
OP
Junior Member
Joined: Apr 2009
Posts: 81
|
Its okay least you fixed it lol. Dont suppose you could help me with one last problem when I jump I want it to play a sound so I have this code at the top SOUND* woosh = "woosh.wav"; //jumping sound and then in my action main_player I have this inside the while(1) if((key_space)&&(me.z<=20)) c_move(me,vector(0,0,10),NULL,GLIDE); //only add jump when "on-ground"( Im guessing my.z=20 is on the ground? )
else if(me.z > 20) c_move(me,vector(0,0,-0.8),NULL,GLIDE); //fall now allows you to land "on" things
ent_playsound(main_player,woosh,100); //jump effect sound but when the game loads it says error in main_player.
Last edited by JakeBilbe; 04/26/09 02:06.
|
|
|
Re: New guy needs help please :)
[Re: JakeBilbe]
#262811
04/26/09 02:27
04/26/09 02:27
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Easy one. Ent_playsound want an ENTITY as a parameter, and youve given it an action name. use "ent_playsound(me,woosh,100); //jump effect sound" instead Thats the answer to the ERROR, but the effect will be horrible. It will try to play the sound every time the loop goes through, so it will start multiple copies of the sound every second. Try this instead
if((key_space)&&(me.z<=20))
{ c_move(me,vector(0,0,10),NULL,GLIDE); //only add jump when "on-ground"( Im guessing my.z=20 is on the ground? )
ent_playsound(me,woosh,100); //jump effect sound only at junp start
}
else if(me.z > 20)
{
c_move(me,vector(0,0,-0.8),NULL,GLIDE); //fall now allows you to land "on" things
}
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
|