• 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.

[Trigger] problem with item pick up trigger

Status
Not open for further replies.
Level 1
Joined
Jul 13, 2011
Messages
4
Hello everyone i,m new to the site and i,m looking for some help on a trigger i have been working

i have tried many different ways to go about this but maybe someone else can give me some advice on how to do it

what i,m trying to do is when a unit enters RegionA then order unit to pick up every item of type stone in RegionA and then order that unit to move to RegionB
now that you know what it is that i am trying to do maybe you will know what to do

sorry i don't know how to past my trigger but if someone could tell me then i will post it but i,ll just type it up now


my triggers



Trigger1

Event
unit - a unit enters regionA

Conditions
none

Actions
item - pick every item in regionA <gen> and do (Actions)
loop - Actions

if (all conditions are true) then do (then Actions) else do (else Actions)

if - conditions
(item-type of (picked item)) equal to stone

then - Actions
set item1 = item1 + 1

else - Actions
do nothing

(comment) this Action happens after pick every item
unit - order (triggering unit) to right-click ( random item in regionA <gen> matching ((item-type of (matching item) equal to stone))



Trigger2
Event
unit - a unit acquires an item

Conditions
(item-type of (item being manipulated)) equal to stone

Actions
set item1 = item1 - 1

if (all conditions are true) then do (then Actions) else do (else Actions)

if - conditions
item1 equal to 0

then - Actions
order (hero manipulating item) to move to (center of regionB <gen)

else - Actions
unit - order (hero manipulating item) to right-click ( random item in regionA <gen> matching ((item-type of (matching item) equal to stone))
 
Level 9
Joined
Oct 17, 2009
Messages
370
  • Trigger1
    • Events
      • Unit - A unit enters region1
    • Conditions
    • Actions
      • Item - Pick every item in region1 and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of items carried by (Triggering unit)) Less than 6
              • (Item-type of (Picked item)) Equal to stone
            • Then - Actions
              • Hero - Give (Picked item) to (Triggering unit)
            • Else - Actions
      • Set temppoint = (Center of region2)
      • Unit - Order (Triggering unit) to Move To temppoint
      • Custom script: call RemoveLocation(udg_temppoint)
This is how it should look like, temppoint is a point variable.
 
Level 37
Joined
Mar 6, 2006
Messages
9,243

images

 
Level 1
Joined
Jul 13, 2011
Messages
4
thanks haxel96 this worked perfect
and thanks maker and bribe for helping me with that little problem on how i don't know much yet
 
Status
Not open for further replies.
Top