Page 1 of 1

Error when attempting to use UpdateWeaponSpawnChances

Posted: Mon May 28, 2018 4:06 am
by Bash Kraken
I'm currently attempting to learn how to use this function, and although my code compiles, it fails when testing ingame.

Here is the code:

public void OnStartup(){
Dictionary<short,int> weaponChances = new Dictionary<short,int>();
weaponChances.Add(17,0);
Game.UpdateWeaponSpawnChances(weaponChances);
}

And here is the error I get when testing it:

Script Error
Error in method 'OnStartup()' in map script. See the exception for more details:
--- Exception ---
Enum underlying type and the object must be same type or object must be a String. Type passed in was 'System.Int16'; the enum underlying type was 'System.Int32'.
System.ArgumentException: Enum underlying type and the object must be same type or object must be a String. Type passed in was 'System.Int16'; the enum underlying type was 'System.Int32'.
at System.RuntimeType.IsEnumDefined(Object value)
at System.Enum.IsDefined(Type enumType, Object value)
at SFD.WeaponSpawnManager.FromDictionary(Dictionary`2 values)
at SFD.GameWorldScriptBridge.UpdateWeaponSpawnChances(Dictionary`2 values)
at SFD.GameWorldScriptBridge.UpdateWeaponSpawnChances(Dictionary`2 values)
at SFDScript.GameScript.OnStartup()

Help would be greatly appreciated!

Re: Error when attempting to use UpdateWeaponSpawnChances

Posted: Mon May 28, 2018 10:16 am
by Gurt
Fixed to the release of SFD.
Doesn't look like Game.UpdateWeaponSpawnChances can be used before the fix.