Pickup item in 3rd person view

Posted By: Master_Jiuro

Pickup item in 3rd person view - 05/24/09 09:47

Hello! I tried and tried, but could not figure it out. I have an item and when I click it with my mouse, the player model should play a pickup animation and the clicked item should be removed. Here is what I have:

Quote:
function play_pickup_anim //Animation for the player model

{
player.skill23 = 0;
while (player.skill23 < 90)
{
ent_cycle("Pickup", player.skill23);
player.skill23 += 3 * time;
wait (1);
}
}


action sword //Action assigned to the item
{
my.shadow = on;
c_setminmax(me);
if(mouse_ent == me && mouse_left)
{
if(!sword)
{
sword = 1;
}
else
{
sword_count += 1;
}
}
wait(1);
}
play_pickup_anim();
ent_remove(me);
}


The result of that code is:
-) Item is removed
-) nothing else frown

So please, help my model to be animated smirk
Thanks in advance!!!!
Posted By: KiwiBoy

Re: Pickup item in 3rd person view - 05/24/09 11:06

Shouldnt it be more like this or are you using c-script?
ent_animate(my, "Pickup", player.skill23, ANM_CYCLE);
Posted By: Master_Jiuro

Re: Pickup item in 3rd person view - 05/24/09 11:43

I am still using c-script, it is too hard for me to convert everything to lite-c, maybe I will do this when I have finished my whole project. (Which will still take a long time wink )
Posted By: the_clown

Re: Pickup item in 3rd person view - 05/25/09 08:15

Converting the whole project to c-script is a very bad idea.
Let me tell you that it's a real pain in the ass to convert only a few hundred lines; Depending on how clean your code is, it can take many hours. The whole project would take a few weeks, I guess. So, better do this in c-script, and use lite-c
for your next project.
Posted By: Master_Jiuro

Re: Pickup item in 3rd person view - 05/26/09 11:44

Ok, thanks for this advice, but how can I now get my problem solved? Please help, I am really stuck to this (maybe) simple thing.
Posted By: Widi

Re: Pickup item in 3rd person view - 05/26/09 12:52

You have to set all code from the action in a loop.
while(1)
{
...your code
}

If you don`t do that, the action starts, goes thru the code and finished at the end in the first frame...
Posted By: Master_Jiuro

Re: Pickup item in 3rd person view - 05/27/09 11:32

Thank you, but somehow it does not work. Either the animation is played in a loop, but the item is not picked up, or the player picks up the item, but does not play his animation.
Posted By: KiwiBoy

Re: Pickup item in 3rd person view - 05/27/09 12:31

Something to loop the animation may be;
my.skill23 %= 100;
...to finish it
© 2023 lite-C Forums