A more realistic shell hit.

Zanderist

New Member
Reaction score
5
How can I cause a crater to form (terrain deformation wise) when the shell fired from a cannon tower strikes the ground?
 

Zanderist

New Member
Reaction score
5
I know that, but I want it to occur when the shell hits the ground.

If I set it to create crater at targeted point, it will be created before the shell hits. (this is just going off of running it through my head)

I came up with this

Trigger:
  • Craters
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Cannon Tower
    • Actions
      • Environment - Create a 0.50 second Permanent crater deformation at (Target point of issued order) with radius 3.00 and depth 1.00


But it makes the crater before it hits
 

Sevion

The DIY Ninja
Reaction score
413
Create a dummy at the target point with 99999999 hp, locust, and no model. When the unit is damaged by the tank or whatever, create the crater.
 

Zanderist

New Member
Reaction score
5
I came up with this.

Trigger:
  • Craters
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Cannon Tower
    • Actions
      • Set Distance = (Distance between (Position of (Triggering unit)) and (Target point of issued order))
      • Wait (Distance / 1000.00) seconds
      • Environment - Create a 0.50 second Permanent crater deformation at (Target point of issued order) with radius 250.00 and depth 32.00
      • Unit - Order (Triggering unit) to Stop



However, it is creating a crater right in the middle of the map too.
 

Sevion

The DIY Ninja
Reaction score
413
Hold on, let me write something up. I'll have to write it in JASS though. I don't have WE.
 

Zanderist

New Member
Reaction score
5
I am also trying to randomize where the cannons(8 of them) fire at but they all aim at the same point.

Before I was able to do it, but it leaked.

This was my attempt to keep it random:

Trigger:
  • Cannon Towers Fire Randomly
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
      • ArrtyRequest Equal to 1
    • Actions
      • Unit Group - Pick every unit in Cannons and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack Ground Target_Point
      • Custom script: call RemoveLocation ( udg_Target_Point )

Then I had this changing the point.
Trigger:
  • Keeping it Random
    • Events
      • Time - Every 0.40 seconds of game time
    • Conditions
    • Actions
      • Set Target_Point = (Random point in Firing for Effect <gen>)



And then to top it all off the craters still don't appear were the point of impact is.
 

Sevion

The DIY Ninja
Reaction score
413
Here's something for the terrain ripples. However, I don't know if it works. It's been ages since I coded.

JASS:
scope Shells initializer Init
    globals
        // CONFIGURABLE
        private constant integer UnitID = 'AAAA'
        private constant integer DummyID = 'BBBB'
        private constant player  DummyPlayer = Player(11)
        private constant real    Radius = 200
        private constant real    Depth = 100
        private constant integer Duration = 3
        private constant integer Count = 3
        private constant real    SpaceWaves = 1
        private constant real    TimeWaves = 1
        private constant real    RadiusStartPct = 1
        private constant boolean LimitNeg = true
        // NONCONFIGURABLE
        private group dummies = CreateGroup()
        private trigger Damage = CreateTrigger()
    endglobals
    
    private function Ripple takes nothing returns boolean
        if (GetUnitTypeId(GetEventDamageSource()) == UnitID) then
            call TerrainDeformRipple(GetUnitX(GetFilterUnit()), GetUnitY(GetFilterUnit()), Radius, Depth, Duration, Count, SpaceWaves, TimeWaves, RadiusStartPct, LimitNeg))
            call GroupRemoveUnit(dummies, GetFilterUnit())
            call RemoveUnit(GetFilterUnit())
        endif
        return false
    endfunction
    
    private function Ordered takes nothing returns boolean
        local unit dummy
        if (GetUnitTypeId(GetFilterUnit()) == UnitID)) then
            set dummy = CreateUnit(DummyPlayer, DummyID, GetOrderPointX(), GetOrderPointY(), 0)
            call GroupAddUnit(dummies, dummy)
            call TriggerRegisterUnitEvent(Damage, dummy, EVENT_UNIT_DAMAGED)
            set dummy = null
        endif
        return false
    endfunction
    
    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer i = 11
        loop
            call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_ISSUED_ORDER, True)
            set i = i - 1
            exitwhen i == -1
        endloop
        call TriggerAddCondition(t, Filter(function Ordered))
        call TriggerAddCondition(Damage, Filter(function Ripple))
        set t = null
    endfunction
endscope


For the random thing:

Trigger:
  • Cannon Towers Fire Randomly
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
      • ArrtyRequest Equal to 1
    • Actions
      • Unit Group - Pick every unit in Cannons and do (Actions)
        • Loop - Actions
          • Set Target_Point = (Random point in Firing for Effect <gen>)
          • Unit - Order (Picked unit) to Attack Ground Target_Point
          • Custom script: call RemoveLocation ( udg_Target_Point )


That SHOULD work. Also, make sure towers have the Attack Ground ability. They should get that ability if they are set to Siege attack type. I think.
 

Zanderist

New Member
Reaction score
5
I have another problem of the craters just getting deeper and deeper, which just looks funny.
 
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