Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
PlinkyBits

How to get a script to change depending on difficulty?

Question

I am trying to use my script to spawn a Hellknight at lower difficulties and a Baron at higher ones. What would that look like?

Currently this is my script:

{

delay(40);

print(s:"Muhahahaha!");

Thing_SpawnFacing(12,2,0,0);

delay(60);

Thing_SpawnFacing(13,2,0,0);

delay(45);

Thing_SpawnFacing(14,2,0,0);

delay(100);

Thing_SpawnFacing(15,113,0,0);

delay(180);

Ceiling_RaiseByValue (13,4,200);
}


I would like to replace the Hellknight (113) to the Baron (3) but I'd like to only have that happen if the difficulty is set above "Hurt Me Plenty." If this is the wrong place to ask I apologize!

Edited by PlinkyBits

Share this post


Link to post

2 answers to this question

Recommended Posts

  • 0

I tried doing this next, but it ALWAYS spawns a baron now:

{

print(s:"Muhahahaha!");

Thing_SpawnFacing(12,2,0,0);

delay(60);

Thing_SpawnFacing(13,2,0,0);

delay(45);

Thing_SpawnFacing(14,2,0,0);

delay(100);

if (GameSkill () <= SKILL_HARD)
Thing_SpawnFacing(15,3,0,0);
else if (GameSkill () <= SKILL_VERY_HARD)
Thing_SpawnFacing(15,100,0,0);
else
Thing_SpawnFacing(15,113,0,0);

delay(180);

Ceiling_RaiseByValue (13,4,200);
}

Share this post


Link to post
  • 0

Change your '<=' to '==' so that the two checks will only affect the desired skill levels, and not everything below them as well.

 

More info:

Spoiler

Your first if-statement checks for GameSkill() value less or equal to SKILL_HARD (Ultra-Violence), so whenever the skill is set to UV or lower, a baron will spawn.

 

Your second if-statement checks whether you're playing on SKILL_VERY_HARD (Nightmare!) or lower, but since the first if-statement already covered all skill levels from UV and below, a stealth baron is spawned only on Nightmare! difficulty.

 

The final else will never be reached, because the previous if-statement already contains all default skill levels.


Also, it's more readable to refer to things by their typename and not number. So T_BARON instead of 3, and so on. Check this list for reference

Edited by Aurelius

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×