• 🏆 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] -name Trigger and -replace Trigger...

Status
Not open for further replies.
Level 13
Joined
Apr 15, 2008
Messages
854
Alright, I'm not that g---... I can't trigger. Happy?

I want some triggers that should look like:

A player types: "-name <Name>" and then if he types ":Hello!" You get:
Squidle: Hello!

How to do thiez?

  • Name Set
    • Events
      • Player - Player 1 (Red) types a chat message containing -name as A substring
    • Conditions
    • Actions
      • Set UnitName = (Entered chat string)
  • Action
    • Events
      • Player - Player 1 (Red) types a chat message containing : as A substring
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (|cffffcc00 + (UnitName + (|r + (Entered chat string))))
Second Trigger

A player types: "-replace <New Unit's name>", for example... I selected a Footman and want him to be replaced with a grunt, then I type: "-replace grunt"

  • Select Set
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
    • Actions
      • Set S_Unit = (Triggering unit)
  • Action
    • Events
      • Player - Player 1 (Red) types a chat message containing -replace as A substring
    • Conditions
    • Actions
      • Unit - Replace S_Unit with a Grunt using The old unit's relative life and mana
They both don't work and... I just can't trigger...
 
Level 4
Joined
Dec 9, 2008
Messages
52
You're on the right track. You just haven't done all the work. This trigger isn't what you want, but it shows you how to do what you want.
  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) types a chat message containing -replace as A substring
    • Conditions
    • Actions
      • Unit - Create 1 (Unit-type((Substring((Entered chat string), 10, 999)))) for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
The key part of this is that you determine the unit's name based on a substring of whatever was chatted. So letters 10 through whatever of the chat are what determine the unit's type.
 
Level 13
Joined
Apr 15, 2008
Messages
854
Cool it works, thanks ;)
But I still need that first trigger, that Name trigger thingy.

Oh, and this is how my Create 'n Replace triggers lookz like.
Is there a way to make it even easier, or is this the best way?

  • Replace
    • Events
      • Player - Player 1 (Red) types a chat message containing -replace as A substring
    • Conditions
    • Actions
      • Unit - Replace Selectunit with a (Unit-type((Substring((Entered chat string), 10, 999)))) using The new unit's max life and mana
      • Selection - Select Selectunit for Player 1 (Red)
  • Select
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
    • Actions
      • Set Selectunit = (Triggering unit)
  • Create
    • Events
      • Player - Player 1 (Red) types a chat message containing -create as A substring
    • Conditions
    • Actions
      • Unit - Create 1 (Unit-type((Substring((Entered chat string), 10, 999)))) for Player 1 (Red) at (Position of The_Spawner <gen>) facing 270.00 degrees
 
Level 12
Joined
Jul 27, 2008
Messages
1,181
  • Replace
    • Events
      • Player - Player 1 (Red) types a chat message containing -replace as A substring
    • Conditions
    • Actions
      • Unit - Replace Selectunit with a (Unit-type((Substring((Entered chat string), 10, 999)))) using The new unit's max life and mana
      • Selection - Select Selectunit for Player 1 (Red)
Replace 999 with: Entered chat string length.
  • Create
    • Events
      • Player - Player 1 (Red) types a chat message containing -create as A substring
    • Conditions
    • Actions
      • Unit - Create 1 (Unit-type((Substring((Entered chat string), 10, 999)))) for Player 1 (Red) at (Position of The_Spawner <gen>) facing 270.00 degrees
Here too.
 
Level 12
Joined
May 21, 2009
Messages
994
You mean like -create 10 peasant ? If so then
  • Create units
  • Events
    • Player - Player 1 Red types a chat message containing -create as a substring
  • Conditions
  • Actions
    • Unit - Create (substring 8, 11 units of type substring 11, 999
then i think you can create 1-10 of the entered unit types name. Not sure since i dont got warcraft III on this computer
 
Last edited:
Status
Not open for further replies.
Top