Ninjaluxray Posted September 2, 2024 Posted September 2, 2024 (edited) is there anyone how has masterd the understanding of scripting in creation kit im having some much trouble Rundown im creating a mod where crafting a blade has a random chance of applying a random enchantment 1,2,3 times on none at all here is my script and the error i am getting i dont know what this means or how to fix it Spoiler Scriptname BladeOfChanceCraftScript extends ObjectReference ; Base Enchantment properties Enchantment Property FireDamageEnchantment Auto Enchantment Property FrostDamageEnchantment Auto Enchantment Property ShockDamageEnchantment Auto Enchantment Property AbsorbHealthEnchantment Auto Enchantment Property BanishEnchantment Auto Enchantment Property ParalyzeEnchantment Auto Enchantment Property MagickaAbsorbEnchantment Auto Enchantment Property StaminaAbsorbEnchantment Auto Enchantment Property TurnUndeadEnchantment Auto Enchantment Property FearEnchantment Auto Enchantment Property SoulTrapEnchantment Auto Weapon Property BladeOfChance Auto ; Reference to the Blade of Chance Event OnInit() ; Ensure the script is for the correct weapon if Self == BladeOfChance ; Array of possible enchantments Enchantment[] enchantments = new Enchantment[11] enchantments[0] = FireDamageEnchantment enchantments[1] = FrostDamageEnchantment enchantments[2] = ShockDamageEnchantment enchantments[3] = AbsorbHealthEnchantment enchantments[4] = BanishEnchantment enchantments[5] = ParalyzeEnchantment enchantments[6] = MagickaAbsorbEnchantment enchantments[7] = StaminaAbsorbEnchantment enchantments[8] = TurnUndeadEnchantment enchantments[9] = FearEnchantment enchantments[10] = SoulTrapEnchantment ; Random number to decide the number of enchantments int roll = Utility.RandomInt(1, 20) int numEnchantments = 0 ; Determine how many enchantments to apply based on the roll if roll == 8 ; Group 1: 3 random enchantments numEnchantments = 3 elseif roll == 2 || roll == 9 || roll == 14 ; Group 2: 2 random enchantments numEnchantments = 2 elseif roll == 1 || roll == 3 || roll == 4 || roll == 5 || roll == 6 || roll == 10 || roll == 11 || roll == 18 ; Group 3: 1 random enchantment numEnchantments = 1 else ; Group 4: no enchantment numEnchantments = 0 endif ; Shuffle the array for randomness int length = 11 ; The length of the array int i = 0 int j = 0 Enchantment temp while i < length j = Utility.RandomInt(0, length - 1) ; Swap elements at indices i and j temp = enchantments enchantments = enchantments[j] enchantments[j] = temp i += 1 endwhile ; Apply enchantments to the weapon int k = 0 while k < numEnchantments if k == 0 Self.SetEnchantment(enchantments[k]) else Self.AddEnchantment(enchantments[k]) endif k += 1 endwhile endif EndEvent Errors Breakdown Error at Line 55, Column 8: no viable alternative at input 'int' Explanation: This error typically indicates a problem with how the int keyword or variable declarations are used in the script. Papyrus might be expecting a different syntax or context. Error at Line 55, Column 19: required (...)+ loop did not match anything at input '=' Explanation: This error often occurs if there is a syntax issue with how variables are assigned or if there is an error with loop constructs. Edited September 2, 2024 by Ninjaluxray
LittleWhiteNeko Posted September 2, 2024 Posted September 2, 2024 (edited) It looks like Length is a reserved variable name, use different variable name instead. Edited September 2, 2024 by LittleWhiteNeko
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now