This forum is locked and will eventually go offline. If you have feedback to share you can find us in our Discord channel "MythoLogic Interactive" https://discord.gg/nECKnbT7gk

Forum rules

Scripting 19 - Player modifiers

A smaller forum with a few tutorials how to get started with the ScriptAPI.
Forum rules
By using the forum you agree to the following rules.
Locked
User avatar
Gurt
Lead Programmer
Lead Programmer
Posts: 1887
Joined: Sun Feb 28, 2016 3:22 pm
Title: Lead programmer
Started SFD: Made it!
Location: Sweden
Gender:
Age: 36

Scripting 19 - Player modifiers

Post by Gurt » Sun Aug 25, 2019 10:13 am

Scripting 19 - Player modifiers

Scripting in SFD assumes you have a fair knowledge of C#.

The following code demonstrates how to update some modifiers for all players on startup.
See the ScriptAPI documentation for a full list of available modifiers.

Code: Select all

public void AfterStartup()
{
	foreach(IPlayer plr in Game.GetPlayers()) 
	{
		PlayerModifiers modifiers = plr.GetModifiers();
		modifiers.MaxHealth = 200;
		modifiers.EnergyRechargeModifier = 2.0f;
		modifiers.CanBurn = 0;
		plr.SetModifiers(modifiers);
	}
}
1 x
Gurt

Locked