• 🏆 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!

What's Wrong?

Status
Not open for further replies.
Level 11
Joined
Dec 5, 2009
Messages
846
What's wrong with this trigger? you can see what i want to do. I want the Destructible to dmg when it dies.
  • Events
    • Destructible - A destructible within (Entire map) dies
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Destructible-type of (Dying destructible)) Equal to Rock Wall (Vertical)
      • Then - Actions
        • Set SW_Point = (Position of (Dying destructible))
        • Set SW_Group = (Units within ((Real((Level of Stone Wall for SW_Caster))) x 150.00) of SW_Point matching (((Matching unit) belongs to an enemy of (Owner of SW_Caster)) Equal to True))
        • Unit Group - Pick every unit in SW_Group and do (Actions)
          • Loop - Actions
            • Unit - Cause SW_Caster to damage (Picked unit), dealing ((Real((Level of Stone Wall for SW_Caster))) x 100.00) damage of attack type Spells and damage type Normal
      • Else - Actions
    • Custom script: call RemoveLocation (udg_SW_Point)
    • Custom script: call DestroyGroup (udg_SW_Group)
I detected the caster when he casted the ability in this the same trigger just skipped that part don't wanna post the whole thing,
 
Level 13
Joined
Feb 18, 2009
Messages
1,381
The "SW_Caster" variable, when were that Set?
That seems to be the only thing which i can see...
 
Level 11
Joined
Dec 5, 2009
Messages
846
Okay i do like this i send the whole thing.


This is the first one
JASS:
function Trig_Spell_Stonewall_Actions takes nothing returns nothing
   local unit u = GetSpellAbilityUnit()
   local location p1 = GetUnitLoc(u)
   local location p2 = GetSpellTargetLoc()
   local location p3
   local real r2 = DistanceBetweenPoints(p1, p2)
   local real r3 = GetUnitFacing(u)
   local real r4
   if (GetSpellAbilityId() == 'A000') then
      call CreateDestructableLoc( 'B000', p2, GetRandomDirectionDeg(), 1, 1 )
            call CreateNUnitsAtLocFacingLocBJ(1, 'h001', GetOwningPlayer(u), p2, p2)
      call UnitApplyTimedLifeBJ( 20.00, 'BTLF', GetLastCreatedUnit() )
      call GroupAddUnitSimple( GetLastCreatedUnit(), udg_SW_Save )
      set r4 = r3 + 90
      if (r4 >= 360.00) then
         set r4 = r4 - 360
      else
      endif
      set p3 = PolarProjectionBJ(p2, 100, r4)
      call CreateDestructableLoc( 'B000', p3, GetRandomDirectionDeg(), 1, 1 )
      call CreateNUnitsAtLocFacingLocBJ(1, 'h001', GetOwningPlayer(u), p3, p3)
      call UnitApplyTimedLifeBJ( 20.00, 'BTLF', GetLastCreatedUnit() )
      call GroupAddUnitSimple( GetLastCreatedUnit(), udg_SW_Save )
      call RemoveLocation(p3)
      set p3 = PolarProjectionBJ(p2, 250, r4)
      call CreateDestructableLoc( 'B000', p3, GetRandomDirectionDeg(), 1, 1 )
            call CreateNUnitsAtLocFacingLocBJ(1, 'h001', GetOwningPlayer(u), p3, p3)
      call UnitApplyTimedLifeBJ( 20.00, 'BTLF', GetLastCreatedUnit() )
      call GroupAddUnitSimple( GetLastCreatedUnit(), udg_SW_Save )
      call RemoveLocation(p3)
      set p3 = PolarProjectionBJ(p2, 400, r4)
      call CreateDestructableLoc( 'B000', p3, GetRandomDirectionDeg(), 1, 1 )
            call CreateNUnitsAtLocFacingLocBJ(1, 'h001', GetOwningPlayer(u), p3, p3)
      call UnitApplyTimedLifeBJ( 20.00, 'BTLF', GetLastCreatedUnit() )
      call GroupAddUnitSimple( GetLastCreatedUnit(), udg_SW_Save )
      call RemoveLocation(p3)
      set r4 = r3 - 90
      if (r4 <= 360.00) then
         set r4 = r4 + 360
      else
      endif
      set p3 = PolarProjectionBJ(p2, 100, r4)
      call CreateDestructableLoc( 'B000', p3, GetRandomDirectionDeg(), 1, 1 )
            call CreateNUnitsAtLocFacingLocBJ(1, 'h001', GetOwningPlayer(u), p3, p3)
      call UnitApplyTimedLifeBJ( 20.00, 'BTLF', GetLastCreatedUnit() )
      call GroupAddUnitSimple( GetLastCreatedUnit(), udg_SW_Save )
      call RemoveLocation(p3)
      set p3 = PolarProjectionBJ(p2, 250, r4)
      call CreateDestructableLoc( 'B000', p3, GetRandomDirectionDeg(), 1, 1 )
            call CreateNUnitsAtLocFacingLocBJ(1, 'h001', GetOwningPlayer(u), p3, p3)
      call UnitApplyTimedLifeBJ( 20.00, 'BTLF', GetLastCreatedUnit() )
      call GroupAddUnitSimple( GetLastCreatedUnit(), udg_SW_Save )
      call RemoveLocation(p3)
      set p3 = PolarProjectionBJ(p2, 400, r4)
      call CreateDestructableLoc( 'B000', p3, GetRandomDirectionDeg(), 1, 1 )
            call CreateNUnitsAtLocFacingLocBJ(1, 'h001', GetOwningPlayer(u), p3, p3)
      call UnitApplyTimedLifeBJ( 20.00, 'BTLF', GetLastCreatedUnit() )
      call GroupAddUnitSimple( GetLastCreatedUnit(), udg_SW_Save )
      call RemoveLocation(p3)  
   else
   endif
   call RemoveLocation(p1)
   call RemoveLocation(p2)
   set p1 = null
   set p2 = null
   set p3 = null
   set u = null
endfunction

function InitTrig_Spell_Stonewall takes nothing returns nothing
   set gg_trg_Spell_Stonewall = CreateTrigger()
   call TriggerRegisterAnyUnitEventBJ(gg_trg_Spell_Stonewall, EVENT_PLAYER_UNIT_SPELL_EFFECT)
   call TriggerAddAction(gg_trg_Spell_Stonewall, function Trig_Spell_Stonewall_Actions)
endfunction


This is the second trigger that doesn't work. (the last thing on it)
  • Spell Stonewall save and explosion
    • Events
      • Unit - A unit Finishes casting an ability
      • Destructible - A destructible within (Entire map) dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Stone Wall
        • Then - Actions
          • Set SW_Caster = (Casting unit)
          • Wait 19.80 seconds
          • Unit Group - Pick every unit in SW_Save and do (Actions)
            • Loop - Actions
              • Set SW_Points[1] = (Position of (Picked unit))
              • Destructible - Pick every destructible within 100.00 of SW_Points[1] and do (Actions)
                • Loop - Actions
                  • Destructible - Kill (Picked destructible)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Destructible-type of (Dying destructible)) Equal to Rock Wall (Vertical)
        • Then - Actions
          • Set SW_Point = (Position of (Dying destructible))
          • Set SW_Group = (Units within ((Real((Level of Stone Wall for SW_Caster))) x 150.00) of SW_Point matching (((Matching unit) belongs to an enemy of (Owner of SW_Caster)) Equal to True))
          • Unit Group - Pick every unit in SW_Group and do (Actions)
            • Loop - Actions
              • Unit - Cause SW_Caster to damage (Picked unit), dealing ((Real((Level of Stone Wall for SW_Caster))) x 100.00) damage of attack type Spells and damage type Normal
        • Else - Actions
      • Custom script: call RemoveLocation (udg_SW_Point)
      • Custom script: call RemoveLocation (udg_SW_Points[1])
      • Custom script: call DestroyGroup (udg_SW_Group)
Can you see anything? Thanks very very much for the help!
 
Level 13
Joined
Feb 18, 2009
Messages
1,381
Oh thats right. But when the ability is cast it is set, and thus, set before the destructible dies event.
 
Level 11
Joined
Dec 5, 2009
Messages
846
Yeah but i want it like this. you can also attack the destructible and the it will be blown up if it won't be attacked it will blow in 20 seconds. But if i use this one. Only the 20 seconds blow will work not the one when you attack the destructible it will blow aswell.
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240
You should wait 48 hours before bumping a thread.

So, please describe as clearly as you can what do you want the system to do.

What I've gathered so far is:

You cast the spell on a destructible. After 20 seconds it will die and units will get damaged.

If the destructible is attacked (normal attack or this spell?) during that 20 seconds it will instantly die.
 
Last edited:
Level 13
Joined
Feb 18, 2009
Messages
1,381
Maker, ain't it 48 hours?
Anyways, i think he wants someone to cast a spell, then some stones appear, and after 20 seconds thoose stone explodes dealing damage to nearby units..?
So spell/mui related?
 
Level 11
Joined
Dec 5, 2009
Messages
846
Okay im sorry for that i will wait 48 hours. You got it all wrong. When i cast the spell it appears rock chunks in a line. Like the fissure spell but without the damage just the block and different angle. The JASS trigger is perfect. But i need help with this. When one of the rock chunks are killed it will damage nearby units. The remaining rock chunks after 20 seconds blows up and deal damage to all nearby units. I hope you understand! And thank you for your respond! i really appreciate it!

NOTE: The damage and the area stands in the trigger i posted on page 1
And if you don't understand please tell me and i will try if i can to explain a bit better.

Regards Chewii
 
Last edited:
Level 14
Joined
Nov 18, 2007
Messages
1,084
  • Destructible - A destructible within (Playable map area) dies
I think that's the problem since it probably only registers it for destructables that are already on the map. (And only 64 of them will get registered too)
You'll have to find some other way of detecting when that specific destructable dies.
(You might want to use a timer.)
 
Level 11
Joined
Dec 5, 2009
Messages
846
Can you detect if a unit hasn't any destructibles in a 100 range near the unit then...

Is it such a condition?

If there is no condition then i don't know how to do this.
 
Last edited:
Level 5
Joined
Nov 22, 2009
Messages
181
isn't there that exploding barrel destructible? why not just base the destructible off of that? just change the model file, pathing map, etc.
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
For everyone that is questioning why the trigger doesn't work, refer to my post. (It's the problem with the event.)

I don't know where you're going with this, but this should work for checking if there are any destructables. (Yes, there is no default action to actually do this.)
  • Set TempLoc = (Position of (YourUnit))
  • Set TempInteger = 0
  • Destructible - Pick every destructible within 100.00 of TempLoc and do (Actions)
    • Loop - Actions
      • Set TempInteger = (TempInteger + 1)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • TempInteger Greater than 0
    • Then - Actions
      • -------- Do something here if there was at least one destructable. --------
    • Else - Actions
      • -------- Do something here if there are no destructables. --------
  • Custom script: call RemoveLocation(udg_TempLoc)
 
Level 11
Joined
Dec 5, 2009
Messages
846
Its no probs anymore i solved it myself.. If someone is interested how i did read this :)

I changed destructibles to dummy units instead and spawned some path blockers on the same position there the dummy units are. And then i picked all units near the dying unit blah blah and ofc i did a remove trigger when the unit dies he will take the nearest path blocker with him ;) Ty everyone for your tried the one who tried hardest will get + rep ;)
 
Status
Not open for further replies.
Top