I tried to make a save/load system from scratch and it works neatly, but when I tried to load an ability it did not seem to work.
Does anyone know how to fix this ?
EDIT:
Figured it out already. Sorry for the bother
-
Save Variable Set
-
Events
- Map initialization
- Conditions
-
Actions
- -------- Set Heroes Variable --------
- Set HeroTypes[1] = Heavy Soldier
- Set HeroTypesCoded[1] = 0A
- Set HeroTypes[2] = Soldier
- Set HeroTypesCoded[2] = 1S
- Set HeroTypes[3] = Back-up
- Set HeroTypesCoded[3] = 2J
- Set HeroTypesLimit = 3
- -------- Heroes Variable Finished --------
- -------- Set Ability Variable --------
- Set AbilityTypes[1] = Wooden Axe +0
- Set AbilityCoded[1] = O1
- Set AbilityLimit = 1
- -------- Ability Variable Finished --------
-
Events
-
Hero Save
-
Events
- Player - Player 1 (Red) types a chat message containing -save as An exact match
- Conditions
-
Actions
-
Unit Group - Pick every unit in (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
-
Loop - Actions
-
For each (Integer A) from 1 to HeroTypesLimit, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- HeroTypes[(Integer A)] Equal to (Unit-type of (Picked unit))
-
Then - Actions
- Set Final_Code = (Final_Code + HeroTypesCoded[(Integer A)])
-
For each (Integer A) from 1 to AbilityLimit, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Level of AbilityTypes[(Integer A)] for (Picked unit)) Equal to 1
-
Then - Actions
- Set Final_Code = (Final_Code + AbilityCoded[(Integer A)])
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
For each (Integer A) from 1 to HeroTypesLimit, do (Actions)
-
Loop - Actions
- Game - Display to (Player group((Triggering player))) the text: Final_Code
-
Unit Group - Pick every unit in (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
-
Events
-
Hero Load
-
Events
- Player - Player 1 (Red) types a chat message containing -load as A substring
-
Conditions
- (Substring((Entered chat string), 1, 6)) Equal to -load
- (Number of units in (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True))) Equal to 0
-
Actions
- Set Final_Code = (Substring((Entered chat string), 7, (Length of (Entered chat string))))
-
For each (Integer A) from 1 to (Length of Final_Code), do (Actions)
-
Loop - Actions
-
For each (Integer B) from 1 to HeroTypesLimit, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Substring(Final_Code, (Integer A), ((Integer A) + 1))) Equal to HeroTypesCoded[(Integer B)]
-
Then - Actions
- Unit - Create 1 HeroTypes[(Integer B)] for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
- Set LoadedHero[(Player number of (Triggering player))] = (Last created unit)
-
For each (Integer A) from 1 to AbilityLimit, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Substring(Final_Code, 9, 10)) Equal to AbilityCoded[(Integer A)]
-
Then - Actions
- Unit - Add AbilityTypes[(Integer A)] to LoadedHero[(Player number of (Triggering player))]
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
For each (Integer B) from 1 to HeroTypesLimit, do (Actions)
-
Loop - Actions
-
Events
EDIT:
Figured it out already. Sorry for the bother
Last edited: