Making my spell trap spell MUI

nLike

Member
Reaction score
1
I'm trying to make my trap MUI but I'm having problems how to create it. I've read some guides but I can't really clear it up how to make it.

It's a simple trap spell. you set a unit to the ground. check for nearby enemies and if they are near trap activates dealing aoe damage for 5 seconds.

Here is what I have so far. I'm using custom value system. Hashtables don't work in my Jass New gen.

Trigger:
  • Trap
    • Events
    • Unit - A unit Starts the effect of an ability
    • Conditions
    • (Ability being cast) Equal to Trap
    • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • TrapCustomValue Less than 1000
    • Then - Actions
    • Set TrapCustomValue = (TrapCustomValue + 1)
    • Else - Actions
    • Set TrapCustomValue = 1
    • Set TrapCaster[TrapCustomValue] = (Triggering unit)
    • Set TrapPos[TrapCustomValue] = (Target point of ability being cast)
    • Unit - Create 1 HunterTrap for (Owner of TrapCaster[TrapCustomValue]) at TrapPos[TrapCustomValue] facing Default building facing degrees
    • Animation - Change (Last created unit)'s animation speed to 0.00% of its original speed
    • Unit - Set the custom value of (Last created unit) to TrapCustomValue
    • Set Trap[TrapCustomValue] = (Last created unit)
    • Set TrapMaxDuration[TrapCustomValue] = 3
    • Set TrapStartDuration[TrapCustomValue] = 0
    • Unit Group - Add (Last created unit) to TrapGroup


Trigger:
  • Trap activate
    • Events
    • Time - Every 0.50 seconds of game time
    • Conditions
    • (Number of units in TrapGroup) Greater than 0
    • Actions
    • Set TrapDamageGroup[TrapTmpInteger] = (Units within 250.00 of TrapPos[TrapCustomValue])
    • Unit Group - Pick every unit in TrapDamageGroup[TrapTmpInteger] and do (Actions)
    • Loop - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • ((Picked unit) belongs to an ally of Player 1 (Red)) Equal to False
    • Then - Actions
    • Unit - Cause TrapCaster[TrapTmpInteger] to damage circular area after 0.00 seconds of radius 250.00 at TrapPos[TrapCustomValue], dealing 20.00 damage of attack type Normal and damage type Normal
    • Unit Group - Pick every unit in TrapGroup and do (Actions)
    • Loop - Actions
    • Set TrapTmpInteger = (Custom value of (Picked unit))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • TrapStartDuration[TrapTmpInteger] Greater than or equal to TrapMaxDuration[TrapTmpInteger]
    • Then - Actions
    • Unit - Remove (Picked unit) from the game
    • Else - Actions
    • Set TrapStartDuration[TrapTmpInteger] = (TrapStartDuration[TrapTmpInteger] + 0.50)
    • Else - Actions


This 2nd trigger is kinda half work. Whatever I try to think doesn't work. Should I try to check first for. Not even sure shall I use the periodic timers or have my trap have a slow invisible attack so I check for trap to attack. Got really confused so need help :(
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
get AIDS (Advanced Indexing and Data Storage) by J4L, it gives a custom value to all units that is unique, so you can use that as the index of an array, IE:
Trigger:
  • Trap Create
    • Events
      • A unit spawns a summoned unit
    • Conditions
      • Unit type of (Summoned unit) is equal to Trap
    • Actions
      • Unit Group - Add (Summoned unit) to TrapGroup (unit group variable)


Trigger:
  • Trap Activate
    • Events
      • Every 0.5 seconds of game time
    • Conditions
    • Actions
      • Pick every unit in TrapGroup and do actions
        • Loop - Actions
          • Set TempGroup = Units in [Max trap activation range] of (Picked unit)
          • Set TempUnit = (PickedUnit)
          • Pick every unit in TempGroup and do actions
            • Loop - Actions
              • Trap damage/stun actions
          • If (Conditions), then do (Actions), else do (else Actions)
            • If (Conditions)
              • 0 is less than Number of units in TempGroup
            • Then (Actions)
              • Destroy trap or w/e you do when the trap is activated, use TempUnit as the variable holding the trap
            • Else (Actions)
          • Custom Script: call DestroyGroup(udg_TempGroup)
      • Custom Script: set udg_TempUnit = null
 

nLike

Member
Reaction score
1
What ability shall I base my trap on? What kind of summon ability could have point target
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
summon ward, demon portal, etc

summon ward is actually perfect for this, since traps are just wards on roids
 

nLike

Member
Reaction score
1
Ok here's how I made it so far. It seems to work. Every trap activates fine. It dissapears after 5 seconds but theres only one problem. Even when the trap is gone (expired) it still damages for some period.

Trigger:
  • Trap
    • Events
    • Unit - A unit Spawns a summoned unit
    • Conditions
    • (Unit-type of (Summoned unit)) Equal to HunterTrap
    • Actions
    • Game - Display to (All players) the text: Trap set
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • TrapCustomValue Less than 1000
    • Then - Actions
    • Set TrapCustomValue = (TrapCustomValue + 1)
    • Else - Actions
    • Set TrapCustomValue = 1
    • Set TrapCaster[TrapCustomValue] = (Triggering unit)
    • Set TrapPos[TrapCustomValue] = (Target point of ability being cast)
    • Animation - Change (Summoned unit)'s animation speed to 0.00% of its original speed
    • Unit - Set the custom value of (Summoned unit) to TrapCustomValue
    • Set Trap[TrapCustomValue] = (Summoned unit)
      • Unit Group - Add (Summoned unit) to TrapGroup


Trigger:
  • Trap activate
    • Events
    • Time - Every 0.50 seconds of game time
    • Conditions
    • (Number of units in TrapGroup) Greater than 0
    • Actions
    • Game - Display to (All players) the text: zamka je tu
    • Unit Group - Pick every unit in TrapGroup and do (Actions)
    • Loop - Actions
    • Set TrapTmpInteger = (Custom value of (Picked unit))
    • Unit Group - Pick every unit in (Units within 250.00 of (Position of (Picked unit))) and do (Actions)
    • Loop - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • ((Picked unit) belongs to an ally of Player 1 (Red)) Equal to False
    • ((Picked unit) is alive) Equal to True
    • Then - Actions
    • Game - Display to (All players) the text: zamka aktivirana
    • Animation - Change Trap[TrapTmpInteger]'s animation speed to 100.00% of its original speed
    • Unit - Cause Trap[TrapTmpInteger] to damage (Picked unit), dealing 20.00 damage of attack type Normal and damage type Normal
    • Special Effect - Create a special effect attached to the overhead of (Picked unit) using Objects\Spawnmodels\Human\HumanBlood\HumanBloodMortarTeam.mdl
    • Special Effect - Destroy (Last created special effect)
    • Unit - Add a 5.00 second Generic expiration timer to Trap[TrapTmpInteger]
    • Else - Actions
    • Game - Display to (All players) the text: ne radi
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
A dead unit is still part of the game until it decays. You need to make sure that the unit is removed from the game when it dies.
 

OMGOMGOMG

UMBWGMG (Unidentified Human Being.)
Reaction score
28
Correct KaerfNomekop, but you would have to remove it before it decays, as the unit is nill when it's finished decaying, but the unit will still be in the Unit Group.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top