• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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
 
Level 21
Joined
Aug 13, 2011
Messages
739
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
 
Level 3
Joined
Nov 22, 2014
Messages
50
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.
Top