• 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] Random Shock Trigger not working?

Status
Not open for further replies.
Level 23
Joined
Oct 20, 2012
Messages
3,075
Okay, so i'm working on a trigger for a trap (well, kind of a trap) and I don't know why it's not working.. The dummy doesn't cast finger of death on the target even if the dummy is complete (has life, has mana, has the ablity(the ability has no mana cost, no casting time, etc)) It would be great if you guys could point out what I missed or did wrong... and BTW, it was supposed to: has 25% chance Use finger of death on every unit in the region, then wait 5 seconds(or so so) so that it cvould cast again..

attachment.php

attachment.php

attachment.php
 

Attachments

  • Trig 1.JPG
    Trig 1.JPG
    32.3 KB · Views: 201
  • Trig 2.JPG
    Trig 2.JPG
    45.9 KB · Views: 194
  • Trig 3.JPG
    Trig 3.JPG
    120.2 KB · Views: 221
Level 7
Joined
Sep 9, 2007
Messages
253
instead of ordering a unit to cast a spell on multiple other units. try creating a dummy unit, give it the spell, order it to cast and then do the same for the next target in the group.

eg

  • Then - Actions
    • Set Lightning_Shock_Group_1 = (Units in LIGHTNING_SHOCK_1)
    • Unit Group - Pick every unit in Lightning_Shock_Group_1 and do (Actions)
      • Loop - Actions
        • Set TempPoint = (Position of (Picked unit))
        • Unit - Create 1 Dummy Unit for aaTempPlayer at TempPoint facing Default building facing degrees
        • Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
        • Unit - Add LightningShockAbility to (Last created unit)
        • Unit - Order (Last created unit) to Special Archimonde - Finger Of Death (Picked unit)
        • Custom script: call RemoveLocation( udg_TempPoint)
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
use Orb of Lightning, set chance to 25%, set ability to forked lightning, set forked lightning's lightning to finger of death, set cooldown to 5sec.

also. use
  • tags
 
Level 23
Joined
Oct 20, 2012
Messages
3,075
instead of ordering a unit to cast a spell on multiple other units. try creating a dummy unit, give it the spell, order it to cast and then do the same for the next target in the group.

Tried it, aaand it didn't work...

use Orb of Lightning, set chance to 25%, set ability to forked lightning, set forked lightning's lightning to finger of death, set cooldown to 5sec.

also. use
  • tags[/QUOTE]
  • doesn't OoL fire only when a unit attacks? I want the generator (dummy unit) to shock only every 5 sec but not attack.. and I also want to have a warning for the player when the next shock is (the floaty part)..
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Tried it, aaand it didn't work...



doesn't OoL fire only when a unit attacks? I want the generator (dummy unit) to shock only every 5 sec but not attack.. and I also want to have a warning for the player when the next shock is (the floaty part)..

is your dummy configured correctly? does the spell cost 0 mana?

(yeah, what i said wouldnt work, misunderstood you)
 
Level 23
Joined
Oct 20, 2012
Messages
3,075
delete the condition in trigger 1. instead of wait, use triggered counter or timer for the next wave of shock. don't use waits.

I would change that condition into less than or equal to 25 (100 was just for testing purposes).. Was gonna change it to timers but was kinda lazy.. I'll change it later :xxd:

is your dummy configured correctly? does the spell cost 0 mana?

(yeah, what i said wouldnt work, misunderstood you)

My dummy even has the max mana and the spell doesn't have any mana cost..

Show me the trigger.

  • Random Shock 1
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 25
        • Then - Actions
          • Set LightningShock_Group_1 = (Units in LIGHTNING Shock 1 <gen>)
          • Unit Group - Pick every unit in Lightning_Group_1 and do (Actions)
            • Loop - Actions
              • Set LightningShock_Target_1 = (Picked unit)
              • Set LightningShock_Point_1 = (Position of Lightning Generator 0141 <gen>)
              • Unit - Create 1 Lightning Generator Dummy for Player 12 (Brown) at LightningShock_Point_1 facing Default building facing degrees
              • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
              • Unit - Order (Last created unit) to Special Archimonde - Finger Of Death LightningShock_Target_1
              • Custom script: call RemoveLocation(udg_LightningShock_Point_1)
        • Else - Actions
 
Level 23
Joined
Oct 20, 2012
Messages
3,075
This should be made MUI because if you have more than one lightning generator the spell will not work as you expect it to work.

alright I'll try.. but while waiting for replies I tried different things for my trigger..

tried changing the event.. changing the base spell..

  • Random Shock 1
    • Events
      • Unit - A unit Is issued an order with no target
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order targeting an object
    • Conditions
    • Actions
      • Set LightningShock_Group_1 = (Units in LIGHTNING Shock 1 <gen>)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 100
          • ((Triggering unit) is in LightningShock_Group_1) Equal to True
        • Then - Actions
          • Unit Group - Pick every unit in Lightning_Group_1 and do (Actions)
            • Loop - Actions
              • Set LightningShock_Target_1 = (Picked unit)
              • Set LightningShock_Point_1 = (Position of Lightning Generator 0141 <gen>)
              • Unit - Create 1 Lightning Generator Dummy for Player 12 (Brown) at LightningShock_Point_1 facing Default building facing degrees
              • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
              • Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning LightningShock_Target_1
              • Custom script: call RemoveLocation(udg_LightningShock_Point_1)
        • Else - Actions
and just in case.. this is what i really want to do..

25% to do this ---v
attachment.php
 

Attachments

  • shocking setup.JPG
    shocking setup.JPG
    142.6 KB · Views: 160
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,243

  • Traps Init
    • Events
    • Conditions
    • Actions
      • Custom script: local region r
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Execution count of (This trigger)) Equal to 1
        • Then - Actions
          • Hashtable - Create a hashtable
          • Set TrapHash = (Last created hashtable)
          • -------- ---------------------------------------- --------
          • Set trg = TrapsActivate <gen>
          • -------- ---------------------------------------- --------
          • Set reg = Region 002 <gen>
          • Set un = Arcane Tower 0002 <gen>
          • Trigger - Run Traps Init <gen> (ignoring conditions)
          • -------- ---------------------------------------- --------
          • Set reg = Region 003 <gen>
          • Set un = Arcane Tower 0003 <gen>
          • Trigger - Run Traps Init <gen> (ignoring conditions)
          • -------- ---------------------------------------- --------
          • Set reg = Region 000 <gen>
          • Set un = Arcane Tower 0005 <gen>
          • Trigger - Run Traps Init <gen> (ignoring conditions)
          • -------- ---------------------------------------- --------
          • Set reg = Region 001 <gen>
          • Set un = Arcane Tower 0004 <gen>
          • Trigger - Run Traps Init <gen> (ignoring conditions)
          • -------- ---------------------------------------- --------
        • Else - Actions
          • Custom script: set r = CreateRegion()
          • Custom script: call RegionAddRect(r, udg_reg)
          • Custom script: call TriggerRegisterEnterRegion(udg_trg, r, null)
          • Custom script: call TriggerRegisterLeaveRegion(udg_trg, r, null) // not used, can be deleted
          • Custom script: call SaveRectHandle(udg_TrapHash , GetHandleId(r), 0, udg_reg)
          • Custom script: call SaveUnitHandle(udg_TrapHash , GetHandleId(udg_reg), 0, udg_un)
          • Custom script: call SaveRectHandle(udg_TrapHash , GetHandleId(udg_un), 0, udg_reg)
          • Custom script: set r = null

  • TrapsActivate
    • Events
    • Conditions
    • Actions
      • Custom script: set udg_un = LoadUnitHandle(udg_TrapHash , GetHandleId(LoadRectHandle(udg_TrapHash , GetHandleId(GetTriggeringRegion()) , 0)) , 0)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (un is alive) Equal to True
        • Then - Actions
          • Unit Group - Add un to TrapGrp
          • Trigger - Turn on TrapsRun <gen>
        • Else - Actions



  • TrapsRun
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in TrapGrp and do (Actions)
        • Loop - Actions
          • Set un = (Picked unit)
          • Custom script: set udg_i = GetHandleId(udg_un)
          • Custom script: set udg_i2 = LoadInteger(udg_TrapHash, udg_i, 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • i2 Equal to 0
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Random integer number between 1 and 100) Greater than or equal to 50
                • Then - Actions
                  • Custom script: set udg_reg = LoadRectHandle(udg_TrapHash, GetHandleId(udg_un), 0)
                  • Set grp = (Units in reg matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) is A structure) Equal to False)))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in grp) Not equal to 0
                    • Then - Actions
                      • Custom script: set bj_wantDestroyGroup = true
                      • Unit Group - Pick every unit in grp and do (Actions)
                        • Loop - Actions
                          • Set loc1 = (Position of un)
                          • Unit - Create 1 Dummy (Level 1) for Neutral Passive at loc1 facing Default building facing degrees
                          • Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning (Picked unit)
                          • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
                          • Custom script: call RemoveLocation(udg_loc1)
                    • Else - Actions
                      • Custom script: call SaveInteger(udg_TrapHash, udg_i, 1, 0)
                      • Unit Group - Remove un from TrapGrp
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (TrapGrp is empty) Equal to True
                        • Then - Actions
                          • Trigger - Turn off TrapsRun <gen>
                        • Else - Actions
                  • Custom script: call SaveInteger(udg_TrapHash, udg_i, 1, 5)
                • Else - Actions
            • Else - Actions
              • Custom script: call SaveInteger(udg_TrapHash, udg_i, 1, udg_i2 - 1)



In the first trigger you can assign regions to the traps.
In the third trigger, set the chance, and the cooldown time here
  • Custom script: call SaveInteger(udg_TrapHash, udg_i, 1, 5)
My trigger updates every 0.25 seconds, so the cooldown is 5*0.25 = 1.25 seconds.
 

Attachments

  • TrapRegion.w3x
    18.8 KB · Views: 59
Status
Not open for further replies.
Top