Save/Load Code, Yet Another

RedRage

New Member
Reaction score
7
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.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,491
> 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.
 
X

xfriox

Guest
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?
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,491
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.
 

SumQuestions

New Member
Reaction score
0
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
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
874
> i got 3 compile errors on each SaveLoad Save and SaveLoad Load Triggers about An Expected Name Please Help ASAP Thanks

Post your code....
 

SumQuestions

New Member
Reaction score
0
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])
 

esb

Because none of us are as cruel as all of us.
Reaction score
325
Do you have those variables made already? (With the correct Variable Type, and Array Size)
 

SumQuestions

New Member
Reaction score
0
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?
 

JakeWC123

New Member
Reaction score
3
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?
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,491
> 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.
 

JakeWC123

New Member
Reaction score
3
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.
 
T

Turilli

Guest
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?
 
G

guy fawkes

Guest
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: [email protected]@



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.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,491
> 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.
 

power

New Member
Reaction score
3
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.
  • jonas jonas:
    Cool, enjoy your vacation!
  • The Helper The Helper:
    Have a great vacation Tom!
  • The Helper The Helper:
    Happy Friday Night!
    +1
  • V-SNES V-SNES:
    Happy Friday Night!
    +1
  • The Helper The Helper:
    Going out of a town for the weekend will be back sunday night! Hope everyone has a great weekend!
    +2
  • The Helper The Helper:
    Happy Monday!
  • Ghan Ghan:
    Monday? Speak for yourself. :p
    +2
  • The Helper The Helper:
    Happy Taco Tuesday!
    +1
  • The Helper The Helper:
    Tacos! :)
  • The Helper The Helper:
    Check out the discord for taco pictures :) You cannot put pictures in this chat
    +1
  • The Helper The Helper:
    Damn here come the bots again - 193 online but they are totally invisible to any stats - bunch of bots!'
  • C cubanismo:
    Re: Taco Tuesday, if there were some way to share edible tacos over the internet, technology would be complete.
    +2
  • The Helper The Helper:
    One can only wish!
  • tom_mai78101 tom_mai78101:
    I'm back from Taiwan
    +1
  • The Helper The Helper:
    I am reorganizing the site I know nobody will notice but I am not done quite yet but the main forums order has been changed and there is a new news category in Other News which is all the remaining headline news stuff not categorized - Headline News is just the stuff that shows on the main page now and the news archive is off the main forums page
  • The Helper The Helper:
    and the real archive lives off of headline news
  • The Helper The Helper:
    Happy Monday!

    The Helper Discord

    Staff online

    • Ghan
      Administrator - Servers are fun

    Members online

    Affiliates

    Hive Workshop NUON Dome World Editor Tutorials

    Network Sponsors

    Apex Steel Pipe - Buys and sells Steel Pipe.
    Top