I need to figure out why this save trigger is adding random abilities instead of the ones that are learnt through items , it wont save the spell thats added at level one i have tried so many different ways i want to make it where the hero has no spells at start accept for the one u start with and as u play the game u get spells from boss drops and level them up with same items again but when i save it doesnt load the first spell or set the levels of the other ones and sometimes adds another random one
-
Save Abilities
-
Events
- Player - Player 1 (Red) types a chat message containing -save as An exact match
- Player - Player 2 (Blue) types a chat message containing -save as An exact match
- Player - Player 3 (Teal) types a chat message containing -save as An exact match
- Player - Player 4 (Purple) types a chat message containing -save as An exact match
- Conditions
-
Actions
- -------- Find the players hero, and save it. I realize it leaks but it's just for demonstration. --------
- Set SaveCount = 0
- Unit Group - Pick every unit in (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True)) and do (Set Hero = (Picked unit))
- Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertUnit(GetUnitTypeId(udg_Hero))
- -------- Save heroes level. --------
- Set SaveCount = (SaveCount + 1)
- Set Save[SaveCount] = (Hero level of Hero)
- -------- Save players gold. --------
- Set SaveCount = (SaveCount + 1)
- Set Save[SaveCount] = ((Triggering player) Current gold)
- -------- Save heroes items. --------
- Set SaveCount = (SaveCount + 1)
- Set Save[SaveCount] = (Number of items carried by Hero)
-
For each (Integer A) from 1 to Save[SaveCount], do (Actions)
-
Loop - Actions
- Set SaveCount = (SaveCount + 1)
- Set Item = (Item carried by Hero in slot (Integer A))
- Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertItem(GetItemTypeId(udg_Item))
-
Loop - Actions
- -------- Save players Lumber. --------
- Set SaveCount = (SaveCount + 1)
- Set Save[SaveCount] = ((Triggering player) Current lumber)
- -------- Save heroes skills --------
-
For each (Integer A) from 0 to SaveLoad_AbilityCount, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Level of SaveLoad_Abilities[(Integer A)] for Hero) Greater than 0
-
Then - Actions
- -------- save skill level --------
- Set SaveCount = (SaveCount + 1)
- Set Save[SaveCount] = (Level of SaveLoad_Abilities[(Integer A)] for Hero)
- Game - Display to (All players) the text: (String(Save[SaveCount]))
- Set SaveCount = (SaveCount + 1)
- Set Save[SaveCount] = (Level of SaveLoad_Abilities[(Integer A)] for Hero)
- Set SaveCount = (SaveCount + 1)
- Custom script: set udg_Save[udg_SaveCount] = bj_forLoopAIndex
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
- -------- Show Code --------
- Custom script: set udg_Code = CodeGen_Compile()
- Game - Display to (Player group((Triggering player))) for 60.00 seconds the text: Code
-
Events
-
Load Abilities
-
Events
- Player - Player 1 (Red) types a chat message containing -load as A substring
- Player - Player 2 (Blue) types a chat message containing -load as A substring
- Player - Player 3 (Teal) types a chat message containing -load as A substring
- Player - Player 4 (Purple) types a chat message containing -load as A substring
-
Conditions
- (String((Substring((Entered chat string), 1, 6))) as Lower case) Equal to -load
-
Actions
- -------- Check if load is valid --------
- Set Code = (Substring((Entered chat string), 7, 999))
- Custom script: call CodeGen_Load(udg_Code)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- SaveLoad_Valid Equal to False
-
Then - Actions
- Game - Display to (Player group((Triggering player))) for 10.00 seconds the text: SaveLoad_Error
- Skip remaining actions
- Else - Actions
-
If - Conditions
- -------- Start loading, load the hero first. --------
- Set LoadCount = 0
- Unit Group - Pick every unit in (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True)) and do (Unit - Remove (Picked unit) from the game)
- Unit - Create 1 SaveLoad_Hero[Load[LoadCount]] for (Triggering player) at (Center of Region 008 <gen>) facing Default building facing degrees
- Set Hero = (Last created unit)
- Selection - Select (Last created unit) for (Triggering player)
- -------- Load heroes level --------
- Set LoadCount = (LoadCount + 1)
- Hero - Set (Last created unit) Hero-level to Load[LoadCount], Hide level-up graphics
- -------- Now load players gold --------
- Set LoadCount = (LoadCount + 1)
- Player - Set (Triggering player) Current gold to Load[LoadCount]
- -------- Now items --------
- Set LoadCount = (LoadCount + 1)
- Set ItemCount = Load[LoadCount]
-
For each (Integer A) from 1 to Load[LoadCount], do (Actions)
-
Loop - Actions
- Set LoadCount = (LoadCount + 1)
- Hero - Create SaveLoad_Item[Load[LoadCount]] and give it to Hero
-
Loop - Actions
- -------- abilities --------
-
For each (Integer A) from 1 to 5, do (Actions)
-
Loop - Actions
- Set LoadCount = (LoadCount + 1)
- Set AbilityLevel = Load[LoadCount]
- Game - Display to (All players) the text: (String(AbilityLevel))
- Set LoadCount = (LoadCount + 1)
-
For each (Integer B) from 1 to AbilityLevel, do (Actions)
-
Loop - Actions
- Custom script: call UnitAddAbility(udg_Hero, udg_SaveLoad_Abilities[udg_Load[udg_LoadCount]])
-
Loop - Actions
-
Loop - Actions
-
Events