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

[Trigger] Need some easy help.

Status
Not open for further replies.
Level 6
Joined
Apr 24, 2008
Messages
174
I have some questions.
All good answers that solves my questions will be given +rep.
But I will need the triggers in
  • codes and good descriptions.
  • Question 1: How do you use numbers in chat to trigger some actions?
  • For an example, if a player types "add gold 9384", he will get 9384 gold. How can this be done?
  • Question 2: How do you make a "nova" spell?
  • For an example, when a hero uses the spell, dummy units will spawn and move out away from the hero and damage nearby enemies. How do you make such trigger?
  • These are really nooby questions I know, I know quite alot about GUI but I sort of cant figgure this out... Do you move the dummys instandly to locations and change that location for each time it moves or what?
  • Thanks!
 
Level 9
Joined
May 27, 2006
Messages
498
Question 1:
You have to use substring to do that. Like in the example below;
  • Events
    • Player - Player red enters chat string containing "-add gold " as substring
  • Conditions
  • Actions
    • Set integer_gold = Substring((Entered Chat string), 11, 16)
    • Player - Add gold to (Triggering player)'s current gold
11 is number of characters in string "-add gold ", 16 is the end of the string.

Question 2:
You need to make a movement trigger, ie. every 0.04 move dummies to calculated location. This can be done this way:
  • Events
    • Unit - A unit starts effect of an ability
  • Conditions
    • (Ability being cast) equal to your_nova_ability
  • Actions
    • Set Caster = Triggering unit
    • For each (Integer A) from 1 to 6 do Actions:
      • Set temp_point = Position of (Triggering Unit)
      • Unit - Create 1 dummy at temp_point facing 0 degrees
      • Set dummy_unit[(Integer A)] = (Last Created unit)
      • Custom script: call RemoveLocation(udg_temp_point)
    • Trigger - Enable Movement trigger <gen>
  • Movement trigger
  • Events
    • Time - Every 0.04 seconds
  • Conditions
  • Actions
    • If dummy_unit[1] equal to (No unit)
      • If - Then actions
        • Trigger - Disable (This trigger)
      • If - Else actions
        • Set loop_counter = loop_counter + 1
        • For each (Integer A) from 1 to 6 do Actions:
          • Set temp_point = Position of Caster
          • Set temp_point2 = temp_point offset by 5 towards ((Integer A)*60) degrees
          • Unit - Move dummy_unit[(Integer A)] instantly to temp_point2
          • Custom script: call RemoveLocation(udg_temp_point)
          • Custom script: call RemoveLocation(udg_temp_point2)
          • If loop_counter Greater than or equal to 50
            • If - Then actions
              • Unit - Kill dummy_unit[(Integer A)]
              • Trigger - Disable (This trigger)
              • Set loop_counter = 0
 
Status
Not open for further replies.
Top