Character based branching

Bloodbane

Well-known member
If you don't understand about branching, you can read this tutorial:

http://www.chronocrash.com/forum/index.php?topic=20.0

Now about script itself, here's a script example:
spawn empty
@script
  void main()
  {
    void P1 = getplayerproperty(0, "entity");

    if(P1){
      void Model = getentityproperty(P1, "name");

      if(Model == "Ninja"){
        jumptobranch("Path1",1);
      } else if(Model == "Fighter"){
        jumptobranch("Path2",1);
      }
    }
  }
@end_script
coords 160 190
at 0
This script will check the name of character player 1 is using. If his name is Ninja, the script will jump to branch Path1, if name is Fighter, script will jump to Path2

Red text above is set to 1 which means the 'jump' will immediately be run when this empty entity is spawned.
If it's set to 0, the 'jump' effect will only occur when current level ends

Although the script is 'attached' to empty entity, it's not related to that entity at all so the script can be moved to other entity spawn in same level
 
Thanks Beastie!

I should emphasize that this script only checks player 1 so if you want to check player 2, you need to modify the script
With 2 players checked, you'd need to define which has higher priority to define branch to jump to
Or you can have special combination such as: if player 1 is playing as Fighter while player 2 as Ninja, script will jump to special branch ;)

That reminds me of Metal Slug 1's Happy ending :D
 
nice script!
Question: what happens if you choose a branch with maxplayers 1 for example? Will the engine crash or will it let only one character to play?
 
This script only do the jumping. It doesn't know nor care if the jumped-to-branch leads to a scene, end or just a level
So my guess is that only one character is allowed to play
 
Back
Top Bottom