Hi Bloodbane thank you for responding to my question. I am trying to have Spawn a different Boss depending on the Player selected. I am thinking this can be achived by script where I included both bosses on the my level.txt and then using the Killentity(entity) line to have that Boss disappear depending on the Player entering that level. I am having trouble writing that script. Any advice you could provide would be much appreciated.It's possible to do that but the question is what for? what is it that you're trying to achieve?
spawn Boss1
@script
void main()
{
int P1 = getplayerproperty(0, "name");
int P2 = getplayerproperty(1, "name");
void self = getlocalvar("self");
char PName; void Play;
if(P1){
Play = P1;
} else if(P2){
Play = P2;
}
if(Play){
PName = getentityproperty(Play, "defaultname");
if(PName=="Guardian"){
killentity(self);
}
}
}
@end_script
#map 1
health 120
coords 0 150
at 0
spawn Boss2
@script
void main()
{
int P1 = getplayerproperty(0, "name");
int P2 = getplayerproperty(1, "name");
void self = getlocalvar("self");
char PName; void Play;
if(P1){
Play = P1;
} else if(P2){
Play = P2;
}
if(Play){
PName = getentityproperty(Play, "defaultname");
if(PName!="Guardian"){
killentity(self);
}
}
}
@end_script
#map 1
health 120
coords 0 150
at 0
I think it would be better with this:
Code:spawn Boss1 @script void main() { int P1 = getplayerproperty(0, "entity"); int P2 = getplayerproperty(1, "entity"); void self = getlocalvar("self"); char PName; void Play; if(P1){ Play = P1; } else if(P2){ Play = P2; } if(Play){ PName = getentityproperty(Play, "defaultname"); if(PName=="Guardian"){ killentity(self); } } } @end_script #map 1 health 120 coords 0 150 at 0 spawn Boss2 @script void main() { int P1 = getplayerproperty(0, "entity"); int P2 = getplayerproperty(1, "entity"); void self = getlocalvar("self"); char PName; void Play; if(P1){ Play = P1; } else if(P2){ Play = P2; } if(Play){ PName = getentityproperty(Play, "defaultname"); if(PName!="Guardian"){ killentity(self); } } } @end_script #map 1 health 120 coords 0 150 at 0
This script will remove Boss1 if player 1 is Guardian but will remove Boss2 instead if player 1 isn't Guardian.
The script could check player 2 if player 1 isn't available but if both are in, then player 1 will define the boss.
I haven't tested this but try this and see if it works![]()
spawn Boss1
@cmd conditionalboss
#map 1
health 120
coords 0 150
at 0
Well, you can use spawnscript to replace inline script like the above.
Code:spawn Boss1 spawnscript data/scripts/bossplay.c #map 1 health 120 coords 0 150 at 0
I rarely use this cause it's only useful for generic purpose scripts.
Hi Bloodbane, I was wondering if you had an edit suggestion that would also include NPC's as well as Player?I think it would be better with this:
Code:spawn Boss1 @script void main() { int P1 = getplayerproperty(0, "name"); int P2 = getplayerproperty(1, "name"); void self = getlocalvar("self"); char PName; void Play; if(P1){ Play = P1; } else if(P2){ Play = P2; } if(Play){ PName = getentityproperty(Play, "defaultname"); if(PName=="Guardian"){ killentity(self); } } } @end_script #map 1 health 120 coords 0 150 at 0 spawn Boss2 @script void main() { int P1 = getplayerproperty(0, "name"); int P2 = getplayerproperty(1, "name"); void self = getlocalvar("self"); char PName; void Play; if(P1){ Play = P1; } else if(P2){ Play = P2; } if(Play){ PName = getentityproperty(Play, "defaultname"); if(PName!="Guardian"){ killentity(self); } } } @end_script #map 1 health 120 coords 0 150 at 0
This script will remove Boss1 if player 1 is Guardian but will remove Boss2 instead if player 1 isn't Guardian.
The script could check player 2 if player 1 isn't available but if both are in, then player 1 will define the boss.
I haven't tested this but try this and see if it works![]()