• 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] Unit carying item spawns new unit

Status
Not open for further replies.
Level 18
Joined
Aug 23, 2008
Messages
2,319
Probably the last. I'm not sure if the dying unit can still be checked for carried items.

If it's possible:
  • Events
    • A unit dies
  • Conditions
    • (Dying unit) carries item of item type (YOUR ITEM)
  • Actions
    • Create 1 YOUR UNIT at (Position of (Dying unit)) facing default building angle
(Not sure what the condition really looks like, but it's something like that. I don't have the WE here.

If not:
You should make an arrayed Unit variable 'GotYourItem'. If the unit gets the item, place him in the variable. To check which array is still unused, you need an 'exitwhen' JASS line. I'm not using JASS, but I know that line exists. You should ask someone who's familiar with JASS to tell you the exact script line to place. It should exit when the array is not used or the unit in it has been detroyed (leakless). If that's not possible, just set the unit to a dummy unit and exit when the unit of that array is the dummy unit. For an example of what I mean, check this thread.
 
Level 24
Joined
Oct 18, 2008
Messages
942
Probably the last. I'm not sure if the dying unit can still be checked for carried items.

If it's possible:
  • Events
    • A unit dies
  • Conditions
    • (Dying unit) carries item of item type (YOUR ITEM)
  • Actions
    • Create 1 YOUR UNIT at (Position of (Dying unit)) facing default building angle
(Not sure what the condition really looks like, but it's something like that. I don't have the WE here.

it would be or multiple conditions, unit has item in slot 1 unit has item in slot 2 etc i think.

If not:
You should make an arrayed Unit variable 'GotYourItem'. If the unit gets the item, place him in the variable. To check which array is still unused, you need an 'exitwhen' JASS line. I'm not using JASS, but I know that line exists. You should ask someone who's familiar with JASS to tell you the exact script line to place. It should exit when the array is not used or the unit in it has been detroyed (leakless). If that's not possible, just set the unit to a dummy unit and exit when the unit of that array is the dummy unit. For an example of what I mean, check this thread.

why array? just use unit group.
 
Status
Not open for further replies.
Top