3 registered members (Ayumi, Akow, AndrewAMD),
1,505
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Using ent_animate ... but how ?
#443911
07/27/14 21:09
07/27/14 21:09
|
Joined: Mar 2014
Posts: 9
BBN
OP
Newbie
|
OP
Newbie
Joined: Mar 2014
Posts: 9
|
What's wrong with this code:
action ent001()
{
my.skill1 = 0;
while(my.skill1 < 100)
{
ent_frame("death", my.skill1);
my.skill1 += 1;
}
wait(1);
}
}
Gets the error message: > UNDECLARED IDENTIFIER < ?
Last edited by rayp; 11/03/14 22:07. Reason: changed topic title : "Error Message" does not really say that much, 4my taste ... greets
|
|
|
Re: Error message ...
[Re: BBN]
#443916
07/27/14 21:37
07/27/14 21:37
|
Joined: Mar 2014
Posts: 9
BBN
OP
Newbie
|
OP
Newbie
Joined: Mar 2014
Posts: 9
|
Change the code to:
var animation;
action ent001
{
animation = 0;
while(animation < 100) {ent_animate("death",animation); animation+=1; wait(1) ; }
}
It is now another error message: Error in line 16 ... That is > animation = 0; < ?
Last edited by rayp; 08/13/14 23:27. Reason: only added code - tags
|
|
|
Re: Error message ...
[Re: BBN]
#443920
07/27/14 22:24
07/27/14 22:24
|
Joined: Oct 2011
Posts: 1,082 Germany
Ch40zzC0d3r
Serious User
|
Serious User
Joined: Oct 2011
Posts: 1,082
Germany
|
action ent001() You forgot the brackets. Also why not declare animation locally?
Last edited by Ch40zzC0d3r; 07/27/14 22:24.
|
|
|
Re: Error message ...
[Re: Ch40zzC0d3r]
#443927
07/28/14 03:02
07/28/14 03:02
|
Joined: Apr 2005
Posts: 1,988 Canadian, Eh
DLively
Serious User
|
Serious User
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
|
ent_animate("death",animation);
You are missing a couple parameters
ent_animate(me,"death",animation, ANM_CYCLE);
Also, as Ch40zzC0d3r said: You can make your var local, by which he means placing it inside the action. Then several entities can use this action, and will not follow the same var amount.
Last edited by DLively; 07/28/14 03:06.
|
|
|
Re: Error message ...
[Re: DLively]
#446893
11/03/14 21:59
11/03/14 21:59
|
Joined: Jul 2008
Posts: 2,107 Germany
rayp
X
|
X
Joined: Jul 2008
Posts: 2,107
Germany
|
Mhhh ... old ( and dead ) "C - Script" i guess. Instead of asking such questions, a look into the manual, would help alot and is done in a few seconds.Besides the already mentioned missing parameters, you scripted an oneshot animation ( plays animation only one time, after that it does nothing more ). Also u missed "speed correction" via time_step. This means, animation plays slowly on old ( slow ) computers but fast on new ( fast ) machines. Using "+1" here instead of "+time_step*X" is ( in almost all cases ) a deadly ( and extremly ugly ) mistake. This code here combines both, oneshot- and cycle- animationstyles, time corrected with time_step:
//flag1 OneShotAnm 0
action ENTanm_WED(){ // FLAG1 = checked in WED-prop-window: marked as oneshot animation
while (my){
my.skill1 += time_step; // framerate independent
my.skill1 %= 100; // skill1 range 0..100 [if(my.skill1>=100)my.skill1=0;]
if (!is (my, FLAG1)) ent_animate (me, "idle", my.skill1, ANM_CYCLE);
else{ // oneshot: plays animation only one time
ent_animate (me, "idle", my.skill1, NULL);
if (my.skill1 >= 100) break;
}
wait (1);
}
wait (1); // btw always(!!!) wait single frame be4u remove ent's
ptr_remove (me); // btw#2 dont(!!!) use in ent / particle - event's
}
Peace
Acknex umgibt uns...zwischen Dir, mir, dem Stein dort... "Hey Griswold ... where u gonna put a tree that big ?" 1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected rayp.flags |= UNTOUCHABLE;
|
|
|
|