How to change PlayerModifierInfo using a certain difficulty
Forum rules
By using the forum you agree to the following rules.
By using the forum you agree to the following rules.
- dsafxP
- Meatbag
- Posts: 8
- Joined: Fri May 08, 2020 5:16 am
- SFD Account: dsafxP
- SFD Alias: dsafxP
- Started SFD: 2020
- Location: Argentina
- Gender:
How to change PlayerModifierInfo using a certain difficulty
So, I'm doing a campaign and i'm trying to do a script that changes a PlayerModifierInfo when you use a certain difficulty, is there any guides to do this? there are many and i'm not able to find a guide that explains how to do this. Thanks in advance.
0 x
Who's gonna clean this mess?
- Odex64
- Superfighter
- Posts: 172
- Joined: Sat Jul 29, 2017 12:39 pm
- Title: Content Creator
- SFD Account: Odex64
- Started SFD: PreAlpha
- Location: Italy
- Gender:
- Age: 22
It's pretty easy changing Bots' modifiers depending on the campaign difficulty. Here's the script:
As you can see each number represents the campaign difficulty. You just have to paste this script in your map and assign each Bot/ModifierInfo a customID (remember to use different IDs for bots & modifiers); Then you have to write SetModifiers(); and type inside the brackets the Bot's CustomID and the Modifier's ID.
You can also add extra IDs for Special bots, ex:
I think that's all. Good luck with your map.
Code: Select all
public void SetModifiers(string id, string modifier)
{
foreach(IObjectPlayerSpawnTrigger bot in Game.GetObjectsByCustomId(id))
bot.SetModifierInfo((IObjectPlayerModifierInfo) Game.GetSingleObjectByCustomId(modifier));
}
public void OnStartup()
{
switch (Game.CurrentDifficulty.ToString())
{
case "0,25": //EASY
SetModifiers("thebot", "easy");
break;
case "0,5": //NORMAL
SetModifiers("thebot", "normal");
break;
case "0,75": //HARD
SetModifiers("thebot", "hard");
break;
case "1": //EXPERT
SetModifiers("thebot", "expert");
break;
}
}
You can also add extra IDs for Special bots, ex:
Code: Select all
case "1": //EXPERT
SetModifiers("thebot", "expert");
SetModifiers("Boss", "specialExpert");
break;
0 x