• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Just a helpful RPG trigger, Spawns (not a help request)

Status
Not open for further replies.
Level 9
Joined
Oct 24, 2007
Messages
421
OK firstly this trigger leaks big time I'm sure, but it didn't lag up a 6 person battlenet game in the ten trials it received. Basicaly I thought I'd upload it to show the hive just because around about 8 or so people begged me to explain how the trigger worked in a battlenet game (while testing online with random people).

It is a spawn trigger, that remembers the location of every unit at the beginning of a map, in the event a unit dies who is an enemy, half a minute later it is respawned at that target location, so on, so forth.

It's probably better suited to single player RPG's but eitherway hope this helps people make RPG's better with this trigger or similar.
 

Attachments

  • collect integers.JPG
    collect integers.JPG
    81.1 KB · Views: 131
  • respawn units.JPG
    respawn units.JPG
    57.3 KB · Views: 108
Level 12
Joined
Apr 27, 2008
Messages
1,228
I will not say anything about the leaks(if I said, it would be how to fix them in those particular triggers).
I will just say that you should not use "for each integer from 1 to 999" but "for each integer from 1 to unitnumber"
Also u do not need that condition inside the loop(for each integer...) - just store the position directly.
You should remove the wait - it is useless there, besides waits have issues so avoid them every time when it is possible(example wait time is less than 0.2 or it is in the end of a trigger)
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
Now that I think about it the loop is unnecessary.
Do everything in the 'pick up'
P.s. First Trigger does not Leak!
I just ran out of nerves to wait to open the other one(my isp is killing me for no particular reason).
 
Level 9
Joined
Oct 24, 2007
Messages
421
Like I said initially, I posted this due to a group of questions about a system, I wasn't sure how faulty the system was but some of the points made helped me fix it, so thanks guys. If this isn't required I'm not worried if a moderator would rather get rid of the topic, the original spawning tutorial was moreso made for an AOS rather than an rpg, I did check it. The rpg tutorial used region spawns, which are much less effective than positional spawns.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
The only problem about this "system" is the second trigger(as I said - first does not leak).
It uses 90 sec wait and after that dying unit and creates a special effect that is never destroyed.
The 90 sec wait is just awful and will cause many problems.
 
Level 8
Joined
May 26, 2007
Messages
214
Heres my trigger

  • Events
    • Map initialization
  • Conditions
  • Actions
    • set temporaryInteger = 0
    • set temporary_Group = (Units in (Playable map area) owned by Neutral Hostile
    • Unit Group - Pick every unit in temporary_Group and do (Actions)
      • Loop - Actions
        • Set unitPoint[temporaryInteger] = (Position of (Picked unit))
        • Set units[temporaryInteger] = (Unit-type of (Picked unit))
        • Unit - Set the custom value of (Picked unit) to temporaryInteger
        • Set temporaryInteger = (temporaryInteger + 1)
    • Custom script: call DestroyGroup(udg_temporary_Group)
  • Events
    • Unit - A unit owned by Neutral Hostile Dies
  • Conditions
    • ((Dying unit) is Summoned) Equal to (==) False
  • Actions
    • Wait (Random real number between 45.00 and 60.00 game-time seconds
    • Unit - Create 1 units[(Custom value of (Dying unit))] for Neutral Hostile at unitPoint[(Custom value of (Dying unit))] facing Default building facing 270.0 degrees
    • Unit - Set the custom value of (Last created unit) to (Custom value of (Dying unit))
Enjoy. Oh, and for those who don't know. It will revive the unit that dies at the position it started at.
 
Last edited:
Level 29
Joined
Jul 29, 2007
Messages
5,174
It will bug. Like I've been saying in about 30 threads, Dying Unit (or CAsting Unit or Crappy Unit or anything beside Triggering Unit) bugs after waits. Well, not really bugs, but it is a freaking GLOBAL. It holds ONE UNIT. Therefore, if you kill two units (and it's quite easy to kill two units in 60 seconds) it will only revive the second one.
For god sake, use Triggering Unit already and stop this bad habit -.-

set temporary_Group = ...
Custom script: call DestroyGroup(udg_Temp_Group)


Removing the wrong group ?
 
Level 8
Joined
May 26, 2007
Messages
214
It will bug. Like I've been saying in about 30 threads, Dying Unit (or CAsting Unit or Crappy Unit or anything beside Triggering Unit) bugs after waits. Well, not really bugs, but it is a freaking GLOBAL. It holds ONE UNIT. Therefore, if you kill two units (and it's quite easy to kill two units in 60 seconds) it will only revive the second one.
For god sake, use Triggering Unit already and stop this bad habit -.-

set temporary_Group = ...
Custom script: call DestroyGroup(udg_Temp_Group)


Removing the wrong group ?

Haha, fixed. Thanks for noticing.
 
Status
Not open for further replies.
Top