• 🏆 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] Replacing melee starters with Naga

Status
Not open for further replies.
Level 6
Joined
Dec 11, 2014
Messages
93
So I wish to make a trigger that replaces the starter units (Your 5 workers and your town hall building) regardless of race with 5 mur'gul slaves and a Temple of the Tides for a fun game with my friend (Who adores Naga) and I. I had thought I figured it out, with the attached screenshot, but it doesn't work at all. I'm not the best with triggers so experimenting with this was kind of confusing for me, so I apologize if it is WAY off. I want to make player 1 and player 2 able to replace whichever race they start as when that player types -Naga into the chat, and ONLY if they type -Naga (So that way they can play as any of the original races as well, but also choose to play as Naga for a 5th race.) [In the screenshot there are two separate triggers for player 1 and player 2 called "Naga1" and "Naga2" They are the exact same trigger functions, just replacing the Player 1 parts with Player 2 for anyone wondering] Any help on how to get this trigger to work properly would be extremely appreciated! :thumbs_up:
 

Attachments

  • Naga Trigger.png
    Naga Trigger.png
    126.7 KB · Views: 128
Level 24
Joined
Aug 1, 2013
Messages
4,657
Dont loop that much times.
Instead use one loop and do an If/Then/Else for each unit type.
Also, use (Triggering player) instead.
Because you use it more than once, you set a global variable to Triggering player as the first thing and you use the variable instead.
 
Level 6
Joined
Dec 11, 2014
Messages
93
._. I hate to say this but that went totally over my head. Sorry, like I said I am really bad with triggers still. Is there any way you (or someone) could give me a visual example of what you mean? I've always been better at visuals than trying to figure out an explanation. It would be very much appreciated!
 
Last edited:
Level 19
Joined
Oct 7, 2014
Messages
2,209
I suggest using tags which is more efficient in displaying triggers.
But anyways here it is:
Just copy the if/then/else to use it to other units you want to replace.

  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) types a chat message containing -Naga as An exact match
    • Conditions
    • Actions
      • Set NagaUnits = (Units owned by Player 1 (Red))
      • Unit Group - Pick every unit in NagaUnits and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Worker-type unit
            • Then - Actions
              • Unit - Replace (Picked unit) with a Mur'gul Slave using The new unit's default life and mana
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Town-type Unit
            • Then - Actions
              • Unit - Replace (Picked unit) with a Temple of the Tides using The new unit's default life and mana
            • Else - Actions
      • Custom script: call DestroyGroup(udg_NagaUnits)
 
Level 6
Joined
Dec 11, 2014
Messages
93
Thanks, and yeah the code from above looks much neater. Unfortunately I am such a noob that I totally don't get how to use variables properly and set groups like NagaUnits ._. I only do this casually to make fun games for my friend and I to play, since we grew up playing warcraft together and we like to keep things fun and different sometimes. So I am really bad at the whole thing really. It's been years and I had only recently discovered triggers :xxd:

EDIT: I figured out how to do the variables through a few guides and I'm well on my way to matching the code posted above, but I don't know how you do the Worker-type unit or Town-type Unit things. I can only figure out how to set it to a specific unit (Ex. Peasant rather than all units classified as workers.[Worker-type unit])
 
Last edited:
Status
Not open for further replies.
Top