• 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!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Referring to an item giving unit.

Status
Not open for further replies.
Level 3
Joined
Nov 22, 2014
Messages
50
Hi,

I have a 'shop', that is just there for the looks. It's a unit with an inventory.

If a player clicks on it, the personal 'item forge' of the respective player is selected. On this forge players can combine and upgrade items, and I want everybody to have his own private forge.
That all works fine, but I also want the items given to that dummy to be given to the correct forge.
I have put the forges in an array from 1 - 6, (I got 6 players in my map.)

However, giving an item to the dummy, by any player, just gives the item to the forge of player 1. I think that's because '(Previous owner)' is wrong. However, I just can not find how to refer to the previous owner of an item :s.

How can I make this work?

  • ItemPushThrough
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Triggering unit) Equal to Soulforge Clickable 0037 <gen>
    • 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
              • (Integer A) Equal to (Player number of (Previous owner))
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of items carried by SoulForgeArray[(Integer A)]) Not equal to 3
                • Then - Actions
                  • Hero - Give (Item being manipulated) to SoulForgeArray[(Integer A)]
                • Else - Actions
                  • Hero - Give (Item being manipulated) to HeroArray[(Integer A)]
            • Else - Actions
 
You could use the item's custom value to manually set ownership of the item, because Previous Owner only refers to ownership changed units as far as I know. So for example, an ownership trigger would be like this:
  • Events
    • Unit - A unit Loses an item
  • Conditions
  • Actions
    • Item - Set the custom value of (Item being manipulated) to (Player number of (Owner of (Hero manipulating item)))
Then you can run a trigger like you had, but you'd be checking for the item's custom value:
  • Events
    • Unit - A unit Acquires an item
  • Conditions
    • (Triggering unit) Equal to Soulforge Clickable 0001 <gen>
  • 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
            • (Custom value of (Item being manipulated)) Equal to (Integer A)
          • Then - Actions
            • Hero - Give (Item being manipulated) to SoulForgeArray[(Integer A)]
          • Else - Actions
 
Yeah, that works, thanks for the solution!


I also realized that I was thinking wrong with the integer loop:
  • ItemPushThrough
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Triggering unit) Equal to Soulforge Clickable 0037 <gen>
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of items carried by SoulForgeArray[(Custom value of (Item being manipulated))]) Not equal to 3
        • Then - Actions
          • Hero - Give (Item being manipulated) to SoulForgeArray[(Custom value of (Item being manipulated))]
        • Else - Actions
          • Hero - Give (Item being manipulated) to HeroArray[(Custom value of (Item being manipulated))]
 
Status
Not open for further replies.
Back
Top