Glitch
Member
How would I go about using an in-file script (@script, not reliant on external script file) to play an animation when directional key (forward) is released during run animation?
The animation played would be a slow down/stop run animation, when forward button is released.
I saw it could be done with script somewhere, tried searching but could not find it, found other scripts that I tried using and modifying.
I tried writing it like this:
@script
void self = getlocalvar("self");
int iPIndex = getentityproperty(self,"playerindex"); //Get player index
if(releasekeys(iPIndex, 0, "moveleft")) // Left is pressed?
{
changeentityproperty(self, "animation",openborconstant("ANI_FREESPECIAL56"));
}
else if (releasekeys(iPIndex, 0, "moveright"))// Right is pressed?
{changeentityproperty(self, "animation",openborconstant("ANI_FREESPECIAL56"));
}
@end_script
It does not work at all, I am doing something wrong, pretty sure releasekeys is not being used correctly...
How do I get the released key variable/integer and use it to play an animation?
The animation played would be a slow down/stop run animation, when forward button is released.
I saw it could be done with script somewhere, tried searching but could not find it, found other scripts that I tried using and modifying.
I tried writing it like this:
@script
void self = getlocalvar("self");
int iPIndex = getentityproperty(self,"playerindex"); //Get player index
if(releasekeys(iPIndex, 0, "moveleft")) // Left is pressed?
{
changeentityproperty(self, "animation",openborconstant("ANI_FREESPECIAL56"));
}
else if (releasekeys(iPIndex, 0, "moveright"))// Right is pressed?
{changeentityproperty(self, "animation",openborconstant("ANI_FREESPECIAL56"));
}
@end_script
It does not work at all, I am doing something wrong, pretty sure releasekeys is not being used correctly...
How do I get the released key variable/integer and use it to play an animation?