• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Save/Load Issues - AceHart's system

Status
Not open for further replies.
Well I finally got items to save and load working again after a while...
Now it won't save and load stats properly, but it does everything else correctly.
The events are added from another trigger, so that is not the reason this doesn't work.

[TRIGGER=]Save
Events
Conditions
Actions
-------- Prepare the save array with this player's Hero --------
Set SaveCount = 0
-------- Take all Heroes (assumes there is only one) --------
Unit Group - Pick every unit in (Units owned by (Triggering player) matching ((((Matching unit) is A Hero) Equal to True) and ((Unit-type of (Matching unit)) Not equal to Picker))) and do (Actions)
Loop - Actions
-------- Save the Hero --------
Set SaveCount = (SaveCount + 1)
Set TempUnit = (Picked unit)
Custom script: set udg_Save[udg_SaveCount] = SaveLoad_Unit2Integer( udg_TempUnit )
-------- Hero level --------
Set SaveCount = (SaveCount + 1)
Set Save[SaveCount] = (Hero experience of (Picked unit))
-------- Hero stats --------
Set SaveCount = (SaveCount + 1)
Set Save[SaveCount] = saveagi[(Player number of (Owner of (Picked unit)))]
Set SaveCount = (SaveCount + 1)
Set Save[SaveCount] = saveint[(Player number of (Owner of (Picked unit)))]
Set SaveCount = (SaveCount + 1)
Set Save[SaveCount] = savestr[(Player number of (Owner of (Picked unit)))]
-------- How many items does he carry --------
Set SaveCount = (SaveCount + 1)
Set Save[SaveCount] = (Number of items carried by (Picked unit))
-------- Add all items --------
Set SaveCount = (SaveCount + 1)
Set TempItem = (Item carried by (Picked unit) in slot 1)
Custom script: set udg_Save[udg_SaveCount] = SaveLoad_Item2Integer( udg_TempItem )
Set SaveCount = (SaveCount + 1)
Set Save[SaveCount] = (Charges remaining in (Item carried by (Picked unit) in slot 1))
Set SaveCount = (SaveCount + 1)
Set TempItem = (Item carried by (Picked unit) in slot 2)
Custom script: set udg_Save[udg_SaveCount] = SaveLoad_Item2Integer( udg_TempItem )
Set SaveCount = (SaveCount + 1)
Set TempItem = (Item carried by (Picked unit) in slot 3)
Custom script: set udg_Save[udg_SaveCount] = SaveLoad_Item2Integer( udg_TempItem )
Set SaveCount = (SaveCount + 1)
Set TempItem = (Item carried by (Picked unit) in slot 4)
Custom script: set udg_Save[udg_SaveCount] = SaveLoad_Item2Integer( udg_TempItem )
Set SaveCount = (SaveCount + 1)
Set TempItem = (Item carried by (Picked unit) in slot 5)
Custom script: set udg_Save[udg_SaveCount] = SaveLoad_Item2Integer( udg_TempItem )
Set SaveCount = (SaveCount + 1)
Set TempItem = (Item carried by (Picked unit) in slot 6)
Custom script: set udg_Save[udg_SaveCount] = SaveLoad_Item2Integer( udg_TempItem )
For each (Integer A) from 1 to 6, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Item carried by (Picked unit) in slot (Integer A)) is owned) Equal to True
Then - Actions
-------- The actual item --------
Set SaveCount = (SaveCount + 1)
Set TempItem = (Item carried by (Picked unit) in slot (Integer A))
Custom script: set udg_Save[udg_SaveCount] = SaveLoad_Item2Integer( udg_TempItem )
-------- The number of charges it has --------
Set SaveCount = (SaveCount + 1)
Set Save[SaveCount] = (Charges remaining in (Item carried by (Picked unit) in slot (Integer A)))
Else - Actions
-------- Turn values into code --------
Custom script: set udg_Code = SaveLoad_Encode()
-------- Show code to player --------
Quest - Display to (Player group((Triggering player))) the Secret message: Your code:
Game - Display to (Player group((Triggering player))) for 60.00 seconds the text: Code
Game - Display to (Player group((Triggering player))) for 60.00 seconds the text: You can also look i...

[/TRIGGER]

[TRIGGER=]Load
Events
Conditions
(Substring((Entered chat string), 1, 6)) Equal to (Matched chat string)
(Length of (Entered chat string)) Greater than 6
((Triggering player) is in loaders) Equal to True
Actions
-------- Try to decode what was typed --------
Set Code = (Substring((Entered chat string), 7, (Length of (Entered chat string))))
Custom script: set udg_Validate = SaveLoad_Decode( udg_Code )
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Validate Equal to False
Then - Actions
-------- Invalid code --------
Game - Display to (Player group((Triggering player))) the text: There's some error ...
Skip remaining actions
Else - Actions
-------- It worked, let's do something with it --------
Player Group - Remove (Triggering player) from new
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
Unit - Remove (Picked unit) from the game
Set SaveCount = 1
Custom script: set udg_TempUnitType = SaveLoad_Integer2Unit(udg_Save[udg_SaveCount])
Unit - Create 1 TempUnitType for (Triggering player) at (Random point in Region 009 <gen>) facing Default building facing degrees
Unit - Set level of Bite werewolf for (Last created unit) to 2
Unit - Set level of Bite wyvern for (Last created unit) to 2
Unit - Set level of Fregar for (Last created unit) to 3
Set SaveCount = (SaveCount + 1)
Hero - Set (Last created unit) experience to Save[SaveCount], Hide level-up graphics
-------- Hero stats --------
Set SaveCount = (SaveCount + 1)
Hero - Modify Agility of (Last created unit): Add Save[SaveCount]
Set SaveCount = (SaveCount + 1)
Hero - Modify Intelligence of (Last created unit): Add Save[SaveCount]
Set SaveCount = (SaveCount + 1)
Hero - Modify Strength of (Last created unit): Add Save[SaveCount]
-------- Hero stats --------
Set SaveCount = (SaveCount + 1)
Set SaveCount = (SaveCount + 1)
Custom script: set udg_TempItemType = SaveLoad_Integer2Item(udg_Save[udg_SaveCount])
Hero - Create TempItemType and give it to (Last created unit)
-------- item --------
Set SaveCount = (SaveCount + 1)
Custom script: set udg_TempItemType = SaveLoad_Integer2Item(udg_Save[udg_SaveCount])
Hero - Create TempItemType and give it to (Last created unit)
-------- item --------
Set SaveCount = (SaveCount + 1)
Custom script: set udg_TempItemType = SaveLoad_Integer2Item(udg_Save[udg_SaveCount])
Hero - Create TempItemType and give it to (Last created unit)
-------- item --------
Set SaveCount = (SaveCount + 1)
Custom script: set udg_TempItemType = SaveLoad_Integer2Item(udg_Save[udg_SaveCount])
Hero - Create TempItemType and give it to (Last created unit)
-------- item --------
Set SaveCount = (SaveCount + 1)
Custom script: set udg_TempItemType = SaveLoad_Integer2Item(udg_Save[udg_SaveCount])
Hero - Create TempItemType and give it to (Last created unit)
-------- item --------
Set SaveCount = (SaveCount + 1)
Custom script: set udg_TempItemType = SaveLoad_Integer2Item(udg_Save[udg_SaveCount])
Hero - Create TempItemType and give it to (Last created unit)
-------- item --------
Set SaveCount = (SaveCount + 1)
Item - Set charges remaining in (Last created item) to Save[SaveCount]
Player - Add -10 to (Triggering player) Current lumber
Player Group - Remove (Triggering player) from loaders

[/TRIGGER]


EDIT: It can't take number values past 400 it seems.... I thought it supported more then 30 items and past 400..... owell. Anyone know of a way to fix this?
 
Last edited:
Level 31
Joined
Jul 10, 2007
Messages
6,306
Set Save[SaveCount] = saveagi[(Player number of (Owner of (Picked unit)))]
Set SaveCount = (SaveCount + 1)
Set Save[SaveCount] = saveint[(Player number of (Owner of (Picked unit)))]
Set SaveCount = (SaveCount + 1)
Set Save[SaveCount] = savestr[(Player number of (Owner of (Picked unit)))]


you are reading an array rather than the hero stats
 
Indeed Statharas... Though I doubt this will work anyways, AceHart even said it is flawed. I just wanted to see if anyone knew a way to make it save a bit more data then how limited it is already.

Nestharus it is the hero stats.... An array that does the hero stats because if I just saved normal stats then many glitches and exploits will happen. So yeah..... they're the same thing.

EDIT: I just got an idea, could I split up the code because since it has a maximum could I loop around it by making it do 5-7 codes for everything instead of trying one giant code...?
 
Last edited:
Bump, AceHart's Save/Load only does up to 1M values right? How do the values add up?

if its level + items for example.

then level 10+ with items in the array of 10+ and then with 5-6 items as well with level 10+.... It shouldn't work yet it does...

10 + 6 more values of 10 = higher then 1 million isn't it?
Or do they convert into values of 2? Even so that should still hit 1M+
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Just to give a reminder, PipeDream's save/load system is buggy. If you use it, you will receive complaints about codes that don't work =), I can guarantee it.

During division, it carries and what not (long division). However, what it carries can easily go over the 32 bit limit of an integer, meaning that it overflows. This results in incorrect numbers being read out of the code.

Only PipeDream's save/load system has this issue.

Just a warning, but if you do use it, I can guarantee that your codes will be broken ^_^, a good portion of them anyways. It doesn't always happen, it's % chance, so only a good portion of your codes will be broken, not all of them. If PipeDream's thing were to move to BigInt, this would fix the problem, but even the current edition of BigInt isn't 100% accurate. It's only good up to 275 character long codes, which is more than twice the max save/load code you can have, so you'll never run into a bad code =o. The new version of BigInt is 100% accurate regardless of size =).
 
Status
Not open for further replies.
Top