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,495
> 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,495
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
889
> 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
329
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
2
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,495
> 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
2
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: .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.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> 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.
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/
  • The Helper The Helper:
    I think we need to add something to the bottom of the front page that shows the Headline News forum that has a link to go to the News Forum Index so people can see there is more news. Do you guys see what I am saying, lets say you read all the articles on the front page and you get to the end and it just ends, no kind of link for MOAR!
  • The Helper The Helper:
    Happy Wednesday!
    +1

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top