How do I declare multiple spawnscripts per entity in the level?

Bruce

Active member
Hello guys,

The manual says:
Code:
spawnscript {path}
    This command defines which script to be run right after entity is spawned
    Can be declared multiple times
    In multiple spawnscripts case, script will be run from the 1st to the last
I really have trouble understanding the wording or technical terms on the manual sometimes :-(
Wish there were more examples...

I've tried:
Code:
spawn   Dummy2
health  1000
spawnscript data/scripts/LevelScripts/RandomPalette.c
spawnscript data/scripts/LevelScripts/RandomAggression.c
coords 455 1160
at 0

For some reasons, only the RandomAggression script runs.
I must be doing something wrong.

Can someone please give me some advice?
Thank you so much
 
Oh, the manual hasn't been updated. Multiple spawnscripts is no longer supported.
You'd need to code new script which has all spawnscripts merged in.
 
Oh, the manual hasn't been updated. Multiple spawnscripts is no longer supported.
You'd need to code new script which has all spawnscripts merged in.
I see. Well, I guess I'll have to create another spawnscript with both random aggression and palette in it. Basically, I would have 3 instead of 2 spawnscripts...

Can you or someome else please help me understand more about spawnscripts?
are spawnscripts only being used in the level and will be removed from the memory after the level ends?

I need to understand before I go wild creating more of it.
My goal is to create levels that have more random spawnscripts. This way, the levels don't spawn the same stuff that are predictable, which is boring!


Thank you so much for your help.
 
If I were you, I would create two or three functions like this in one spawnscript (file) for a level. That way, you don't have to rely on using #import/#include directives too much.

Code:
void main(){
    function1();
    function2();
    function3();
}

void function1(){
    //do this...
}

void function2(){
    //do this...
}

void function3(){
    //do this...
}

Now, to randomize how much aggression you have, you can do it like the palette part as a reference. But how much aggression do you want your enemies to have?


Edit:
This is just a test for one function of spawnscript.

C:
void main()
{
    int Aggro = (rand()%10); //RANDOM NUMBER FROM 9 TO -9, NOTE THAT 10 MEANS 0 TO 9
    if(Aggro < 0){Aggro = Aggro*(-1);} //CONVERT ALL NEGATIVE NUMBERS TO POSITIVE
    changeentityproperty(getlocalvar("self"), "aggression", Aggro); //APPLY THE AGGRESSION
}

Note: Never use the same names of void main in one file because that's gonna confuse the name on what "main" part you are referring to.
 
Last edited:
how much aggression do you want your enemies to have
I don't know yet because I haven't even started creating new enemies yet beside the big bosses.
I am still using the the template enemies. The future enemies are mostly similar to the big bosses except they have less skills and less aggressive.
All these will be adjusted accordingly with trials and errors.

Right now I am focusing on creating levels. Once I create some good levels,
I will add 1 more character (Vergil from Devil May Cry) to create a Buddy Assist System similar to the Summon Assist System (thanks a lot to Bloodbane for helping me in the past!).
After that, I will start creating enemies and items and work on the menu stuff.

I would create two or three functions like this in one spawnscript (file) for a level
I've already created it after Bloodbane's first reply :-) But still really appreciated for your inputs in helping me.
Thank you so much
 
Last edited:
@Bruce Optionally you can call multiple spawnscripts this way:

Code:
spawn        None
spawnscript data/scripts/levelspawn/boss_music.c
at            1152

spawn        None
spawnscript data/scripts/levelspawn/double_boss.c
at            1810

In my case I have a very simple entity called "None" for multiple usages, including multiple spawnscripts.
 
@Bruce Optionally you can call multiple spawnscripts this way:

Code:
spawn        None
spawnscript data/scripts/levelspawn/boss_music.c
at            1152

spawn        None
spawnscript data/scripts/levelspawn/double_boss.c
at            1810

In my case I have a very simple entity called "None" for multiple usages, including multiple spawnscripts.
I have also already created an useless entity called LevelDummy with empty.png sprite to use for other usages and inline script stage and boss music and save the music name to the music global valuable to replay them later,
especially for after the summon webmv or story webmv.
However, I am using the inline scripts for the music here though
because I was thinking that I can always change them to different music within the level.c without having to create 1-3 more music spawnscripts for each level.
I know DC said avoid inline scripts, but I really don't want to create a bunch of more spawnscripts for this situation unless these inline scripts really slow down the performance or memory problems. I don't have the experience on this, so can you give me an advice on this?

inline scripts for stage and boss music
vs
stage and boss music spawnscripts


-----------------------------------------------------------------
Regardless, I believe spawning multiple spawnscripts with entity "None" won't work for my situation because the spawnscripts that I want to spawn have to do with the entity properties
such as:
palette, aggression, etc..

But I will keep this in mind for later use for something else.
Thank you so much
 
entity "None" won't work for my situation because the spawnscripts that I want to spawn have to do with the entity properties
such as:
palette, aggression, etc..
The none entity was just an example, but indeed it is a normal entity and also accepts all the common parameters like palette, aggression, etc.
 
Back
Top Bottom