This is basically my first attempt at using hashtables as it seems like the best way to handle it. I've probably done something fundamentally wrong here but it seems like it should work to me. it saves the players inventory when they cast open as 1-6 of that players index and removes the items. it then loads 6+ 1-6 where backpack items are stored and gives them to the hero. on closing it saves them and switches back.
the abilities switch and the items are removed but they don't seem to be saved correctly because they don't come back when close runs.
the abilities switch and the items are removed but they don't seem to be saved correctly because they don't come back when close runs.
-
Testing Init
-
Events
-
Map initialization
-
-
Conditions
-
Actions
-
Hashtable - Create a hashtable
-
Set Backpack = (Last created hashtable)
-
-
-
Backpack
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Open Backpack
-
-
Actions
-
Set playerNum = (Player number of (Owner of (Triggering unit)))
-
Unit - Remove Open Backpack from (Triggering unit)
-
Unit - Add Close Backpack to (Triggering unit)
-
For each (Integer loopA) from 1 to 6, do (Actions)
-
Loop - Actions
-
Hashtable - Save Handle Of(Item carried by (Triggering unit) in slot loopA) as loopA of playerNum in Backpack
-
Item - Remove (Item carried by (Triggering unit) in slot loopA)
-
Hero - Give (Load (loopA + 6) of playerNum in Backpack) to (Triggering unit)
-
-
-
-
-
Backpack Copy
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Close Backpack
-
-
Actions
-
Set playerNum = (Player number of (Owner of (Triggering unit)))
-
Unit - Remove Close Backpack from (Triggering unit)
-
Unit - Add Open Backpack to (Triggering unit)
-
For each (Integer loopA) from 1 to 6, do (Actions)
-
Loop - Actions
-
Hashtable - Save Handle Of(Item carried by (Triggering unit) in slot loopA) as (loopA + 6) of playerNum in Backpack
-
Item - Remove (Item carried by (Triggering unit) in slot loopA)
-
Hero - Give (Load loopA of playerNum in Backpack) to (Triggering unit)
-
-
-
-