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

Items

Status
Not open for further replies.
Level 5
Joined
Jul 15, 2012
Messages
101
Hi, when i die with unit (not hero) i losse all my items. Need help how to fix this. Maybe this trigger is wrong?
  • Events
  • Unit - A unit dies
  • Conditions
  • Actions
  • Wait 9.99 seconds
  • Unit - Move (Dying unit) instantly to (Random point in qqqq <gen>)
  • Wait 0.01 seconds
  • Unit - Replace (Dying unit) with a (Unit-type of (Dying unit)) using The new unit's life and mana
 
Hi, when i die with unit (not hero) i losse all my items. Need help how to fix this. Maybe this trigger is wrong?
  • Events
  • Unit - A unit dies
  • Conditions
  • Actions
  • Wait 9.99 seconds
  • Unit - Move (Dying unit) instantly to (Random point in qqqq <gen>)
  • Wait 0.01 seconds
  • Unit - Replace (Dying unit) with a (Unit-type of (Dying unit)) using The new unit's life and mana

Add [/TRIGGER] after you've finished copying the text from the editor.

By replacing the unit you will always lose all items. Instead of replacing the unit, make a new one, and give it items from the first unit and you should be set.
 
Level 5
Joined
Jul 15, 2012
Messages
101
But it dont works lol.
  • Events
  • Unit - A unit dies
  • Conditions
  • Actions
  • Wait 9.99 seconds
  • Unit - Create 1 (Unit-type of (Dying unit)) for (Owner of (Dying unit)) at (Randonm point in qqqqq <gen>) facing Default building facing degrees
  • Wait 0.01 seconds
  • Hero - Create (Item-type of (Item carried by (Dying unit) in slot 1)) and give it to (Dying unit)
  • Hero - Create (Item-type of (Item carried by (Dying unit) in slot 2)) and give it to (Dying unit)
  • Hero - Create (Item-type of (Item carried by (Dying unit) in slot 3)) and give it to (Dying unit)
  • Hero - Create (Item-type of (Item carried by (Dying unit) in slot 4)) and give it to (Dying unit)
  • Hero - Create (Item-type of (Item carried by (Dying unit) in slot 5)) and give it to (Dying unit)
  • Hero - Create (Item-type of (Item carried by (Dying unit) in slot 6)) and give it to (Dying unit)
 
Level 9
Joined
Jul 10, 2011
Messages
562
because of 2 reasons.

1. dying unit doesnt survive waits.
2. you give items to a dead unit (even though it still exists its dead and not usable anymore)
 
Try this one:
  • Untitled Trigger 003
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Custom script: local unit u = GetTriggerUnit()
      • Custom script: local unit new = null
      • Wait 10.00 seconds
      • Set TempLoc = (Random point in (Your Region))
      • Custom script: set new = CreateUnit(GetOwningPlayer(u), GetUnitTypeId(u), GetLocationX(udg_TempLoc), GetLocationY(udg_TempLoc), 270)
      • Custom script: call UnitAddItem(new, UnitItemInSlot(u, 0))
      • Custom script: call UnitAddItem(new, UnitItemInSlot(u, 1))
      • Custom script: call UnitAddItem(new, UnitItemInSlot(u, 2))
      • Custom script: call UnitAddItem(new, UnitItemInSlot(u, 3))
      • Custom script: call UnitAddItem(new, UnitItemInSlot(u, 4))
      • Custom script: call UnitAddItem(new, UnitItemInSlot(u, 5))
      • Custom script: call RemoveLocation(udg_TempLoc)
      • Custom script: set u = null
      • Custom script: set new = null
      • Custom script: set udg_TempLoc = null
To add custom script sections, add action under "-General" that is called Custom Script, and then type what I did. Before you do all this, create a variable called TempLoc of type Point.
 
Level 9
Joined
Jul 10, 2011
Messages
562
i could be wrong but shoulnt the creation be
set new = CreateUnit(GetOwningPlayer(u), GetUnitTypeId(u), GetLocationX(udg_TempLoc), GetLocationY(udg_TempLoc), 270)

instead of u...
 
Level 5
Joined
Jul 15, 2012
Messages
101
  • Untitled Trigger 003
  • Events
  • Unit - A unit Dies
  • Conditions
  • Actions
  • Custom script: local unit u = GetTriggerUnit()
  • Custom script: local unit new = null
  • Wait 10.00 seconds
  • Set TempLoc = (Random point in (Your Region))
  • Custom script: set new = CreateUnit(GetOwningPlayer(u), GetUnitTypeId(u), GetLocationX(udg_TempLoc), GetLocationY(udg_TempLoc), 270)
  • Custom script: call UnitAddItem(new, UnitItemInSlot(u, 0))
  • Custom script: call UnitAddItem(new, UnitItemInSlot(u, 1))
  • Custom script: call UnitAddItem(new, UnitItemInSlot(u, 2))
  • Custom script: call UnitAddItem(new, UnitItemInSlot(u, 3))
  • Custom script: call UnitAddItem(new, UnitItemInSlot(u, 4))
  • Custom script: call UnitAddItem(new, UnitItemInSlot(u, 5))
  • Custom script: call RemoveLocation(udg_TempLoc)
  • Custom script: set u = null
  • Custom script: set new = null
  • Custom script: set udg_TempLoc = null
Did it and now i can't save my map.. 7 errors
 
Level 9
Joined
Jul 10, 2011
Messages
562
you should post your trigger and not copy the one HappyTauren posted and say "i got errors"....how shall we know what you did wrong if you just copy taurens trigger and we dont see yours ?
 
Level 5
Joined
Jul 15, 2012
Messages
101

Attachments

  • qqqq.png
    qqqq.png
    131.6 KB · Views: 118
Level 9
Joined
Jul 10, 2011
Messages
562
1. you forgot a ) in the first line you marked. right before the 270 degrees.
2. the command is UnitItemInSlot not UnitItemInSlow
3. (could be wrong but im 99% sure) the 270 has to be 270.00 because degrees are reals and no integer afaik
 
Level 5
Joined
Jul 15, 2012
Messages
101
Errors.png

local unit u = GetTriggerUnit()
local unit new = null
set new = CreateUnit(GetOwningPlayer(u), GetUnitTypeId(u), GetLocationX(udg_TempLoc), GetLocationY(udg_TempLoc), 270)
call UnitAddItem(new, UnitItemInSlot(u, 0))
call UnitAddItem(new, UnitItemInSlot(u, 1))
call UnitAddItem(new, UnitItemInSlot(u, 2))
call UnitAddItem(new, UnitItemInSlot(u, 3))
call UnitAddItem(new, UnitItemInSlot(u, 4))
call UnitAddItem(new, UnitItemInSlot(u, 5))
set u = null
set new = null


now i get 11 errors.
 
Status
Not open for further replies.
Top