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

Backpack ... Again !

Status
Not open for further replies.
Level 3
Joined
Dec 30, 2011
Messages
54
Use this
  • Conditions
    • your item <gen> Equal to (Item being manipulated)
instead of (picked item)
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Be reminded that your last trigger fires every 0.10 seconds and therefor happens for every unit that is created in the game, not only the backpack unit that you create in the previous trigger.
If it is specifically for the backpack unit I strongly suggest storing the backpack unit in a variable and order that unit by refferencing to it's variable to move to the specific point in the specific angle.

Else you would be targeting all units that gets created...
The reason why storing it in a variable is better is because it's faster then using last created unit, since those are unnessecary function calls that return values from the memory.
By using a variable you directly get the value from that location in memory.

Also don't forget to remove the location leak you've created...


Example:
  • Backpack
    • Events
      • Unit - Blood Mage 0001 <gen> Acquires an item
    • Conditions
      • Backpack 0000 <gen> Equal to (Item being manipulated)
    • Actions
      • set temp_loc = (Position of Blood Mage 0001 <gen>)
      • Unit - Create 1 Backpack for Player 1 (Red) at temp_loc facing (Facing of Blood mage 0001 <gen>) degrees
      • set backpack = (Last created unit)
      • Unit - Move backpack instantly to temp_loc
      • Unit - Make backpack face (Facing of Blood mage 0001 <gen>) over 0.00 seconds
      • Custom script - call RemoveLocation(udg_temp_loc)
      • If you want to move the backpack and face it to the face of Blood mage 0001 <gen> every ... seconds I suggest you do something like this:
      • Trigger - Turn on Move Backpack
This trigger is initially off:

  • Move Backpack
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • set temp_loc = (Position of Blood Mage 0001 <gen>)
      • Unit - Move backpack instantly to temp_loc
      • Unit - Make backpack face (Facing of Blood mage 0001 <gen>) over 0.00 seconds
      • Custom script - call RemoveLocation(udg_temp_loc)
Then when the backpack is not needed anymore or needs to be destroyed, simply turn off Move Backpack and remove the backpack unit from the game. If that's needed at all ofcourse...
 
Status
Not open for further replies.
Top