How to create Player 'Model' specific cutscenes?

Hi All,

Objective:

I want to create a Player model specific cutscene (ie: create a custom cutscene when player 1 is using "KULA").

Does anyone know of a MOD that makes use of character specific in-game cutscenes, so that I can reference how it is done?


I know how to create an Entity with Type = Text, which I plan to use as in-game narrative cutscenes:

Basic Stats​


type {type}

  • {type}:

    • text: The entity is a message object. When spawned, it will freeze all objects in play and show it’s *IDLE* animation, then dissapear. It can be sped up by pressing attack or jump. Can be used for level intros, mid-level cutscenes, etc.

I assume that the <my_level>.txt scripting would work similar to entity level scripting for animations ? ( I can't seem to find any documentation that says it does or doesn't).


Where I am stuck at is how to script in the logic in the <my_level.txt> (ie: like example1.txt level).

If I put in script like this, I get no errors and the log output is not produced in the OpenBOR log.txt :

C:
#--group1-----
spawn    1up
coords    300 180
at    0


@script
    void main()
    {
      char p1name = getplayerproperty(0, "name");
  
      log(" \n Player 1 name :" + p1name);
  
    }
@end_script



spawn Drum
coords 150 170
at 0

I then also tried scripting something to spawn (just to see if animation script I know works, will work with my example1.txt level). I get no errors in OpenBOR.txt but also nothing appears on screen either.

C:
#--group1-----
spawn    1up
coords    300 180
at    0


@script
    void main()
    {
      
        void self = getlocalvar("self"); //Get calling entity.
        void vSpawn; //Spawn object.
        int  iDirection = getentityproperty(self, "direction");
        int fX = 0;
        int fY = 0;
        int fZ = 0;

        clearspawnentry(); //Clear current spawn entry.
        setspawnentry("name", "Apple"); //Acquire spawn entity by name.
    
        vSpawn = spawn(); //Spawn in entity.

        changeentityproperty(vSpawn, "position", fX, fZ, fY); //Set spawn location.
 
 
    }
@end_script



spawn Drum
coords 150 170
at 0

This is how I imagine my script would work (if it did):


C:
#--group1-----
spawn    1up
coords    300 180
at    0


@script
    void main()
    {
      char p1name = getplayerproperty(0, "name");
  
     if (p1name == "Kula")  //show cutscene if matching
     {
        void self = getlocalvar("self"); //Get calling entity.
        void vSpawn; //Spawn object.
        int  iDirection = getentityproperty(self, "direction");
        int fX = 0;
        int fY = 0;
        int fZ = 0;

        clearspawnentry(); //Clear current spawn entry.
        setspawnentry("name", "Apple"); //Acquire spawn entity by name.
                                 //I'm using apple because I didn't create the 'text' cutscene yet

    
        vSpawn = spawn(); //Spawn in entity.

        changeentityproperty(vSpawn, "position", fX, fZ, fY); //Set spawn location.
 
 
    }
@end_script



spawn Drum
coords 150 170
at 0

Thank you.
 
Last edited:
If I put in script like this, I get no errors and the log output is not produced in the OpenBOR log.txt :
Keep in mind that doing the script as this turns it into a updatescript. In other way, it will run in every tick.
Your logic is right on code, but I would use a different approach:

- I do prefer to make an entity to handle all my stories and, on its spawn animation, I would use the script to change the current animation based on which character is available.

- You need to add a safe check to... check if the player is avaiable. Because trying to get information for an invalid entity (a NULL) won't be bad, but trying to change anything on a NULL POINT gives you an instant crash.

Something like this:

C-like:
int P1 = getplayerproperty(0, "entity"); // get Player 1
int P2 = getplayerproperty(1, "entity"); // get player 2

if(P1){ // is P1 a valid target?
// insert your logic here

}
 
Keep in mind that doing the script as this turns it into a updatescript. In other way, it will run in every tick.
Your logic is right on code, but I would use a different approach:

- I do prefer to make an entity to handle all my stories and, on its spawn animation, I would use the script to change the current animation based on which character is available.

- You need to add a safe check to... check if the player is avaiable. Because trying to get information for an invalid entity (a NULL) won't be bad, but trying to change anything on a NULL POINT gives you an instant crash.

Something like this:

C-like:
int P1 = getplayerproperty(0, "entity"); // get Player 1
int P2 = getplayerproperty(1, "entity"); // get player 2

if(P1){ // is P1 a valid target?
// insert your logic here

}
Ok I think I see what you mean and I'd rather it not run every tick (abusive).

So your suggestion is to move the logic back down to the entity level and have the the spawned entity determine what animations to play.

Makes sense! I will go try this. Thank you!
 
@VirtusVerbis
the night slashers x wide 24a has scripts that might help you, wrote a bunch of notes on the models .txt and the level texts themselves so you can see how the entities and scripts work ' (level 1 has a text entity that reacts to whatever character is player 1)
granted those are old school scripts, and if you are developing for openbor v 4 i dont know if those same will work.

those scripts are the basis of many 'weird' things that happen in the game
even attempted some fancier stuff, like have the text entities react to the player with the highest score instead of always reacting to player 1´s pick, but it was a flop - so the entities only react to the character picked by player 1

the game is big, so another option might be SORX2 by @Kratus -

anyway, lots of options , and if you manage to do a high score variation of the concept please share...
 
@VirtusVerbis
the night slashers x wide 24a has scripts that might help you, wrote a bunch of notes on the models .txt and the level texts themselves so you can see how the entities and scripts work ' (level 1 has a text entity that reacts to whatever character is player 1)
granted those are old school scripts, and if you are developing for openbor v 4 i dont know if those same will work.

those scripts are the basis of many 'weird' things that happen in the game
even attempted some fancier stuff, like have the text entities react to the player with the highest score instead of always reacting to player 1´s pick, but it was a flop - so the entities only react to the character picked by player 1

the game is big, so another option might be SORX2 by @Kratus -

anyway, lots of options , and if you manage to do a high score variation of the concept please share...

Thanks for the suggestions. I got it working using the approach that @O Illusionista called out.

I basically create a parent "selector" Entity with Type = none, then I use it to spawn a child Entity with Type = text.

Inside the Parent "Selector" entity, I basically use a switch statement to check which character model P1 is using. If it matches then it spawns the child entity with type = text (which is my cutscene with frames).

I gave examples of what I did in a different thread:

 
Thanks for the suggestions. I got it working using the approach that @O Illusionista called out.

I basically create a parent "selector" Entity with Type = none, then I use it to spawn a child Entity with Type = text.

Inside the Parent "Selector" entity, I basically use a switch statement to check which character model P1 is using. If it matches then it spawns the child entity with type = text (which is my cutscene with frames).

I gave examples of what I did in a different thread:

thanks, i will experiment with those and see if i can get the score factor thing to adapt to it
 
Back
Top Bottom