Item swapping

Ghoulord

New Member
Reaction score
2
Hi. I've been working on a system that when an item is placed in a certain units inventory becomes permantly fixed to that unit. I've got that part of the code working, but it will only work if the unit in question picks up the item, and is NOT given it.

For example, my hero makes an item and then gives it to the unit (in this case a guard tower). I want the item to swap immediately in place of the given item. Heres the code if it helps

Code:
Item Equip
    Events
        Unit - A unit Acquires an item
    Conditions
        (Triggering unit) Equal to (Random unit from (Units of type Guard Tower))
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Item-type of (Item carried by (Triggering unit) of type Spider Ring)) Equal to Spider Ring
            Then - Actions
                Item - Remove (Item carried by (Triggering unit) of type Spider Ring)
                Item - Create Spider Ring(A) at (Position of (Item carried by (Triggering unit) of type Spider Ring))
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Item-type of (Item carried by (Triggering unit) of type Goblin Night Scope)) Equal to Goblin Night Scope
            Then - Actions
                Item - Remove (Item carried by (Triggering unit) of type Goblin Night Scope)
                Item - Create Goblin Night Scope(A) at (Position of (Item carried by (Triggering unit) of type Goblin Night Scope))
            Else - Actions

The guard tower has been given a modified version of the Inventory(Hero) ability to give it 2 slots instead of 6, and each of the items with (A) after them are the permantly equiped versions of the items.

Thanks.
 

Olyvian

New Member
Reaction score
2
Trigger:
  • Hero - Give (Last created item) to (The unit you want it to be given to)


?
 

Ghoulord

New Member
Reaction score
2
thanks for that. forgot the obvious XD

is there any better way to get it to check to see if the triggering unit is my guard tower? at the minute it's randoming to see if the building is valid or not, meaning the trigger only works some of the time.
 

Olyvian

New Member
Reaction score
2
I don't know what you mean tho, but did you ment something like this? :p
Trigger:
  • Conditions
    • (Hero manipulating item) Equal to (Your guard tower)
    • (Owner of (Hero manipulating item)) Equal to Player 1 (Red)
 

Ghoulord

New Member
Reaction score
2
to clarify, this section of code

Code:
    Conditions
        (Triggering unit) Equal to (Random unit from (Units of type Guard Tower))

means that currently my trigger is run ONLY when the guard tower is picked by the randomiser. It's ok if i only have one on the map, but i will have more than one, making it unreliable.

does that help?
 

Ayanami

칼리
Reaction score
288
Why don't you use this?

Trigger:
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Guard Tower
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top