Save/Load Code, Yet Another

Reflexar

New Member
Reaction score
12
How can I make so that the system doesn't save items which are NOT added to the list of items ( I mean the array )

Since I want some items to not be saved....


Please Help me! Kind regards!
 

polo2005

Wana start playing LoL? http://tinyurl.com/369as27
Reaction score
97
edit 2:

what if i want a save/laod that saves both abilties and lvl of them for more than 1 hero? would it work to move over the ability part to the ALL trigger?
 

Dasslokk

New Member
Reaction score
9
I don't have any knowledge of this, but I was just wondering how you could get it to save the abilities as learned and not just the hero level. At least that wha happends when I load a saved code.
 

SerraAvenger

Cuz I can
Reaction score
234
Oh Master...
I today was thinking of how to do a save load code and came up with the same "compress all" thing, then I just saw you already do it the same way : )

<3 that's so fine, 8-12 hours less to code for me ^^ (assuming you're twice as fast as I am)

Although you might not even read this post, just thought I'ld say this.
EDIT: I tested this a little bit and I had to see it is not exactly what I wanted. I thus coded my own system that doesn't use encryption/decryption, really compresses all info into one integer (perhaps one day I'll be using longinteger for that :D).
For security, I use hashing (players enter passwords that act as a key, and if they forget the password they're able to reload it if they're playing with the name they last saved). That way, I'm much faster (and I guess shorter) than this, but I can't save as much info. I'll thus also implement a hash that maps big values (namely rawids) into a small array, and saves the array indicies instead.
It is a little more complicated to use though, as the coder first needs to be initialized (only once, telling it which fields to use and how big they are) and then it can be used.

Current information hold:
the product of all field sizes must be <= 2³¹
With longintegers:
the product of all field sizes must be <= 10³⁶
 

Vylatin

New Member
Reaction score
32
How many characters would it be if you want to save...

Hero Type
Hero Level
Items
Gold/lumber

?

Too many characters is only pain. Please reply
 

Tooblet

Active Member
Reaction score
6
I know Acehart has left us all alone here at thehelper :p
But maybe there is someone else who might help me with a slight modification.

I need this system to be able to get over 250 items in the item integer array.

I find that the current maximum is 145 items. It must be some way to make that maximum limit higher, right?

I know a bit of jass and vjass if that helps.
 

ianu74

New Member
Reaction score
8
I copied the code yet i get errors like this.
Code:
Line 94:Expected a name
    set udg_Save[udg_SaveCount] = SaveLoad_Unit2Integer( udg_TempUnit )
I ticked the create unknown variables while passing triggers box.
 

gwcadu942

New Member
Reaction score
0
Very tks

yes, there's already plenty of them around.

But, well, they didn't really work as i needed it.
And, they didn't really work as i needed it.
Not to mention that they didn't really work as i needed it.


So, here's my own.

Any and all comments and feedback welcome.
(other than "can you please stop making maps? Thank you.")


my actual question was: What do i want this to be able to do?
And i wanted something that can be used to save just about anything, be it heroes, items, health, number of kills, your grand-ma's shoe-size (rounded down), ...

And, hey, i wrote it myself! Which also counts for something.
For example, it clearly says that i have too much free time currently.


Let's say you want to save a hero and the player's gold:
Set save[1] = player 1's current gold
set save[2] = hero[ player number of player 1 ]
set savecount = 2
...

Simple?
Yes.

Now, we want to add the hero's level:
Set save[1] = player 1's current gold
set save[2] = hero[ player number of player 1 ]
set save[3] = level of (hero[ player number of player 1 ])
set savecount = 3
...

Yes, that's it already.

Adding lumber too?
Set save[1] = player 1's current gold
set save[2] = player 1's current lumber
set save[3] = hero[ player number of player 1 ]
set save[4] = level of (hero[ player number of player 1 ])
set savecount = 4
...

Need to add something else?
Well, then do it.



Have fun,
try it all,
run your own system,
find bugs (bugs? What bugs?).


Yours,
acehart



yet another save / load code :p


this is much less a tutorial than a "how do i use it?" guide.


I'm not going to bore you with 500+ lines of gui code triggers.

Why not?
You won't get it anyway...
More seriously though, simply because no one's going to read it all.

And, actually, only the "save" and "load" parts are in gui, for easier reading.
The actual coding / decoding is in jass.


what's it doing?

you want a save / load code in your map?
Well, take this map, copy the needed parts over to yours, done.

All in all, it takes a bunch of numbers, converts them into a code.
When you type that code back in, the numbers will be reconstructed.
That's it.

I'm kidding, right?
Well, no.

That is really all this map is doing.
It takes a bunch of numbers, turns them into a code that can be typed back to reconstruct those numbers.


inner workings:

1: Take all numbers and make a huge string from that
2: Pretend that's a number in base 11
3: Convert to base 36

unless you really insist, that's all the details i'm going to post here.

Feel free to ask whatever you don't get.


importing to your map:

i've provided three different "a player types '-save' / '-load <code>'" versions.
Have a look, take the one you like, and copy & paste the category you like into your map.

Open the custom script section (at the top of the trigger list is your map's name, click there):
Copy & paste anything in there to your map.

Done.


the real deal:

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] = 123
        set save[2] = 456
        set save[3] = 7890
        -------- the number of values we have --------
        set savecount = 3
        -------- 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

> player - player 1 (red) types a chat message containing -save as an exact match

the most basic use.
A player types "-save".

> set save[1] = 123
> set save[2] = 456
> set save[3] = 7890

some numbers (123, 456 and 7890) are put into the "save" array.

> set savecount = 3

we set "savecount" to how many numbers we have, 3 with this example.

> custom script: Set udg_code = saveload_encode()

this calls the code generator.
It will take the three (as set in "savecount") values in the "save" array.
And return the save code in some global variable called "code".

> 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

show the code to the player.


Looks simple?
I hope so.

Now, those three numbers probably don't make much sense, but, that's also not the point.
The point was more to have something to look at, to see how it works.

You may wonder how to get a hero into that "save" array.
Valid question.

Unfortunately, you can't just write:
Set save[1] = unit-type of ("paladin").

Which is why i provided a custom jass function to do so.

In the example trigger "saveload save hero", there's this line:
> set tempunit = (picked unit) ("picked unit"? Well, it's inside a "pick every unit" loop, that's why.)
> custom script: Set udg_save[udg_savecount] = saveload_unit2integer( udg_tempunit )

as you may see, in gui, if this were possible, this would say:
Set save[savecount] = unit-type of (tempunit)

you have your heroes in some unit array called "heroes"? Indexed by player number?
No problem, use
> set tempunit = heroes[ player number of (triggering player) ]
> custom script: Set udg_save[udg_savecount] = saveload_unit2integer( udg_tempunit )

again, in gui, if this were possible, would read:
Set save[savecount] = unit-type of (heroes[player number of (triggering player)])

should be simple enough, even for people that never used any jass before.


There's also the equivalent for items:
> set tempitem = (item carried by (picked unit) in slot (integer a))
> custom script: Set udg_save[udg_savecount] = saveload_item2integer( udg_tempitem )


now, since it uses jass to turn unit or item types into numbers, there's also something to do it the other way around?
Yes, there is:
> custom script: Set udg_tempunittype = saveload_integer2unit(udg_save[udg_savecount])
> unit - create 1 tempunittype for (triggering player) at ((triggering player) start location) facing default building facing degrees
and
> custom script: Set udg_tempitemtype = saveload_integer2item(udg_save[udg_savecount])
> hero - create tempitemtype and give it to (last created unit)

those are used when loading a code.


As a complete example on how to load a hero:
Code:
saveload load hero
    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 false
            then - actions
                -------- invalid code --------
                game - display to (player group((triggering player))) the text: There's some error in this code, sorry.
                Skip remaining actions
            else - actions
        -------- it worked, let's do something with it --------
        set savecount = 1
        custom script:   Set udg_tempunittype = saveload_integer2unit(udg_save[udg_savecount])
        unit - create 1 tempunittype for (triggering player) at ((triggering player) start location) facing default building facing degrees
        set savecount = (savecount + 1)
        hero - set (last created unit) hero-level to save[savecount], hide level-up graphics
        set savecount = (savecount + 1)
        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]

in more details:

> 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

we wait for some player to type "-load <code>".

> (substring((entered chat string), 1, 6)) equal to (matched chat string)
> (length of (entered chat string)) greater than 6

if the message he typed didn't start with "-load " or if it did but there was no code, this trigger won't run.

> set code = (substring((entered chat string), 7, (length of (entered chat string))))

take the part that comes after "-load ", i.e. The actual code.

> custom script: Set udg_validate = saveload_decode( udg_code )

call the decoding function.
This function will refill the "save" array with all numbers that were saved with in that code.
It will set "savecount" to how many numbers it did find.
And, finally, it will return either "true" or "false", a result we catch in some variable called "validate" (of type "boolean").

> if (all conditions are true) then do (then actions) else do (else actions)
> - validate equal to false

if "validate" is false, as opposed to true, there's some problem with the code.
Missing characters, swapped characters, wrong player... Some problem.

> game - display to (player group((triggering player))) the text: There's some error in this code, sorry.
> skip remaining actions

so, yes, didn't work. Tell the player and skip the rest of the trigger.

> set savecount = 1
> custom script: Set udg_tempunittype = saveload_integer2unit(udg_save[udg_savecount])

the first thing we put into the "save" array was the hero.
We also take the hero out of it first.

> unit - create 1 tempunittype for (triggering player) at ((triggering player) start location) facing default building facing degrees

create the hero.

> set savecount = (savecount + 1)
> hero - set (last created unit) hero-level to save[savecount], hide level-up graphics

set his level to whatever level he had when saved.

> set savecount = (savecount + 1)
> for each (integer a) from 1 to save[savecount], do (actions)

the code had a counter for how many items the hero carried, this line will recreate an equal amount.

> - set savecount = (savecount + 1)
> - custom script: Set udg_tempitemtype = saveload_integer2item(udg_save[udg_savecount])

read the next value, and convert it to an item-type.

> - hero - create tempitemtype and give it to (last created unit)

create the item for the hero.

> - set savecount = (savecount + 1)
> - item - set charges remaining in (last created item) to save[savecount]

set the charges to those saved.


There's also a save / load version called "saveload all".
Which saves several heroes, complete with items and charges, experience, position and the player's gold.

Feel free to change to whatever you need in your map.


more on heroes and items and general initialization:

have a look at "saveload_initialization".
See those hero and item arrays?
Well, if you're going to use this to save heroes and items, or just one of those,
i strongly recommend putting them all in those arrays.

The code will still work for heroes or items that aren't in the array, it will even (try to) compress it a bit,
but, still, if the hero, or the item, isn't found in the array, the code will be longer.
With six items on your hero, it's several characters difference already.


Other stuff of interest are the following three lines:
> set saveload_alphabet = abcdefghijklmnopqrstuvwxyz0123456789

the code you get will consist of upper case letters and digits.
You can change this if you want.
You could, for example, only use "abc123", and the code would only use those.

However, the less characters, the longer the code.

So, i can just add abc...z too to have more characters and i will get a shorter code?
Yes, but, that's where the next line comes into play:
> set saveload_casesensitive = false

if your code uses both upper and lower case characters, this must be set to true.

By default, if you get "abcd-1234" as code, and type "abcd-1234", it will work.
But, if the code is case sensitive, you must type it back exactly as you got it.

I wouldn't recommend changing this, but, well, your map, your choice.

> set saveload_useplayername = true

the code includes a simple check for the player that got it, and compares it, later on, when you type it back.
If you set this to false, the code won't care for the player.


questions that are usually asked for save / load codes:

q: I used this to save three heroes, complete with items, charges, position, experience, strength, agility, intelligence, my gold and lumber and my current top "kills" and "deaths" scores...
A: Impressive. Though, while this works just fine, the code length will be out of league...

Q: I forgot to put my hero into the "saveload_heroes" array, but the code still worked.
A: Yes.

Q: I didn't add my hero to the hero array, got a working code, but it was very long.
A1: Put heroes and items into the provided "hero" and "item" arrays, as seen in "saveload_initialization".
A2: That's the very reason to have those arrays.

Q: If i put a second hero on your demo map, and enable the triggers in the "all" category, it will give me a code for both heroes at once?
A: Yes.

Q: Why is the "initialization" trigger repeated three times?
A: Because, usually, you just copy & paste the category you need, not all of them. Keeps it simpler to import to your map.

Q: How many "digits" does it use to save a hero (just the hero, no level, attributes, items, ...)?
A: Best case: Less than one.

Q: How many "digits" does it use worst case to save a hero?
A: More than one.

Q: Can it save strength / agility / intelligence?
A: Yes.

Q: Can it save both gold and lumber?
A: Yes.

Q: How much gold can i save?
A: All you can carry.

Q: Can it save lumber only?
A: Yes.

Q: Leaks!
A: Stfu.

Q: This must use heavy encryption, right?
A: Security through obscurity never works.

Q: What digit, in the final code, holds the hero's level if i put it in save[3]?
A: No idea.

Q: My heroes can go up to level 666, will this still work?
A: Yes.

Q: So, if i want to save some other thing, like the number of units owned by neutral hostile killed so far with that hero, i can simply add another number to the save array, and it will turn that too into a code?
A: Yes.

Q: I'm l33t!
A: Cool...

Q: Why is that thing in jass?
A: Doing heavy math in gui is a pain.

Q: Why isn't everything in jass then?
A: ...



Anything i forgot here?
Something not very clear yet?

Let's hear it.


See the link below for the demo map:


very tks

+reppppppppppppppppppppppppppppppppppppppp

i loves you!!!!!
 

gwcadu942

New Member
Reaction score
0
help me plzzzz

my is error


SaveLoad Load All
set udg_Validate = SaveLoad_Decode( udg_Code )
set udg_TempUnitType = SaveLoad_Integer2Unit(udg_Save[udg_SaveCount])
set udg_TempItemType = SaveLoad_Integer2Item(udg_Save[udg_SaveCount])


SaveLoad Save All
set udg_Save[udg_SaveCount] = SaveLoad_Unit2Integer( udg_TempUnit )
set udg_Save[udg_SaveCount] = SaveLoad_Item2Integer( udg_TempItem )
set udg_Code = SaveLoad_Encode()
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Did you put the system core from the demo map into the map header of yours?
 

_TriNiTY_

New Member
Reaction score
0
thx for the save/load code..
anyway, i tried to save with a nickname Worldedit, then i load the code with a nickname AAA, then, the decoding is successful -_-

could you make it to be only loadable with 1 nickname?
coz someone can copy another's code so easily
thx
 

Yoshii

New Member
Reaction score
74
how i add lumber save?

^^ clearly someone who did not read the 1st post not to be mean
I didnt know anything about about save/load and was able to make one that save anything hero, lumber, gold,spent and unspent skill piont,lvl, ability just by donwloading the map posted and reading the 1st post.

Thx for the great tutorial
 

TDestroyer

New Member
Reaction score
0
Help

Dude this tutorial is awesome but i have a problem. I took your code and made it so it works on all the stuff i wanted it to. It works perfectly except that it only saves 1 item. if anyone can see my mistake let me know

Code:
Initialization
    Events
        Map initialization
    Conditions
    Actions
        -------- List of Heroes --------
        Set SaveLoad_Heroes_LastIndex = 2
        Set SaveLoad_Heroes[1] = Peasant
        Set SaveLoad_Heroes[2] = Fighter
        -------- List of Items --------
        Set SaveLoad_Items_LastIndex = 9
        Set SaveLoad_Items[1] = Short Sword
        Set SaveLoad_Items[2] = Dagger
        Set SaveLoad_Items[3] = Wooden Staff
        Set SaveLoad_Items[4] = Bow
        Set SaveLoad_Items[5] = Leather Armor
        Set SaveLoad_Items[6] = Robe
        Set SaveLoad_Items[9] = Vial of Healing
        -------- List of Abilities --------
        Set SaveLoad_Abilities_LastIndex = 5
        Set SaveLoad_Abilities[1] = Attribute Bonus - Peasant Hero
        Set SaveLoad_Abilities[2] = Critical Strike - Peasant Hero
        Set SaveLoad_Abilities[3] = Shockwave - Fighter Hero
        Set SaveLoad_Abilities[4] = Critical Strike - Fighter Hero
        Set SaveLoad_Abilities[5] = Martial Training - Fighter Hero
        -------- Other Variables --------
        Set SaveLoad_Alphabet = abcdefghijklmnopqrstuvwxyz
        Set SaveLoad_Initialized = False

--------------------------------------------------------------------
Save Control
    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
        -------- Prepare the save array with this player's Hero --------
        Set SaveCount = 0
        -------- Player's Gold/Lumber --------
        Set Save[1] = ((Triggering player) Current gold)
        Set Save[2] = ((Triggering player) Current lumber)
        -------- Take all Heroes --------
        Unit Group - Pick every unit in (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
            Loop - Actions
                Set Hero = (Picked unit)
        -------- Save the Hero --------
        Custom script:   set udg_Save[3] = SaveLoad_Unit2Integer( udg_Hero )
        -------- Hero Experience --------
        Set Save[4] = (Hero experience of Hero)
        -------- How many items does he carry --------
        Set Save[5] = (Number of items carried by Hero)
        -------- Add all items --------
        Set SaveCount = 5
        For each (Integer A) from 1 to 6, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Item carried by Hero in slot (Integer A)) is owned) Equal to True
                    Then - Actions
                        -------- The actual item --------
                        Set SaveCount = (SaveCount + 1)
                        Set TempItem = (Item carried by Hero in slot (Integer A))
                        Custom script:   set udg_Save[udg_SaveCount] = SaveLoad_Item2Integer( udg_TempItem )
                        -------- The number of charges it has --------
                        Set SaveCount = (SaveCount + 1)
                        Set Save[SaveCount] = (Charges remaining in (Item carried by Hero in slot (Integer A)))
                    Else - Actions
        -------- Add all abilities --------
        For each (Integer A) from 1 to SaveLoad_Abilities_LastIndex, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Level of SaveLoad_Abilities[(Integer A)] for Hero) Greater than 0
                    Then - Actions
                        -------- The actual ability --------
                        Set SaveCount = (SaveCount + 1)
                        Set Save[SaveCount] = (Integer A)
                        -------- Its level --------
                        Set SaveCount = (SaveCount + 1)
                        Set Save[SaveCount] = (Level of SaveLoad_Abilities[(Integer A)] for Hero)
                    Else - Actions
        -------- 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
------------------------------------------------------------------
Load Control
    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 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 --------
        Unit Group - Pick every unit in (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
            Loop - Actions
                Unit - Remove (Picked unit) from the game
        Set TempInt = SaveCount
        Set SaveCount = 1
        -------- Restore Gold/Lumber --------
        Player - Set (Triggering player) Current gold to Save[1]
        Player - Set (Triggering player) Current lumber to Save[2]
        -------- For "number of Heroes", do --------
        -------- Restore Hero --------
        Custom script:   set udg_TempUnitType = SaveLoad_Integer2Unit(udg_Save[3])
        Unit - Create 1 TempUnitType for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
        Set PlayerHeroes[(Player number of (Triggering player))] = (Last created unit)
        -------- Set Experience --------
        Hero - Set (Last created unit) experience to Save[4], Hide level-up graphics
        -------- Recreate all items --------
        Set SaveCount = 5
        For each (Integer A) from 1 to Save[5], do (Actions)
            Loop - Actions
                -------- The actual item --------
                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)
                -------- Number of charges --------
                Set SaveCount = (SaveCount + 1)
                Item - Set charges remaining in (Last created item) to Save[SaveCount]
        -------- Give Skills --------
        For each (Integer SaveCount) from (SaveCount + 1) to TempInt, do (Actions)
            Loop - Actions
                For each (Integer A) from 1 to Save[(SaveCount + 1)], do (Actions)
                    Loop - Actions
                        Custom script:   call SelectHeroSkill( GetLastCreatedUnit(), udg_SaveLoad_Abilities[ udg_Save[ udg_SaveCount ] ] )
                Set SaveCount = (SaveCount + 1)

I think the error is in the load code because the saves are longer when i have more items. But when i load i dont receive them...

btw some of the variables that u set up i hard coded into the script, like case sensitivity so i didn't have so many variables
 

NeuroToxin

New Member
Reaction score
46
Ok I get the error expected a name when I copied over everything and set it right please help. I cant enable anything without the error and I did copy over the header
 

TDestroyer

New Member
Reaction score
0
Help2

I just found out that it wasn't the save/load code that was messing it up. I still don't know the problem but is in this code not the previous. This code is supposed to stack items (turning 1potion into 2), player lock items(prevent other players from picking them up), and slot lock(only allow 1 item of each type. ex: sword and staff both lvl 1 so u can only have 1 or the other).

Here is the code...
Code:
Pick Up Item Control
    Events
        Unit - A unit Acquires an item
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Item level of (Item being manipulated)) Equal to 0
            Then - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Charges remaining in (Item being manipulated)) Equal to 0
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Custom value of (Item being manipulated)) Equal to 0) or ((Custom value of (Item being manipulated)) Equal to (Player number of (Owner of (Hero manipulating item))))
                            Then - Actions
                                Item - Set the custom value of (Item being manipulated) to (Player number of (Owner of (Hero manipulating item)))
                            Else - Actions
                                Game - Display to (Player group((Owner of (Hero manipulating item)))) the text: This item doesn't b...
                                Hero - Drop (Item being manipulated) from (Hero manipulating item)
                    Else - Actions
                        For each (Integer A) 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 manipulating item) in slot (Integer A))) Equal to (Item-type of (Item being manipulated))
                                        (Item carried by (Hero manipulating item) in slot (Integer A)) Not equal to (Item being manipulated)
                                        (Charges remaining in (Item carried by (Hero manipulating item) in slot (Integer A))) Less than 99
                                    Then - Actions
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                ((Charges remaining in (Item carried by (Hero manipulating item) in slot (Integer A))) + (Charges remaining in (Item being manipulated))) Greater than 99
                                            Then - Actions
                                                Item - Set charges remaining in (Item being manipulated) to ((Charges remaining in (Item carried by (Hero manipulating item) in slot (Integer A))) + ((Charges remaining in (Item being manipulated)) - 99))
                                                Item - Set charges remaining in (Item carried by (Hero manipulating item) in slot (Integer A)) to 99
                                                Hero - Drop (Item being manipulated) from (Hero manipulating item)
                                            Else - Actions
                                                Item - Set charges remaining in (Item carried by (Hero manipulating item) in slot (Integer A)) to ((Charges remaining in (Item carried by (Hero manipulating item) in slot (Integer A))) + (Charges remaining in (Item being manipulated)))
                                                Item - Remove (Item being manipulated)
                                    Else - Actions
            Else - Actions
                For each (Integer A) from 1 to 6, do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Item level of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to (Item level of (Item being manipulated))
                                (Item carried by (Hero manipulating item) in slot (Integer A)) Not equal to (Item being manipulated)
                            Then - Actions
                                Game - Display to (Player group((Owner of (Hero manipulating item)))) the text: You already have a ...
                                Hero - Drop (Item being manipulated) from (Hero manipulating item)
                                Skip remaining actions
                            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Custom value of (Item being manipulated)) Equal to 0) or ((Custom value of (Item being manipulated)) Equal to (Player number of (Owner of (Hero manipulating item))))
                    Then - Actions
                        Item - Set the custom value of (Item being manipulated) to (Player number of (Owner of (Hero manipulating item)))
                    Else - Actions
                        Game - Display to (Player group((Owner of (Hero manipulating item)))) the text: This item doesn't b...
                        Hero - Drop (Item being manipulated) from (Hero manipulating item)

if you see any problems let me know
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top