* *
Welcome, Guest. Please login or register.
Did you miss your activation email?
February 18, 2018, 01:10:19 PM

Login with username, password and session length

[Tutorial] Custom Spawn/intro for stages

  • 0 Replies
  • 48 Views
*

Offline O Ilusionista

  • Global Moderator
  • Hero Member
  • *****
  • 5295
  • >> I WILL BE AWAY FOR SOME TIME <<
    • BMT - Brazil Mugen Team
[Tutorial] Custom Spawn/intro for stages
« on: February 13, 2018, 10:44:48 AM »
Custom Spawn/intro for stages tutorial
By O Ilusionista.

I made this code years ago and saw that someone asked about something similar at my FB group. Basically, this code allows you to do a custom spawn for each stage - and that's how I do the intros in my game.

You will need an entity to trigger this (it can be any entity, I use a wildcard entity called "empty") or use this as levelscript.

In the code below, I position the players (my game only has 2) where I want (-490,189, 0 - yeah, I spawn the player outside the screen), facing the side I want (direction) and the animation I want (FOLLOW60).

Tips
1- Do not use this code in updatescript, because it is triggered all the time. Levelscript is fired once when the scene is loaded

2- You can block another player from entering the game (as in my game),
Code: [Select]
changeopenborvariant("nojoin", 1);but you need to enable it back, or if you die ... nor either you can return to the game.

3- Remember to increase the number of MAXFOLLOWS.

4- This code fires just one time, when the players spawns on the level. It won't affect any respawn animation.

######## Entity based method (spawnscript)
Quote
spawn empty
@script
void main()
{
int P1 = getplayerproperty(0, "entity");
int P2 = getplayerproperty(1, "entity");

if(P1){
changeentityproperty(P1, "position", -490,189, 0); // Set position
changeentityproperty(P1, "direction", 1); //Face right
changeentityproperty(P1, "animation", openborconstant("ANI_FOLLOW60"));
}
if(P2){
changeentityproperty(P2, "position", -490,189, 0);
changeentityproperty(P2, "direction", 1); //Face right
changeentityproperty(P2, "animation", openborconstant("ANI_FOLLOW60"));
}
}
@end_script
coords 180 189
at 0

######## Levelscript method

Just paste this in your level .txt

Code: [Select]
levelscript @script
void main()
{
int P1 = getplayerproperty(0, "entity");
int P2 = getplayerproperty(1, "entity");

if(P1){
changeentityproperty(P1, "position", -490,189, 0);
changeentityproperty(P1, "direction", 1); //Face right
changeentityproperty(P1, "animation", openborconstant("ANI_FOLLOW60"));
}
if(P2){
changeentityproperty(P2, "position", -490,189, 0);
changeentityproperty(P2, "direction", 1); //Face right
changeentityproperty(P2, "animation", openborconstant("ANI_FOLLOW60"));
}
}
@end_script

Those intros adds some cool effect so give it a try :)

 

Recent

Members
Stats
  • Total Posts: 48704
  • Total Topics: 3342
  • Online Today: 59
  • Online Ever: 316
  • (January 04, 2013, 09:43:02 AM)
Users Online
Users: 3
Guests: 28
Total: 31