Save/Load Code, Yet Another

Set Save[3] = Hero[ Player number of Player 1 ]
Set Save[4] = Level of (Hero[ Player number of Player 1 ])
Set SaveCount = 4
...
:
I've come across problems with this,
Hero..? I checked all the integer options their is no Hero[Player number of Player 1] so then i tried to set it to Hero - Hero Attribute, but the Unit options aren't useful any other way i can do...?
Set Save[3] = Hero[ Player number of Player 1 ]
Set Save[4] = Level of (Hero[ Player number of Player 1 ])
Set SaveCount = 4
...
:

Oh and i can't have select unit <gen> because the unit is created.
 
> there is no Hero[Player number of Player 1]

You could make one if you wanted or needed to.
Create a variable called "Hero", of type "Unit", with a check in "array".
Put the Heroes in as the players get them.

Or, well, have a look at the couple examples the map comes with.
The first "Hero" sample uses "Pick every unit in ..." to get the player's Hero.
 
Help

I downloaded your test map and tryed to run it but it wouldn't run it would just open WC3 main screen. Is there a bug or is it just my comp?
 
There are no known problems with running the demo map.
After 300+ downloads people would have noticed.

You're assumed to have TFT, latest version, though.
 
Ok i Need Help!

when i saved the map after doing what u wrote
i got 3 compile errors on each SaveLoad Save and SaveLoad Load Triggers about An Expected Name Please Help ASAP Thanks
 
> i got 3 compile errors on each SaveLoad Save and SaveLoad Load Triggers about An Expected Name Please Help ASAP Thanks

Post your code....
 
Post your code....[/QUOTE]

Code:
SaveLoad
    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
        Player - Player 5 (Yellow) types a chat message containing -Save as An exact match
    Conditions
    Actions
        Set Save[1] = 123
        Set Save[2] = 456
        Set Save[3] = 7890
        Set SaveCount = 3
        Custom script:   set udg_Code = SaveLoad_Encode()
        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
        Set TempUnit = (Picked unit)
        Custom script:   set udg_Save[udg_SaveCount] = SaveLoad_Unit2Integer( udg_TempUnit )
        Set TempItem = (Item carried by (Picked unit) in slot (Integer A))
        Custom script:   set udg_Save[udg_SaveCount] = SaveLoad_Item2Integer( udg_TempItem )
Code:
SaveLoad Load
    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
        Player - Player 5 (Yellow) types a chat message containing -Load as A substring
    Conditions
        (Substring((Entered chat string), 1, 6)) Equal to (Matched chat string)
        (Length of (Entered chat string)) Greater than 6
    Actions
        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
                Game - Display to (Player group((Triggering player))) the text: There's some error ...
                Skip remaining actions
            Else - Actions
                Set SaveCount = 1
                Custom script:   set udg_TempUnitType = SaveLoad_Integer2Unit(udg_Save[udg_SaveCount])
                Unit - Create 1 TempUnitType for (Triggering player) at (Center of Start Team 1 <gen>) facing Default building facing degrees
                Set SaveCount = (SaveCount + 1)
                Hero - Set (Last created unit) Hero-level to Save[SaveCount], Hide level-up graphics
                For each (Integer A) from 1 to Save[SaveCount], do (Actions)
                    Loop - Actions
                        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)
                        Set SaveCount = (SaveCount + 1)
                        Item - Set charges remaining in (Last created item) to Save[SaveCount]


These are the errors

Code:
1. Custom script:   set udg_Code = SaveLoad_Encode()
2. Custom script:   set udg_Save[udg_SaveCount] = SaveLoad_Unit2Integer( udg_TempUnit )
3. Custom script:   set udg_Save[udg_SaveCount] = SaveLoad_Item2Integer( udg_TempItem )
4. Custom script:   set udg_Validate = SaveLoad_Decode( udg_Code )
5. Custom script:   set udg_TempItemType = SaveLoad_Integer2Item(udg_Save[udg_SaveCount])
6. Custom script:   set udg_TempUnitType = SaveLoad_Integer2Unit(udg_Save[udg_SaveCount])
 
Do you have those variables made already? (With the correct Variable Type, and Array Size)
 
i have another question, i want to save units in an area for a player, say they have 4 units in region 1 and when you save it saves those units so that the next time you load you get those four units back in region 1. how do i do this?
 
I wanna use this code but in my map i add atributes with a dialog and whenenver u use the load it doesnt work alll the atributes are 1. any1 know how to fix this?
 
> say they have 4 units in region 1

Set UnitGroup = Units in region matching:
- Unit is owned by Triggering player
- Unit is (not) a Hero
- Unit is alive
Set Save[...] = Number of units in UnitGroup
Pick every unit in UnitGroup and do
... add it to the Save array.

And the other way around to load them back.


> I add attributes with a dialog

Save them...

Set Save[...] = Strength of (Picked unit)
Set Save[...] = Agility ...
...

And restore them in the load part.
 
thnx and i gotta nother 3 Questions.

1st. For Storing Items Couldnt You Just Do This.

Item - Pick every item in (Playable map area) and do (Actions)
Loop - Actions
Set SaveLoad_Items[1] = (Item-type of (Picked item))



2nd. How Do you change the clolors of the numbers / letters i did this.

Game - Display to (Player group((Triggering player))) for 60.00 seconds the text: ((|c00FF8000 + Code) + |r)

but only part of the code was the color i wanted it to be.


And 3rd
Most Of The Time when i load the atributes Are 4,5,6 instead of the ones saved?
Or THe Heroe Doesnt Load but it says it Worked.
 
Hey AceHeart. I've been using your code for and RPG map I've been working on, and everything has been going extremely smooth. However, I have encountered a problem now.

I'm pretty much pushing the code to its limits. I'm saving 6 heroes, their level (not experience), their item (each hero can only hold 1), and the player's gold.

Now, it works for the most part, however, when the heroes are max level (level 100), and they're all holding 1 item, the code will not appear. I assume this is because it is exceeding some limit in length. However, when I drop one unit's item, the code will appear.

When I type the code in, there is still ample space left in the player's chat message, however, the code will not appear if it exceeds (aproximately) 75 characters - even though the player is able to type in far more than 75 characters.

Is there anyway to fix this?
 
the map editor won't allow me to open the map you gave. :confused:

first it comes up a bunch of 'trigger function does not exist on database: ...' notifications then a:

'This application has encountered a critical error:

Not enough storage is available to process this command.

Program: c:\program files\warcraft iii\worldedit.exe
Object: .PAVCWETriggerFunction@@



Press OK to terminate the application.'

i've tried effane's save/load code map as well and it comes up with the same error.
 
> Item - Pick every item in (Playable map area)

That only finds items on the ground. Not in inventories.


> How Do you change the clolors of the numbers / letters

Somewhere more or less near the top in the custom script section is a function that color-codes the result.
Find and edit it... carefully.


> it comes up a bunch of 'trigger function does not exist on database: ...'

Get the latest patch.


> Is there anyway to fix this?

Sort of.
Save them in two blocks of 3...


> "stash"

If by "stash" you mean some kind of unit with an inventory... well, there's a loop that finds and saves your Hero.
Take it and change the "pick every in" to find both your Hero and your "stash" unit.

There is an example trigger in the map that saves several Heroes, should you need some inspiration.
 
I'm so bad at this save and load stuff, When I copy your triggers into my map all I get is this "Script not found" or error and all this and I have to press ok like a million times, what do I need to do. Thanks for replying when you do!
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/
  • The Helper The Helper:
    Happy Thursday!
  • Ghan Ghan:
    I'm not so sure, there's still a lot of Thursday left for it to become unhappy.
    +3
  • The Helper The Helper:
    still a few hours
  • The Helper The Helper:
    Its Friday!!!!
    +1
  • Ghan Ghan:
    Thursday 7/10 would Thursday again
    +3

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top