• 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] about muis

Status
Not open for further replies.
Level 5
Joined
Sep 22, 2012
Messages
90
happy new year folks,

I know the concept of using muis, it is all about using skills free from errors due to spamming, owner of dummy and damage apply etc etc. I have read this stuff
(http://www.thehelper.net/threads/gui-mui-system.49919/)and decided to make my own mui spell. Its a spell in which a units comes within the area of the created wall then move them away. here's it:

  • reqwallinit
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to /req_wall
    • Actions
      • Set forcewall_init_loc = (Position of (Casting unit))
      • Set forcewall_angle_init = (Facing of (Casting unit))
      • Set forcewall_target_loc = (forcewall_init_loc offset by -300.00 towards forcewall_angle_init degrees)
      • For each (Integer forcewall_init_cycle) from -3 to 3, do (Actions)
        • Loop - Actions
          • Set forcewall_index = (forcewall_index + 1)
          • Set forcewall_create_angle = (((Real(forcewall_init_cycle)) x 4.65) + forcewall_angle_init)
          • Set forcewall_create_loc = (forcewall_target_loc offset by 600.00 towards forcewall_create_angle degrees)
          • Set forcewall_duration[forcewall_index] = 0.00
          • Unit - Create 1 _req_force for (Owner of (Casting unit)) at forcewall_create_loc facing Default building facing degrees
          • Unit - Set the custom value of (Last created unit) to forcewall_index
          • Unit Group - Add (Last created unit) to forcewall_walls
          • Custom script: call RemoveLocation(udg_forcewall_create_loc)
          • Set forcewall_create_angle = 0.00
      • Custom script: call RemoveLocation(udg_forcewall_target_loc)
      • Set forcewall_angle_init = 0.00
      • Custom script: call RemoveLocation(udg_forcewall_init_loc)
      • Trigger - Turn on reqwallloop <gen>
  • reqwallloop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in forcewall_walls and do (Actions)
        • Loop - Actions
          • Set forcewall_cur_wall = (Picked unit)
          • Set forcewall_primer = (Custom value of forcewall_cur_wall)
          • Set forcewall_cur_wall_loc = (Position of forcewall_cur_wall)
          • Set forcewall_duration[forcewall_primer] = (forcewall_duration[forcewall_primer] + 0.03)
          • Set forcewall_cur_targets_grp = (Units within 60.00 of forcewall_cur_wall_loc)
          • Unit Group - Pick every unit in forcewall_cur_targets_grp and do (Actions)
            • Loop - Actions
              • Set forcewall_cur_target = (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (forcewall_cur_target belongs to an enemy of (Owner of forcewall_cur_wall)) Equal to True
                  • (forcewall_cur_target is alive) Equal to True
                  • (forcewall_cur_target is A structure) Not equal to True
                • Then - Actions
                  • Set forcewall_cur_target_loc = (Position of forcewall_cur_target)
                  • Set forcewall_target_angle = (Angle from forcewall_cur_wall_loc to forcewall_cur_target_loc)
                  • Set forcewall_cur_target_to_loc = (forcewall_cur_target_loc offset by 5.00 towards forcewall_target_angle degrees)
                  • Unit - Move forcewall_cur_target instantly to forcewall_cur_target_to_loc
                  • Custom script: call RemoveLocation(udg_forcewall_cur_target_to_loc)
                  • Set forcewall_target_angle = 0.00
                  • Custom script: call RemoveLocation(udg_forcewall_cur_target_loc)
                • Else - Actions
              • Custom script: set udg_forcewall_cur_target = null
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • forcewall_duration[forcewall_primer] Greater than or equal to 5.00
            • Then - Actions
              • Unit - Add a 0.01 second Generic expiration timer to forcewall_cur_wall
              • Unit Group - Remove forcewall_cur_wall from forcewall_walls
            • Else - Actions
          • Custom script: call DestroyGroup (udg_forcewall_cur_targets_grp)
          • Custom script: call RemoveLocation(udg_forcewall_cur_wall_loc)
          • Custom script: set udg_forcewall_cur_wall = null
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in forcewall_walls) Equal to 0
        • Then - Actions
          • Game - Display to (All players) the text: wall sucess end
          • Set forcewall_index = 0
          • Set forcewall_primer = 0
          • Trigger - Turn off (This trigger)
        • Else - Actions
is this custom value type of indexing safe? I also wanted to know more of how would a certain indexer fail in terms of spamming spells etc etc.

reference spell: elune arrow
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,243
As general recommendations, share variables between triggers as much as you can. For example, you don't need "forcewall_cur_wall_loc", use "forcewall_init_loc" instead. There is no need for separate global variables for each spell. I use loc1, loc2, loc3.. and share them with all abilities.

Do this only after ypu remove a unit from group, not during every loop:
(Number of units in forcewall_walls) Equal to 0

And like Almia said, using custom values in not a good way of indexing. The only system that should use custom values is a unit indexer. If everybody used custom value for their spells and systems, none of them worked correclty.

Hahtables are also a good method of making MUI spells.
 
Status
Not open for further replies.
Top