• 🏆 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!

Need help respawning units from 2 different players.

Status
Not open for further replies.
Level 6
Joined
Dec 9, 2014
Messages
176
I just need a good trigger that will respawn any units belonging to player 9 and 12 3 minutes after they die. My first attempt didn't work due to other units who die overriding the previous ones and stopping them from respawning. I am trying to get this other one I found here: www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/creep-respawn-gui-65987/ to work with 2 players but it seems to either only work with 1 player or I'm not making the trigger right. If I made this trigger wrong please let me know, thanks!

  • Respawn Set
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Respawn_Time = 180.00
      • Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 9 (Gray)) and do (Actions)
        • Loop - Actions
          • Set Temp_Integer[9] = (Temp_Integer[9] + 1)
          • Unit - Set the custom value of (Picked unit) to Temp_Integer[9]
          • Set Creep_Point[Temp_Integer[9]] = (Position of (Picked unit))
      • Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 12 (Brown)) and do (Actions)
        • Loop - Actions
          • Set Temp_Integer[12] = (Temp_Integer[12] + 1)
          • Unit - Set the custom value of (Picked unit) to Temp_Integer[12]
          • Set Creep_Point[Temp_Integer[12]] = (Position of (Picked unit))
  • Respawn
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Owner of (Triggering unit)) Equal to Player 9 (Gray)
              • (Custom value of (Triggering unit)) Greater than 0
          • And - All (Conditions) are true
            • Conditions
              • (Owner of (Triggering unit)) Equal to Player 12 (Brown)
              • (Custom value of (Triggering unit)) Greater than 0
        • Then - Actions
          • Wait Respawn_Time seconds
          • Unit - Create 1 (Unit-type of (Triggering unit)) for (Owner of (Triggering unit)) at Creep_Point[(Custom value of (Triggering unit))] facing Default building facing degrees
        • Else - Actions
 
Level 11
Joined
Dec 19, 2012
Messages
411
These 2 actions,
  • Set Temp_Integer[9] = Temp_Integer[9] + 1
and
  • Set Temp_Integer[12] = Temp_Integer[12] + 1
are 2 conflict together. Imagine like this :

Temp_Integer[9] = 0
Temp_Integer[12] = 0

A unit belong to Player 9 dead, so

Temp_Integer[9] = 1
Set Creep_Point[Temp_Integer[9]] = (Position of (Picked unit)) < this unit position set into Creep_Point[1]
------------------------
Temp_Integer[12] = 0


While waiting re-spawn time, unit belong to Player 12 dead, so
Temp_Integer[9] = 1
-----------------------
Temp_Integer[12] = 1
Set Creep_Point[Temp_Integer[12]] = (Position of (Picked unit)) < this unit position again set into Creep_Point[1] and overwritten previous creep point


So you may need to combine Temp_Integer[9] and Temp_Integer[12] together, so it wont conflict.
 
Level 6
Joined
Dec 9, 2014
Messages
176

I tried the first one as it uses GUI but it seems it's not very well suited for what I'm trying to do. The unit types in my map are spread over a large area, not very suitable for a premade region which that system requires :/ I've been through so many respawn systems now and they all seem to be inadequate for what I need.

I just need a system that will respawn units for 2 players 3 minutes after they die in the same area that they started in at the start of the map. What seems like something that should be very simple is proving to be one of the most difficult triggers to make. Think of World of Warcraft's respawn system, that's basically what I need. My hero is already respawning just fine, it's the units owned by wildlife and undead that I need help with. I know nothing of Jass so I can't use systems that depend on it.

In my map I'm going to be having 1 User Player, some units owned by Neutral Passive, 1 Computer Player to control wildlife you'll find scattered throughout the wilderness, 1 computer player to handle hostile units such as NPC's that become hostile when threatened for instance, 1 Computer Player to control Undead units that will also be found in large quantities in various areas on the map, and 1 Computer Player to control bosses. The only one's I need to respawn in their respective areas are the Wildife and Undead. Sometimes many units will die before the 3 minute respawn wait is finished for a unit, I need each unit to respawn correctly at the end of their respawn delay. Oh, and no floating text saying when they are about to respawn lol
 
Hope this is what you wanted

[trigger=]
Untitled Trigger 003
Events
Map initialization
Conditions
Actions
Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) is A Hero) Equal to False)) and do (Actions)
Loop - Actions
Set indexA = (indexA + 1)
Set locationA[indexA] = (Position of (Picked unit))
Set unitA[indexA] = (Unit-type of (Picked unit))
Set facingA[indexA] = (Facing of (Picked unit))
Unit - Set the custom value of (Picked unit) to indexA
Set indexA = 0

[/trigger]


[trigger=]
Untitled Trigger 002
Events
Unit - A unit Dies
Conditions
Actions
Set indexA = (indexA + 1)
Set valueA[indexA] = (Custom value of (Triggering unit))
Set playerA[indexA] = (Owner of (Triggering unit))
Set timeA[indexA] = 2.00

[/trigger]


[trigger=]
Untitled Trigger 001
Events
Time - Every 1.00 seconds of game time
Conditions
Actions
For each (Integer loopA) from 1 to indexA, do (Actions)
Loop - Actions
Set timeA[loopA] = (timeA[loopA] - 1.00)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
timeA[loopA] Less than or equal to 0.00
Then - Actions
Unit - Create 1 unitA[valueA[loopA]] for playerA[loopA] at locationA[valueA[loopA]] facing facingA[valueA[loopA]] degrees
Unit - Set the custom value of (Last created unit) to valueA[loopA]
Set valueA[loopA] = valueA[indexA]
Set timeA[loopA] = timeA[indexA]
Set playerA[loopA] = playerA[indexA]
Set indexA = (indexA - 1)
Set loopA = (loopA - 1)
Else - Actions

[/trigger]
 

Attachments

  • RespawnA.w3x
    19.3 KB · Views: 42
Level 6
Joined
Dec 9, 2014
Messages
176
Well, out of all the systems I've tried, yours seems to be working best. I set the respawn time to 30 seconds and then killed a bunch of units before the 30 seconds were up and all units still respawned correctly, thank you so much. The only problems is that this revives all non hero units instead of units owned be specific players, but I can still work with this. I'll make the bosses heroes which should prevent them from being respawned in only 3 minutes. I'll have to work around Hostiles being respawned but all in all, your system is working, thanks!
 

sentrywiz

S

sentrywiz

This doesn't belong here. It should be moved to Triggers & Scripts because you need help with triggers not general world edit questions.

The only problems is that this revives all non hero units instead of units owned be specific players, but I can still work with this. I'll make the bosses heroes which should prevent them from being respawned in only 3 minutes. I'll have to work around Hostiles being respawned but all in all, your system is working, thanks!

To change that, simply modify the condition that Dat-C3 used when picking the units from:

  • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) is A Hero) Equal to False)) and do (Actions)
To

  • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Owner of (Matching unit)) Equal to Player 9 (Gray)) or ((Owner of (Matching unit)) Equal to Player 12 (Brown)))) and do (Actions)
    • Loop - Actions
 
Level 6
Joined
Dec 9, 2014
Messages
176
This doesn't belong here. It should be moved to Triggers & Scripts because you need help with triggers not general world edit questions.



To change that, simply modify the condition that Dat-C3 used when picking the units from:

  • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) is A Hero) Equal to False)) and do (Actions)
To

  • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Owner of (Matching unit)) Equal to Player 9 (Gray)) or ((Owner of (Matching unit)) Equal to Player 12 (Brown)))) and do (Actions)
    • Loop - Actions

Okay, awesome, thank you!
 
Status
Not open for further replies.
Top