• 🏆 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!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

CodeGen 1.0.2

Introduction

Sometimes you need to transfer data between games in order to keep the progress you've made. For example in RPG maps you probably want to save your hero, levels, gold and items so you can continue next time you play. The way this is done in Warcraft III by generating codes that contain all of your data, which can later be re-entered to restore that saved information. This is nothing new in the modding world however it's commonly asked about and requested yet many people still have issues. This is part of the reason why I decided to create an easy to use, universal, GUI-friendly save and load system which I'm calling the Code Generator.

Main Features
  1. Player-name sensitive (optional).
  2. Highly configurable.
  3. Can be used in the normal World Editor (doesn't require JNGP).
  4. Very easy to use.


  • -------- -------------------- --------
  • -------- The below options are for saving load codes to the Warcraft III folder. --------
  • -------- You can modify the file name via the SaveLoad_Filename variable within the save trigger. --------
    • -------- -------------------- --------
    • Set SaveLoad_SaveToDisk = True
    • Set SaveLoad_Directory = Save
    • -------- -------------------- --------
    • -------- Some configurables --------
    • -------- -------------------- --------
    • Set SaveLoad_Alphabet = abcdefghkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789
    • Set SaveLoad_CheckName = True
    • Set SaveLoad_Security = True
    • Set SaveLoad_HyphenSpace = 4
    • Set SaveLoad_SeperationChar = -
    • Set SaveLoad_Lower = |c002a4580
    • Set SaveLoad_Number = |cffffcc00
    • Set SaveLoad_Upper = |cff008000
    • -------- -------------------- --------
    • -------- Increase the value if you want to save bigger numbers --------
    • -------- Decrease it if you want to generate a smaller save code but only be able to save smaller values --------
    • -------- It's suggested to not increase it above 7 --------
    • -------- -------------------- --------
    • Set SaveLoad_MaxValue = 6
    • -------- -------------------- --------
    • -------- Store all the heroes you want to be able to be saved below. --------
    • -------- -------------------- --------
    • Set SaveLoad_Hero[0] = Blood Mage
    • Set SaveLoad_Hero[1] = Lich
    • Set SaveLoad_Hero[2] = Blademaster
    • Set SaveLoad_Hero[3] = Demon Hunter
    • Set SaveLoad_HeroCount = 3
    • -------- -------------------- --------
    • -------- Store all the abilities you want to be able to be saved below. --------
    • -------- -------------------- --------
    • Set SaveLoad_Abilities[0] = Flame Strike
    • Set SaveLoad_Abilities[1] = Siphon Mana
    • Set SaveLoad_Abilities[2] = Phoenix
    • Set SaveLoad_Abilities[3] = Banish
    • Set SaveLoad_AbilityCount = 3
    • -------- -------------------- --------
    • -------- Store all the items you want to be able to be saved below. --------
    • -------- -------------------- --------
    • Set SaveLoad_Item[0] = (Item-type of No item)
    • Set SaveLoad_Item[1] = Claws of Attack +15
    • Set SaveLoad_Item[2] = Crown of Kings +5
    • Set SaveLoad_Item[3] = Kelen's Dagger of Escape
    • Set SaveLoad_Item[4] = Mask of Death
    • Set SaveLoad_Item[5] = Orb of Frost
    • Set SaveLoad_Item[6] = Ring of Protection +5
    • Set SaveLoad_ItemCount = 6
    • -------- -------------------- --------
    • -------- Don't modify below this line. --------
    • -------- This is just here to copy variables to your map --------
    • -------- -------------------- --------
    • Set SaveLoad_Full = SaveLoad_Alphabet
    • Set SaveLoad_Error = <Empty String>
    • Set SaveLoad_Base = (Length of SaveLoad_Alphabet)
    • Set SaveLoad_Char[0] = <Empty String>
    • Set Load[0] = 0
    • Set LoadCount = 0
    • Custom script: call CodeGen_Init()
Installation
  1. Make sure your settings allow copying variables (Image)
  2. Copy the CodeGen folder over to your map.
  3. Paste the maps script into yours (Image)

How do I use it?

Let's take a look at the most basic example.

  • Set Save[0] = (Player 1 (Red) Current gold)
  • Custom script: set udg_Code = CodeGen_Compile()
  • Game - Display to (Player group((Triggering player))) for 60.00 seconds the text: Code

The above will save Players 1's gold. Simple, isn't it? Now you're probably asking "How do I load it?".

  • -------- Check if load is valid --------
  • Set Code = (Substring((Entered chat string), 7, 999))
  • Custom script: call CodeGen_Load(udg_Code)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • SaveLoad_Valid Equal to False
    • Then - Actions
      • Game - Display to (Player group((Triggering player))) for 10.00 seconds the text: SaveLoad_Error
      • Skip remaining actions
    • Else - Actions
  • Player - Set Player 1 (Red) Current gold to Load[0]

Equally as simple and there are more examples are available in the demo map.

Keywords:
save,load,save load,save and load,code,codegen,code gen,triggerhappy,password,gen,generator,generate,preloadgen,preload,file,io,to,disk
Contents

CodeGen v1.0.2 (Map)

Reviews
8 March 2014 PurgeandFire: Approved. Review: http://www.hiveworkshop.com/forums/2496968-post145.html 21 December 2013 Bribe: changed status to needs fix. 8 Sep 2011 Bribe: Deprecated in favor of: Save/Load with Snippets 21:27, 29th Aug...

Moderator

M

Moderator

8 March 2014
PurgeandFire: Approved.

Review:
http://www.hiveworkshop.com/forums/2496968-post145.html

21 December 2013
Bribe: changed status to needs fix.

8 Sep 2011
Bribe: Deprecated in favor of: Save/Load with Snippets

21:27, 29th Aug 2010
The_Reborn_Devil:

The coding looks ok and the system is working. Also easy to use.


Status: Approved
Rating: Useful
 
Level 11
Joined
Sep 12, 2008
Messages
657
I find this alot easier then the one made by hanky, since hanky's one is for more advanced players.. or atlesat for people with experience with save/load systems.
since it requires to use alot of stuff. size, SaveSomething(), etc..
 
Level 6
Joined
Oct 10, 2009
Messages
1,425
This system works.
However, this is nothing new and the iGen by Hanky is a lot better.

Also it broke the rules

It didn't brake the rules because Hanky's is vJass, which is a no-go for me, as I cannot use vJass.
So this system is indeed helpful to people like me.

TriggerHappy said:
"Resources should be unique." There's a difference between being repetitive and offering variety.
 
It didn't brake the rules because Hanky's is vJass, which is a no-go for me, as I cannot use vJass.
Huh what, why? Also there are a lot of other JASS/GUI Save/Load-Code systems, they are just not uploaded here because they were rejected because other systems (such as Hankys) have proven to be better, which is why I can't see this should be approved.

This system for example is in GUI too and has been proven to be a great system you can count on. This one is also good on my first quick look.

If you still wanna use another system, you should try this one on wc3c.net. Seriously, I think we have enough of these.

Edit: Or use this one.
 
uh yeah bullseye
aawww yeaha again now this is the best GUI/JASS Save/Load system here....
THE KEYWORD IS HERE
Others got rejected here because they were not so good as Hankys, this isn't either and is approved. I don't see the logic in here.

And we don't need 1000 systems on each place. If every community has a good one, that's enough. You can still use the other systems from other communities.
 
Level 5
Joined
May 14, 2007
Messages
188
Others got rejected here because they were not so good as Hankys, this isn't either and is approved. I don't see the logic in here.

And we don't need 1000 systems on each place. If every community has a good one, that's enough. You can still use the other systems from other communities.

oh my god...
anachron please... stop complaining about Cweener's work.
If you like it you use it.
If you dont like it then you dont use it, and you shut the FUCK up. Please... getting posts on your account wont get you a life :/
 
Level 9
Joined
Jun 20, 2008
Messages
476
I used this system in my not uploaded map and i like it i Made a thread about where is whas becouse i wanted to look for a new version(if there whas one) And i couldn't find it.
Anachron it is always good to have some variation in systems then people can choose what system they want and i prefer this one :p.
 
Level 9
Joined
Jun 25, 2009
Messages
427
I used this system in my not uploaded map and i like it i Made a thread about where is whas becouse i wanted to look for a new version(if there whas one) And i couldn't find it.
Anachron it is always good to have some variation in systems then people can choose what system they want and i prefer this one :p.

In your face Anachron! (no offence)
And yes, i will choose this over the other systems that are not even in this website. (Cause this one is very GUI friendly :p)

EPIC :D
 
@Anachron

The system is obviously useful for a certain type of users, and it's a fairly different system from Hanky's. Each have their own strong points and users will pick which they feel works best for them. Stop complaining and trying to start an argument. Oh, and there's a difference between being repetitive and offering variety, so this system complies with all of the site rules.

I won't be replying to anymore of your posts here Anachron, quit spamming my thread.
 
Level 14
Joined
Dec 29, 2009
Messages
931
Wow, I remember CodeGen 0.05! :grin:

It worked fine on my ORPG until recently, was it deactivated or something? (How that would affect me, if even possible, makes no sense at all).

Nevertheless, this system is useful and I'm glad it's approved. :smile:

Keep up the good work TriggerHappy, however I do have one question. When you say, it saves the player's name, you mean that when I save my hero with the name Vital_Sin, and I try to load the hero with the name Arkon_Kaos, it won't work. Right?

I tested the map, and tried to figure that out, but I couldn't tell if I was typing the code wrong or if it saved to the player name, as the code would dissapear faster than I can type it three times. :thumbs_up:

Excellent system, and Thanks,
-Arkon Kaos (A.K.A. Vital_Sin)
 
well to make it ORIGINAL... add in to your code abilities. This can be done the same way as you do items.

A good save/load system contains:
EXP (x)
Items (x)
Gold (x)
Lumber (x)
Abilities (n/a)
Extra Optional Integers (n/a)

Although your system could easily have added the optional integers some people don't quite have the experience in triggers to do so themselves.

But other than that I like how short the code is so you deserve a 4/5 because of how tedious making one of these systems can be, but until there are abilities it wont be a 5/5
 
Level 3
Joined
Jan 20, 2009
Messages
24
Hey first off i want to say thank you alot for this. It works 100%. I just have a request if you do not mind. Is there any way to make the save/load CODE the player uses have a SET length. IE: Make the code LENGTH always 16? Thanks. I give your trigger system a 4/5 for it could use some more features and its not 100% pefect but its usable i use it and i like it personally. Thanks.
 
Level 14
Joined
Dec 29, 2009
Messages
931
You can only hold so much data in every character... For really big games that save EVERYTHING... 16 might not be enough... You might want to take that into consideration and look at what all you're saving.

Also, try posting this in the Requests section. :grin:
 
Last edited:
Level 6
Joined
Feb 18, 2010
Messages
153
seems awesome and looks easy to edit for my map but when i copy and paste CodeGen into my map and try the map it wont let me play the map

dont show up and slots

and when i click start it goes back to create a game

any help ideas?
 
Level 8
Joined
Apr 8, 2009
Messages
499
This System works fine and all, very GUI-user friendly (unlike iGen -sigh-)
But there are stil a few things i can't get working.... like saving the amount of charges an item has. a lot of Save/Load systems neglect putting it in the standard triggers =\

At the moment i'm stil trying to fix that but i can't seem to find out what the problem is. if anyone can help me?
 
This System works fine and all, very GUI-user friendly (unlike iGen -sigh-)
But there are stil a few things i can't get working.... like saving the amount of charges an item has. a lot of Save/Load systems neglect putting it in the standard triggers =\

At the moment i'm stil trying to fix that but i can't seem to find out what the problem is. if anyone can help me?

its not that they forget, its just that they don't really need to... since the things that needs to be saved/loaded should be configured by the user of this system... those save-load triggers are just for examples on how to use the code generator...
 
Level 8
Joined
Apr 8, 2009
Messages
499
save the charge integer value into the code and when you load, you set the charges of the item to the integer

  • 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
      • Player - Player 5 (Yellow) types a chat message containing -save as An exact match
      • Player - Player 6 (Orange) types a chat message containing -save as An exact match
      • Player - Player 7 (Green) types a chat message containing -save as An exact match
      • Player - Player 8 (Pink) types a chat message containing -save as An exact match
    • Conditions
    • Actions
      • -------- Find the players hero, and save it. I realize it leaks but it's just for demonstration. --------
      • Set SaveCount = 0
      • Unit Group - Pick every unit in (Units owned by (Triggering player) matching ((Matching unit) Equal to Player_Hero_Array[(Player number of (Triggering player))])) and do (Set Hero = (Picked unit))
      • Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertUnit(GetUnitTypeId(udg_Hero))
      • Set SaveCount = (SaveCount + 1)
      • -------- Save players gold. --------
      • Set Save[SaveCount] = ((Triggering player) Current gold)
      • Set SaveCount = (SaveCount + 1)
      • -------- Save players lumber. --------
      • Set Save[SaveCount] = ((Triggering player) Current lumber)
      • Set SaveCount = (SaveCount + 1)
      • -------- Save heroes EXP. --------
      • Set Save[SaveCount] = (Hero experience of Hero)
      • Set SaveCount = (SaveCount + 1)
      • -------- Save heroes items. --------
      • Set Save[SaveCount] = (Number of items carried by Hero)
      • For each (Integer Integer_A_Replacement) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by Hero in slot Integer_A_Replacement)) Not equal to (Item-type of No item)
            • Then - Actions
              • Set SaveCount = (SaveCount + 1)
              • Set Item = (Item carried by Hero in slot Integer_A_Replacement)
              • Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertItem(GetItemTypeId(udg_Item))
              • Set SaveCount = (SaveCount + 1)
              • Set Save[SaveCount] = (Charges remaining in (Item carried by Hero in slot Integer_A_Replacement))
            • Else - Actions
      • -------- Show Code --------
      • Custom script: set udg_Code = CodeGen_Compile()
      • Game - Display to (Player group((Triggering player))) for 60.00 seconds the text: 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
      • Player - Player 6 (Orange) types a chat message containing -load as A substring
      • Player - Player 7 (Green) types a chat message containing -load as A substring
      • Player - Player 8 (Pink) types a chat message containing -load as A substring
    • Conditions
      • (Substring((Entered chat string), 1, 6)) Equal to -load
    • Actions
      • -------- Check if load is valid --------
      • Set Code = (Substring((Entered chat string), 7, 999))
      • Custom script: call CodeGen_Load(udg_Code)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SaveLoad_Valid Equal to False
        • Then - Actions
          • Game - Display to (Player group((Triggering player))) for 10.00 seconds the text: Invalid code.
          • Skip remaining actions
        • Else - Actions
      • -------- Start loading, load the hero first. --------
      • Set LoadCount = 0
      • Unit Group - Pick every unit in (Units owned by (Triggering player)) and do (Unit - Remove (Picked unit) from the game)
      • Unit - Create 1 SaveLoad_Hero[Load[LoadCount]] for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
      • Set Hero = (Last created unit)
      • Selection - Select (Last created unit) for (Triggering player)
      • -------- Now load players gold --------
      • Set LoadCount = (LoadCount + 1)
      • Player - Set (Triggering player) Current gold to Load[LoadCount]
      • -------- Now load players Lumber --------
      • Set LoadCount = (LoadCount + 1)
      • Player - Set (Triggering player) Current lumber to Load[LoadCount]
      • -------- Load heroes EXP --------
      • Set LoadCount = (LoadCount + 1)
      • Hero - Set Hero experience to Load[LoadCount], Hide level-up graphics
      • -------- Now items --------
      • Set LoadCount = (LoadCount + 1)
      • For each (Integer Integer_A_Replacement) from 0 to Load[LoadCount], do (Actions)
        • Loop - Actions
          • Set LoadCount = (LoadCount + 1)
          • Hero - Create SaveLoad_Item[Load[LoadCount]] and give it to Hero
          • Set LoadCount = (LoadCount + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Load[LoadCount] Greater than 0
            • Then - Actions
              • Item - Set charges remaining in (Last created item) to Load[LoadCount]
            • Else - Actions
-When you have 6 different potions with different amounts of charges, it saves/loads perfectly.
-when you have 5 different potions with different amounts of charges and + 1 non-chargable item (its in the 6th slot). only the 5 potions will be saved/loaded
-when you move the non-chargable item to lets say.. the 3rd slot, everything after the 3rd slot wont get saved/loaded.


so yes, i did what you said a long time ago lolz, its just not working.
 
Level 12
Joined
Nov 20, 2007
Messages
660
dude i got a problem
call me a noob, call me an idiot but i don't care just help me
i copy and paste the triggers in my map and when i try to save i get an error
what do i have to do to import the triggers successfully?
i would appreciate any help asap ty ;p

did you read:
How to Install
Copy the maps header into your maps (click the CodeGen 0.06.w3x in the trigger editor).
Copy the CodeGen folder into your map.
Make sure "Automatically create unknown variables when pasting trigger data" is checked in your editors preference.
 
Level 22
Joined
Nov 14, 2008
Messages
3,256
ani666 your problem is that when you put the non charge able item in the 3rd slot it still increases the save count even if the item doesnt have charges and it sets charges still. Hard to judge this on a phone i take a closer look back home but the key to use this system is to save all stuff in the way you load them. So with pots it works as the order is correct, with other items the order fucks up. This might not be the problem but i think it is.
 
Level 20
Joined
Jul 12, 2010
Messages
1,720
did you read:
How to Install
Copy the maps header into your maps (click the CodeGen 0.06.w3x in the trigger editor).
Copy the CodeGen folder into your map.
Make sure "Automatically create unknown variables when pasting trigger data" is checked in your editors preference.

Woops lol
kinda missed the "Copy the maps header into your maps" xD
anyway thnx dude for helping :D
now the system works fine :thumbs_up:
 
hey dude i noticed something
i saved my hero with a pot of healing that had 12 charges and when i loaded it only had 1
can you pls make it able to also save charges of items?

you should be the one to save it... anything that has to be saved should be done by the user of the system...
 
Level 8
Joined
Apr 8, 2009
Messages
499
hey dude i noticed something
i saved my hero with a pot of healing that had 12 charges and when i loaded it only had 1
can you pls make it able to also save charges of items?

Here is where i did all that save/load crap for the items and their charges. you'll have to put in conditions for every charged item you have though.
 
Top