Controlling a spawned TEXT entity

Aerisetta

Active member
Hello, I have a question about how to control a spawned text entity.

Right now, I have a character that SPAWNS a text entity.
After, the TEXT entity will continue to loop the IDLE animation of the text entity.
I want it so that if the player presses a button, it will change the TEXT entity animation to FOLLOW1 (or whatever animation).

However, whenever I press any button, it only skips frames in the text entity and nothing else

I have tried adding this keyscript in, but it doesnt seem to do anything

Code:
    if(anim == openborconstant("ANI_IDLE"))
    {
        if(keyPress & openborconstant("FLAG_ANYBUTTON"))
        {
            performattack(self, openborconstant("ANI_FOLLOW1"));
        }
    }
}
 
Hello, I have a question about how to control a spawned text entity.

Right now, I have a character that SPAWNS a text entity.
After, the TEXT entity will continue to loop the IDLE animation of the text entity.
I want it so that if the player presses a button, it will change the TEXT entity animation to FOLLOW1 (or whatever animation).

However, whenever I press any button, it only skips frames in the text entity and nothing else

I have tried adding this keyscript in, but it doesnt seem to do anything

Code:
    if(anim == openborconstant("ANI_IDLE"))
    {
        if(keyPress & openborconstant("FLAG_ANYBUTTON"))
        {
            performattack(self, openborconstant("ANI_FOLLOW1"));
        }
    }
}

Pressing a button by default skips through text entities. Add subtype noskip to the text entity. That should disable native skipping and leave it to your script.

HTH,
DC
 
I've tried using keyscript on non player entity and it doesn't work.
So for your purpose, you should use this script instead:
Code:
anim    follow1 # Page 1
@script
  if(frame >= 2){
    int KeyHold = getplayerproperty(0, "keys"); // acquires player 1's key hold

    if(KeyHold != 0){
      void self = getlocalvar("self");

      performattack(self, openborconstant("ANI_FOLLOW2"));
    }
  }
@end_script
...

If player 1 pressed any key, this entity will change into FOLLOW2.
 
I've tried using keyscript on non player entity and it doesn't work.
So for your purpose, you should use this script instead:
Code:
anim    follow1 # Page 1
@script
  if(frame >= 2){
    int KeyHold = getplayerproperty(0, "keys"); // acquires player 1's key hold

    if(KeyHold != 0){
      void self = getlocalvar("self");

      performattack(self, openborconstant("ANI_FOLLOW2"));
    }
  }
@end_script
...

If player 1 pressed any key, this entity will change into FOLLOW2.
this worked great, thanks!
 
Back
Top Bottom