• 🏆 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 Code

Status
Not open for further replies.
Level 16
Joined
Mar 3, 2006
Messages
1,564
But how i can save it to variables with code??? Give me an example please.
That is something from Blizzard Campaigns
  • Next Level Prep
    • Events
    • Conditions
    • Actions
      • -------- Save hero data --------
      • Game Cache - Create a game cache from Campaigns.w3v
      • If ((Arthas has Ledger) Equal to True) then do (Item - Remove Ledger) else do (Do nothing)
      • Game Cache - Store Arthas as Arthas of Human02 in (Last created game cache)
      • Game Cache - Save (Last created game cache)
      • -------- Enable next level --------
      • Game - Enable Human 02
You could download one of the MPQ extractors in this site and extract Blizzard Maps and see how they work. When you see it for yourself is better than one to tell you how.
 
Level 8
Joined
Mar 12, 2008
Messages
437
That is something from Blizzard Campaigns
  • Next Level Prep
    • Events
    • Conditions
    • Actions
      • -------- Save hero data --------
      • Game Cache - Create a game cache from Campaigns.w3v
      • If ((Arthas has Ledger) Equal to True) then do (Item - Remove Ledger) else do (Do nothing)
      • Game Cache - Store Arthas as Arthas of Human02 in (Last created game cache)
      • Game Cache - Save (Last created game cache)
      • -------- Enable next level --------
      • Game - Enable Human 02

You could download one of the MPQ extractors in this site and extract Blizzard Maps and see how they work. When you see it for yourself is better than one to tell you how.

That won't work in multiplayer though, would it?
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
That is something from Blizzard Campaigns
...

Are you blind? He obviously wants this for Battle.net.

But how i can save it to variables with code??? Give me an example please.

You just encode whatever data you want.
Say you want to "save" gold, lumber, current food and the maximum food of a player, the most simple way would be to change them all to strings and put them one after another, so say a player has:
Gold: 10000
Wood: 300
Food: 40
Max Food: 80

You have two basic ways to put it, it can be something like this
0100000003004080

This will give you to save up to 999999 of each resource and up to 99 of food, but it will take a longer string then needed if you don't actually have the full cap.

The other easy way would be something like this (using the same states):
g10000w300f40m80

This way you can save less data if you do not have the maximum cap on everything, but if you do have the maximum - your string is longer then needed.

So, that's how you "save" (encode) data. Of course this is probably the worst encoding seen, ever, so you'd need to find better ways.

A fast improvement would be to change everything to Hexadecimel base (or a bigger base if you can make one :)).

g2710w12cf28m50

It will also make the code a little less obvious to the users, and you want to do that in order for them to not abuse it.
 
Level 8
Joined
Mar 12, 2008
Messages
437
Are you blind? He obviously wants this for Battle.net.



You just encode whatever data you want.
Say you want to "save" gold, lumber, current food and the maximum food of a player, the most simple way would be to change them all to strings and put them one after another, so say a player has:
Gold: 10000
Wood: 300
Food: 40
Max Food: 80

You have two basic ways to put it, it can be something like this
0100000003004080

This will give you to save up to 999999 of each resource and up to 99 of food, but it will take a longer string then needed if you don't actually have the full cap.

The other easy way would be something like this (using the same states):
g10000w300f40m80

This way you can save less data if you do not have the maximum cap on everything, but if you do have the maximum - your string is longer then needed.

So, that's how you "save" (encode) data. Of course this is probably the worst encoding seen, ever, so you'd need to find better ways.

A fast improvement would be to change everything to Hexadecimel base (or a bigger base if you can make one :)).

g2710w12cf28m50

It will also make the code a little less obvious to the users, and you want to do that in order for them to not abuse it.

Nice, just some questions:
1. Can the game convert decimal to hexadecimal, or does one have to do it manually?
2. Is there any easy way to separate the g, w, f and m values from each other?
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Nice, just some questions:
1. Can the game convert decimal to hexadecimal, or does one have to do it manually?
2. Is there any easy way to separate the g, w, f and m values from each other?

1. You need to do it by yourself.

2. The nice thing in encoding is that you can do it any way you want. As long as you can get back the data correctly, it can look however you want it to look.

Of course you do need to think about the poor users. They probably don't want a long code to start copying, so try to shrink the size as much as you can, while maintaining its 'secrecy', since those 'poor' users won't be so poor if they know what every section of the code does.
 
Level 2
Joined
Jul 4, 2009
Messages
10
Nothing will stop a player with mapping knowledge from opening your map in mpq editors to read how the save/load works, obfuscation won't help much too, just try to keep the save code short and the sections less obvious(swap digis, use hex etc) for normal players. And encoding player name into save load is a welcome addition too, assuming nicks are unique in the same realm on battle.net
 
Level 7
Joined
Feb 22, 2009
Messages
158
Emm... Next question how do you post trigger-based posts like that?
Next Level Prep
join.gif
events.gif
Events
join.gif
cond.gif
Conditions
joinbottomminus.gif
actions.gif
Actions
empty.gif
join.gif
comment.gif
-------- Save hero data --------
empty.gif
join.gif
set.gif
Game Cache - Create a game cache from Campaigns.w3v
empty.gif
join.gif
if.gif
If ((Arthas has Ledger) Equal to True) then do (Item - Remove Ledger) else do (Do nothing)
empty.gif
join.gif
set.gif
Game Cache - Store Arthas as Arthas of Human02 in (Last created game cache)
empty.gif
join.gif
set.gif
Game Cache - Save (Last created game cache)
empty.gif
join.gif
comment.gif
-------- Enable next level --------
empty.gif
joinbottom.gif
game.gif
Game - Enable Human 02
 
Level 4
Joined
Jun 9, 2008
Messages
86
clik copy to tekst and post it here with the:
[TRIG*GER] yourtekst [/TRIGGER]

the * you have to remove, it was just so you could see the code
 
Status
Not open for further replies.
Top