Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
I just want to know how to save a hero with is stats items and every thing still intact, then load it in to the same map using a code. Like in the Legends of Dragoon open RPG map that people are playing right now. I need this for the map I'm making and don't know how to go about it.
Making a saving code is a very boring procedure. But to make one you have to know how to use substrings and some more complicated actions.
Example:
1. Give codes
Start by giving a individual code for every item, unit, ability you need to save (It can be the same code for an item and an unit.
Archmage = Y (Can be one letter if you have less number of units/items/whatsoever than the number of keys on the keybord, 27 letters and 9 numbers (Usage ¤&"%/%#¤( are just annoying according to me))
Ring of Protection + 5 = 7
Water Elemental = E
2. Unit Type
Then you can start make the code. It should look something like this:
uffff-lllll-iiiiii-aaaa
u = what hero it is, again Y = archmage so our code to get an archmage would look like this.
Yffff-lllll-iiiiii-aaaa
After the Y has been extracted (substring 1) you should assing it to a local variable, integers for unit types then. So:
set yourlocalunittype = 'Hamg'
3. Ability Levels
The following 4 'f's are the ability levels which the hero have learnt. If we assume our archmage has level 2 water elemental (His first skill (Important!) and level 3 blizzard (His seconds skill (Important!) and the rest of his abilities are level 0. Then the code would look like this:
Y2300-lllll-iiiiii-aaaa
Do you understand?
Store the values in 4 integer variables:
set yourlocalskill1 = 2
set yourlocalskill1 = 3
set yourlocalskill1 = 0
set yourlocalskill1 = 0
You may want to encrypt this data (It can be suspisous that when you type in 99999 you get level 99999 on one of your abilities!).
I would have encrypted it by using replacing each number with a letter or another number.
Our secret 0-9
0 = Q
1 = 8
2 = U
3 = L
4 = 6
5 = E
6 = I
7 = X
8 = N
9 = 3
Then use ifthenelse or something to check what number it acctualy is, our code should now look like this instead.
YULQQ-lllll-iiiiii-aaaa
Not as easy to hack eh?
After you have decrypted it use set the variables to the correct value (Up).
4. Experiance
The next 5 'l' are the experiance of the hero (assuming he don't get over 99999 experiance). Get the substring of 7,11 and store it in a local integer:
(Our hero has 2340 experiance)
set yourherosexperiance = 2340
Still understanding? Good.
I would've encrypted this data to. So with our secret number the code would looked like this now:
YULQQ-QUL6Q-iiiiii-aaaa
5. Items
The 'i's is the items the hero has in his inventory.
In our map the codes are as following:
Ring Of Protection + 5 (7)
Cloak of Shadows (4)
Mask of Death (9)
Empty Slot (8)
(This is a boring map with 10 items. If you want more you have to:
A. Have secret numbers and letters for all letters and numbers (support 27+9 = 36 items).
B. Use 2 letters for every item (supports 100 items).
C. Or a combination of both (36*36 = 1296 items (??) HOORAY!))
So, when encrypted by our simple 10-item-system the code will look like this:
YULQQ-QUL6Q-X63QQQ-aaaa
When you have decrypted it you store the data in local variables (Integers for item types):
set youritemslot1 = 'rde4'
set youritemslot2 = 'clsd'
set youritemslot3 = 'modt'
set youritemslot4 = null
set youritemslot5 = null
set youritemslot6 = null
6. Abilities
The last 4 'a's are the abilities the hero have, encrypted in the same way as items and units (Boring map with 10 abilities right now), our archmage has these abilites, in the following order (Important!)
1. Water Elemental = Number 3 = Secret Letter L
2. Blizzard = Number 7 = Secret Letter X
3. Brilliance Aura = Number 4 = Secret Number 6
4. Mass Teleport = Number 8 = Secret Letter N
Our code, when encrypted, will look like this then.
YULQQ-QUL6Q-X63QQQ-LX6N
When the have been restored, store the abilites in a local variable.
set yourability1 = 'AHwe'
set yourability1 = 'AHbz'
set yourability1 = 'AHab'
set yourability1 = 'AHmt'
7. The Code.
The final code will, when encrypted look like this:
YULQQ-QUL6Q-X63QQQ-LX6N
When decrypted it should look like this:
Y2300-02340-749000-3748
8. Extracting
Here comes the funny extracting procedure!
If you have all variable names as i typed them this will extract the hero and learn all abilites get items etc.
Code:
call CreateNUnitsAtLoc( 1, yourlocaluntype, GetTriggerPlayer, GetRectCenter(gg_rct_SpawnHeroLoc), bj_UNIT_FACING )
call SetHeroXP( GetLastCreatedUnit(), yourherosexperiance, false )
set i = 1
loop
exitwhen i > yourlocalskill1
call SelectHeroSkill( GetLastCreatedUnit(), yourability1 )
set i = i + 1
endloop
loop
exitwhen i > yourlocalskill2
call SelectHeroSkill( GetLastCreatedUnit(), yourability2 )
set i = i + 1
endloop
loop
exitwhen i > yourlocalskill3
call SelectHeroSkill( GetLastCreatedUnit(), yourability3 )
set i = i + 1
endloop
loop
exitwhen i > yourlocalskill4
call SelectHeroSkill( GetLastCreatedUnit(), yourability4 )
set i = i + 1
endloop
call UnitAddItemByIdSwapped( youritemslot1, GetLastCreatedUnit() )
call UnitAddItemByIdSwapped( youritemslot2, GetLastCreatedUnit() )
call UnitAddItemByIdSwapped( youritemslot3, GetLastCreatedUnit() )
call UnitAddItemByIdSwapped( youritemslot4, GetLastCreatedUnit() )
call UnitAddItemByIdSwapped( youritemslot5, GetLastCreatedUnit() )
call UnitAddItemByIdSwapped( youritemslot6, GetLastCreatedUnit() )
END NOTE:
I made this without using the WE except the code at the end an just thought about how I would make such a code. Hope it works, I wasted a half hour of my life typing it.
Theres an easier way.
Download and install WE Unlimited
Add " use advanced triggers " to your map which needs the saving and loading heroes with a code.
Open it up with WE Unlimited and go to triggers.
You should now be able to use the " WE Unlimited " trigger add-on: Saving Heroes and loading with a code. Its much easier.
Its in " Advanced > "
Should be at the bottom, remember to use WEU to tick " use advanced triggers " and then open the map with WE unlimited so the extra trigger add-ons work.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.