Save/Load Code, Yet Another

power

New Member
Reaction score
3
Oh I see it.. Sorry.. I didn't know! Thanks for posting this and helping me countless times! (Your a bloody legend :D)
 

power

New Member
Reaction score
3
Probably been asked this but how do I save the hero and another unit *IN this case a mount/unit that can carry your hero*
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
This has been asked before, and the reply is still the same.
There's an example trigger that saves several Heroes if you have them.
Change the units that are picked to include your "mount".
 

JakeWC123

New Member
Reaction score
2
With your Save Load Code its not sAVing items. its only saving one of the items out of the 6 or how ever many i have.

i tried recopying the code into my map from your demo and the one i copied into my map the 2nd time did the same thing?
 

Nestharus

o-o
Reaction score
84
Warcraft 3 has very limited processing power.

The characters being displayed aren't the problem. It's the calculator being used. At one point, the numbers go beyond the maximum, the loops go beyond the maximum, etc. In truth, it wouldn't crash warcraft 3, but Blizzard supports stability, so in order to stop something that might prove a tiny bit unstable, Warcraft 3 just stops processing the commands all together. This is why your save/load codes won't appear.

Now, what Acehart said was a good idea if you are trying to get around the calculator issue, however.. you need to give the processor a break. It's like running thru 5000 loops. Do you think warcraft 3 will actually run thru all 5000???

Probably not... unless you pause it at some point and give it a break.

What I suggest:
Save portion by portion, maybe even show what's being saved and the %. Store all of the information. When your done saving one chunk, pause, then start the next chunk. When it's all saved, show the code to the player. That will work.

For example:
Now Saving Heroes
Now Saving Items
Now Saving Gold and Lumber

As long as you have MPI (multi-player instance), it should work fine.

You can't go beyond the processing power of what you are using ; )

hope this helps

To jake
Jake, are you sure you are using a loop to save all of the items? If you only save the item in slot 1, it will only save the item in slot 1
You need to do something like a for loop for each slot the hero has from 1 to the maxmum slot. Save the item in slot x, then go on. It sounds like you're just saving the first item ;P


-nes
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
> your Save Load Code is not saving items

In the unlikely event that your item list would be, let's say, over 30, put the 30 most used ones, and forget the others.
They will be saved regardless of being in the list or not.
You'll get a code with a couple extra characters, but it will work.

If that wouldn't be it:
"It doesn't work" is not a very good problem description.
 

JakeWC123

New Member
Reaction score
2
I never touched the item part of the save load it says sometine like Saving all items in Integer A . but when i load it only gives me 1 item. i also imported it again into my map without changing anything and even changed the custom script back and it still was only saving 1 item.
 
T

Turilli

Guest
Warcraft 3 has very limited processing power.

The characters being displayed aren't the problem. It's the calculator being used. At one point, the numbers go beyond the maximum, the loops go beyond the maximum, etc. In truth, it wouldn't crash warcraft 3, but Blizzard supports stability, so in order to stop something that might prove a tiny bit unstable, Warcraft 3 just stops processing the commands all together. This is why your save/load codes won't appear.

Now, what Acehart said was a good idea if you are trying to get around the calculator issue, however.. you need to give the processor a break. It's like running thru 5000 loops. Do you think warcraft 3 will actually run thru all 5000???

Probably not... unless you pause it at some point and give it a break.

What I suggest:
Save portion by portion, maybe even show what's being saved and the %. Store all of the information. When your done saving one chunk, pause, then start the next chunk. When it's all saved, show the code to the player. That will work.

For example:
Now Saving Heroes
Now Saving Items
Now Saving Gold and Lumber

As long as you have MPI (multi-player instance), it should work fine.

You can't go beyond the processing power of what you are using ; )

hope this helps

I assume this was directed at my question.
I thank you for the detailed answer as well, but I don't have much experience with save/load systems. Is there any specific function you would reccomend for "pausing" inbetween the chunks of information I'd be saving?
 

Nestharus

o-o
Reaction score
84
Creating a simple timer to pause the trigger would do the trick, or maybe creating your own unique pauser function. It would be best to mask this as something such as what I said above:
Saving items
Saving hero

etc etc

=)

So, a simple timer would do the trick.

Just pause between each hero

Hopefully this helps =)
 

ROTS19

TH.net Regular
Reaction score
12
I changed the triggers a little so that it supopsed to save integers instead of heroes/items and spells. here's how the triggers look.,

Code:
SaveLoad Initialization
    Events
        Map initialization
    Conditions
    Actions
        -------- List of Scores --------
        Set PlayerScore[1] = 0
        Set PlayerScore[2] = 0
        Set PlayerScore[3] = 0
        Set PlayerScore[4] = 0
        Set PlayerScore[5] = 0
        Set PlayerScore[6] = 0
        Set PlayerScore[7] = 0
        Set PlayerScore[8] = 0
        Set PlayerScore[9] = 0
        Set PlayerScore[10] = 0
        Set PlayerScore[11] = 0
        Set PlayerScore[12] = 0
        -------- Number of PlayersScores --------
        Set SaveLoad_LastIndex = 12
        -------- These three lines may be changed if needed --------
        Set Saveload_Alphabet = abcdefghijklmnopqrstuvwxyz1234567890?!@$%^&*()<>[]
        Set SaveLoad_CaseSensitive = False
        Set SaveLoad_UsePlayerName = True
        -------- Required: false --------
        Set SaveLoad_Initialized = False
        -------- Leave as is. Used to autocreate variables when copy & pasting to a new map --------
        Set Code = AceHart
        Set Save[1] = 0
        Set SaveCount = 1
        Set Validate = False
        Set SaveLoad_Compress[1] = 0
        Set SaveLoad_Uncompress[1] = 0

Code:
SaveLoad Save
    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
    Conditions
    Actions
        -------- Those values need saving --------
        Set Save[1] = PlayerScore[1]
        Set Save[2] = PlayerScore[2]
        Set Save[3] = PlayerScore[3]
        Set Save[4] = PlayerScore[4]
        Set Save[5] = PlayerScore[5]
        Set Save[6] = PlayerScore[6]
        Set Save[7] = PlayerScore[7]
        Set Save[8] = PlayerScore[8]
        Set Save[9] = PlayerScore[9]
        Set Save[10] = PlayerScore[10]
        Set Save[11] = PlayerScore[11]
        Set Save[12] = PlayerScore[12]
        -------- The number of values we have --------
        Set SaveCount = 12
        -------- 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 900.00 seconds the text: Code
        Game - Display to (Player group((Triggering player))) for 900.00 seconds the text: Tip: Write down or ...

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
    Conditions
        (Substring((Entered chat string), 1, 6)) Equal to (Matched chat string)
        (Length of (Entered chat string)) Greater than 6
    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 True
            Then - Actions
                -------- It worked, let's do something with it --------
                For each (Integer A) from 1 to SaveCount, do (Actions)
                    Loop - Actions
                        Game - Display to (Player group((Triggering player))) the text: (Decode:  + (String(Save[(Integer A)])))
            Else - Actions
                -------- Invalid code --------
                Game - Display to (Player group((Triggering player))) the text: Invalid Code

and i copied the custom script thingwhere you click on the map name in the trigger editor in the same place in my map,

it basicly, whenever i save, (the map), it saves the map, but it gives me lots of compile errors, and when i try to test, it just goes to the main menu, and i cant enable the triggers...so, what did i do that messed it up?
 

ROTS19

TH.net Regular
Reaction score
12
> some example?

yeah, so theres 260 and here's one on 142 (expected a name)

Code:
        exitwhen i > udg_SaveLoad_Heroes_LastIndex

145 (Expected 'endloop')
Code:
        endif

156 (Expected 'endif')
Code:
    endif

it doesnt highlight anything for 159, but it says need return value in function

161 (Expected end of line)
Code:
    local integer i = 0

194 (Expected a variable name)
Code:
        set i = i + 1

and i copied all the custom script
thats just some of the 260 errors, one of each diffrent type that i got
i don't really no what those errors are talkinga bout

what happen ?
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
Ah... yes. Of course.

There's a reason why the "Initialization" trigger, even in the "Basic" category, has those Hero and Item variables... it's because they are expected to be there.


Open the save / load map, take one of the "init" triggers, rename it to something you're sure not to have in your map,
copy & paste it into your map to create all variables.
Remove the trigger...

Alternatively, create the Heroes and Items variables by hand... (copy&paste is easier. And faster)
 

JakeWC123

New Member
Reaction score
2
On my map i figured out how to make it save integers.
Actions
-------- Prepare the save array with this player's Hero --------
Set SaveCount = 0
Set SaveCount = (SaveCount + 1)
Set Save[SaveCount] = PlayerXPshow[(Player number of
(Triggering player))]
-------- 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


idk if thats helpful but i didnt put it in initlization or anything.

Then Load
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 --------
-------- Load EXP --------
Set SaveCount = 0
Set SaveCount = (SaveCount + 1)
Set PlayerXPshow[(Player number of (Triggering player))] = Save[SaveCount]


my variable was a integer - Array
 

Syndrome

You can change this now in User CP.
Reaction score
126
Can I set:
Code:
For Each Integer A from 1-100 do Actions:
Set Save [Integer A] to Ability [Integer A]
Set Save [Integer A + 100] to Level of Ability [Integer A]

And that is ALL I have to do? Nothing else?
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
> Set Save [Integer A + 100]

This would mean to save more than 100 values... which is 1. impossible, 2. would give an insanely long code.
Have a look at the example...
 
C

cliffhan61

Guest
Help Please:(

Eerm, may i ask how do you modify the trigger so that a player is only allowed to load his/her character twice? Thanks in advance.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
Add something like this to the beginning of the "load" trigger:

Set TempInteger = Player number of (Triggering player)
If LoadCount[TempInteger] greater than or equal to 2
- Game - Display to (Player goup (Triggering player)): Sorry, too many loads.
- Skip remaining actions
Set LoadCount[TempInteger] = LoadCount[TempInteger] + 1


With "LoadCount" being a variable of type "Integer", with a check in "array" and a size of 12.
 

xfirenzx

New Member
Reaction score
7
None of the custom scripts are working.

I only took Save Load Hero with Items.

Just wondering if i needed any other ones?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/

      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