On this trigger I save the item handle and other stats required for my map to work.
This is my respawn trigger, since my map runs no hero units == the unit has to be created from scratch, this is where I load my items.
Last here are the item restriction triggers.
So what happend first was, the unit could not equip the loaded items back, it said the unit already had that item. Even thought the inventory was empty.
So I disabled the Item Restriction triggers when the unit loads it's items and its almost fine. He gets the items now and can equip them, but when he drops any item and tries to equip it back, he cannot pick it up anymore, even if the unit had no item of the type currently equipped.
-
Save Unit Data
-
Events
-
Time - Every 3.00 seconds of game time
-
-
Conditions
-
Actions
-
Custom script: set bj_wantDestroyGroup = true
-
Player Group - Pick every player in (All players) and do (Actions)
-
Loop - Actions
-
Set VariableSet StatsPlayerNumber = (Player number of (Picked player))
-
Unit Group - Pick every unit in (Units in (Playable map area) owned by (Owner of HeroUnit[StatsPlayerNumber])) and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Unit-type of (Picked unit)) Not equal to Peasant
-
-
Then - Actions
-
Set VariableSet StatsPlayerNumber = (Player number of (Owner of (Picked unit)))
-
Set VariableSet HeroUnit[StatsPlayerNumber] = (Picked unit)
-
Set VariableSet Level[StatsPlayerNumber] = (Level of (Picked unit))
-
Hashtable - Save Handle Of(Item carried by HeroUnit[StatsPlayerNumber] in slot 1) as 1 of StatsPlayerNumber in HeroHash.
-
Hashtable - Save Handle Of(Item carried by HeroUnit[StatsPlayerNumber] in slot 2) as 2 of StatsPlayerNumber in HeroHash.
-
Hashtable - Save Handle Of(Item carried by HeroUnit[StatsPlayerNumber] in slot 3) as 3 of StatsPlayerNumber in HeroHash.
-
Hashtable - Save Handle Of(Item carried by HeroUnit[StatsPlayerNumber] in slot 4) as 4 of StatsPlayerNumber in HeroHash.
-
Hashtable - Save Handle Of(Item carried by HeroUnit[StatsPlayerNumber] in slot 5) as 5 of StatsPlayerNumber in HeroHash.
-
Hashtable - Save Handle Of(Item carried by HeroUnit[StatsPlayerNumber] in slot 6) as 6 of StatsPlayerNumber in HeroHash.
-
-
Else - Actions
-
-
-
-
-
-
-
This is my respawn trigger, since my map runs no hero units == the unit has to be created from scratch, this is where I load my items.
-
Sadge
-
Events
-
Unit - A unit Dies
-
-
Conditions
-
(Unit-type of (Triggering unit)) Not equal to Peasant
-
(Owner of (Triggering unit)) Not equal to Neutral Hostile
-
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
((Owner of (Triggering unit)) slot status) Equal to Is playing
-
-
Then - Actions
-
Wait 15.00 seconds
-
Unit - Create 1 (Unit-type of (Triggering unit)) for (Owner of (Triggering unit)) at (Center of Myria Village <gen>) facing Default building facing degrees
-
Set VariableSet StatsPlayerNumber = (Player number of (Owner of (Triggering unit)))
-
Set VariableSet HeroUnit[StatsPlayerNumber] = (Last created unit)
-
Unit - Set Unit: HeroUnit[StatsPlayerNumber]'s Integer Field: Level ('ulev') to Value: Level[StatsPlayerNumber]
-
-------- --------
-
Unit - Set Max HP of HeroUnit[StatsPlayerNumber] to (10 + (Toughness[StatsPlayerNumber] x 7))
-
Unit - Set Armor of HeroUnit[StatsPlayerNumber] to ((Real(Agility[StatsPlayerNumber])) + ((Real(Toughness[StatsPlayerNumber])) / 2.00))
-
Unit - Set Max Mana of HeroUnit[StatsPlayerNumber] to (Intelligence[StatsPlayerNumber] x (4 + (Focus[StatsPlayerNumber] / 2)))
-
-------- --------
-
Unit - Set Unit: HeroUnit[StatsPlayerNumber]'s Real Field: Mana Regeneration ('umpr') to Value: ((Real(Focus[StatsPlayerNumber])) / 10.00)
-
Unit - Set Unit: HeroUnit[StatsPlayerNumber]'s Real Field: Hit Points Regeneration Rate ('uhpr') to Value: HpReg_Total[StatsPlayerNumber]
-
Unit - Set Base Damage of HeroUnit[StatsPlayerNumber] to (Strength[StatsPlayerNumber] + (Focus[StatsPlayerNumber] / 2)) for weapon index: 0
-
-------- Load Items --------
-
Trigger - Turn off Testing <gen>
-
Trigger - Turn off Testing2 <gen>
-
Hero - Create (Item-type of (Load 1 of StatsPlayerNumber in HeroHash.)) and give it to HeroUnit[StatsPlayerNumber]
-
Hero - Create (Item-type of (Load 2 of StatsPlayerNumber in HeroHash.)) and give it to HeroUnit[StatsPlayerNumber]
-
Hero - Create (Item-type of (Load 3 of StatsPlayerNumber in HeroHash.)) and give it to HeroUnit[StatsPlayerNumber]
-
Hero - Create (Item-type of (Load 4 of StatsPlayerNumber in HeroHash.)) and give it to HeroUnit[StatsPlayerNumber]
-
Hero - Create (Item-type of (Load 5 of StatsPlayerNumber in HeroHash.)) and give it to HeroUnit[StatsPlayerNumber]
-
Hero - Create (Item-type of (Load 6 of StatsPlayerNumber in HeroHash.)) and give it to HeroUnit[StatsPlayerNumber]
-
Trigger - Turn on Testing <gen>
-
Trigger - Turn on Testing2 <gen>
-
Multiboard - Set the text for PlayerMultiBoards[StatsPlayerNumber] item in column 2, row 7 to (String((Level of HeroUnit[StatsPlayerNumber])))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
((Owner of HeroUnit[StatsPlayerNumber]) Current lumber) Greater than 0
-
-
Then - Actions
-
Player - Enable Level Up for (Owner of HeroUnit[StatsPlayerNumber])
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
Last here are the item restriction triggers.
-
Testing
-
Events
-
Unit - A unit Acquires an item
-
-
Conditions
-
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 being manipulated) Not equal to (Item carried by (Triggering unit) in slot (Integer A))
-
(Custom value of (Item being manipulated)) Equal to (Custom value of (Item carried by (Triggering unit) in slot (Integer A)))
-
-
Then - Actions
-
Hero - Drop (Item being manipulated) from (Triggering unit).
-
Game - Display to (Player group((Owner of (Triggering unit)))) the text: |cffff0000Game:|r Y...
-
Custom script: exitwhen true
-
-
Else - Actions
-
-
-
-
-
-
Testing2
-
Events
-
Unit - A unit Acquires an item
-
-
Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Unit-type of (Triggering unit)) Equal to |cff0000ffDefender|r (Hero)
-
(Custom value of (Item being manipulated)) Equal to 3
-
-
Then - Actions
-
Game - Display to (Player group((Owner of (Triggering unit)))) the text: |cffff0000Game:|r Y...
-
Hero - Drop (Item being manipulated) from (Triggering unit).
-
-
Else - Actions
-
-
-
So what happend first was, the unit could not equip the loaded items back, it said the unit already had that item. Even thought the inventory was empty.
So I disabled the Item Restriction triggers when the unit loads it's items and its almost fine. He gets the items now and can equip them, but when he drops any item and tries to equip it back, he cannot pick it up anymore, even if the unit had no item of the type currently equipped.