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!
Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.
New to the forum? Say hello in this topic! Also make sure to read the rules.
New to the forum? Say hello in this topic! Also make sure to read the rules.
Error when attempting to use UpdateWeaponSpawnChances
Forum rules
By using the forum you agree to the following rules. For this forum you also need to follow these additional rules.
By using the forum you agree to the following rules. For this forum you also need to follow these additional rules.
- Bash Kraken
- Superfighter
- Posts: 75
- Joined: Tue Mar 22, 2016 12:49 pm
- Title: Action Hero Extraordinaire
- SFD Alias: Bash Kraken
- Started SFD: December 2012
- Location: Post-Apocalyptic East Coast - U.S.
- Gender: