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

Unit triggers?

Status
Not open for further replies.
Level 3
Joined
Apr 5, 2013
Messages
30
Can someone help me with two things, first one is when i kill a unit he respawns where his corpse is not where he spawns which i want it where he spawns, and the second thing is for example when player 2 kills something player 1 will get the xp even if he is all the way across the map if someone can help me with the triggers that would be good :ogre_haosis:
 
Level 7
Joined
Sep 9, 2007
Messages
253
1) Well it depends on your exact situation but a very basic trigger would be:

  • Trigger
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Wait 5.00 seconds
      • Unit - Create 1 (Unit-type of (Triggering unit)) for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
The above trigger will work but it contains a memory leak. Every time this trigger runs it will find the position of the triggering unit and that position will be stored in the memory for the entire game. So the more this trigger runs in a game the more memory will be used and eventually it will cause lag. So to fix this you can use the trigger below which will remove the triggering unit's position from the memory after it has performed the action you want. In order to do this you will need to make a Point Variable.

  • No Leak Trigger
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set Temp_Point = (Position of (Triggering unit))
      • Wait 5.00 seconds
      • Unit - Create 1 (Unit-type of (Triggering unit)) for (Owner of (Triggering unit)) at Temp_Point facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_Temp_Point)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
I think you can adjust experience gain range in the gameplay constants section.

Problem 1 will require you to save the location of every spawn and then when a spawn dies you recreate the unit at the corresponding spawn point. You could use custom unit value to save an array index. The array index looks up location data for where to re-spawn the unit. The re-spawned is then given the same array index as a custom value so the cycle can repeat itself.
 
Status
Not open for further replies.
Top