Mortar Auto Fire Trigger Not Working

dannyboydude

Ultra Cool Member
Reaction score
33
Well why doesnt this trigger work ?

Code:
Mortar 360 Attack
    Events
        Time - Every 0.50 seconds of game time
    Conditions
    Actions
        Set MortarGroup = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Mortar Team))
        Unit Group - Pick every unit in MortarGroup and do (Actions)
            Loop - Actions
                Set P = ((Position of (Picked unit)) offset by 175.00 towards (Real(CV)) degrees)
                Set CV = (Custom value of (Picked unit))
                Unit - Order (Picked unit) to Attack Ground P
                Unit - Set the custom value of (Picked unit) to CV
                Set CV = (CV + 20)
                Custom script:   call RemoveLocation ( udg_P )
        Custom script:   call DestroyGroup ( udg_MortarGroup )

I just wanted a simple trigger for my map and it wont work
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
hm i dunno why it doesnt work, maybe the range is not enough but i encountered some bugs:

Code:
Mortar 360 Attack
    Events
        Time - Every 0.50 seconds of game time
    Conditions
    Actions
        Set MortarGroup = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Mortar Team))
        Unit Group - Pick every unit in MortarGroup and do (Actions)
            Loop - Actions
                [B]Set P = ((Position of (Picked unit)) offset by 175.00 towards (Real(CV)) degrees)[/B] [COLOR="Red"]([This does leak, you will need 2 point variables 1 additional for the position of the picked unit!)/COLOR]
               [B] Set CV = (Custom value of (Picked unit))[/B] [COLOR="Red"](as far as i see this variable got to be set before the upper action)[/COLOR]
                Unit - Order (Picked unit) to Attack Ground P [COLOR="Red"](Are you sure it got artillery attack? enough range? enough aquisation range?)[/COLOR]
                [B]Unit - Set the custom value of (Picked unit) to CV[/B] [COLOR="Red"](This action is useless because CV is the same value as the custom value of your unit Oo [look above!])[/COLOR]
                Set CV = (CV + 20)
                Custom script:   call RemoveLocation ( udg_P )
        Custom script:   call DestroyGroup ( udg_MortarGroup )
 

Romek

Super Moderator
Reaction score
963
Is 0.5 seconds enough for the mortar teams to attack?

Try changing the mortar teams Cooldown and how quickly they attack.

Edit:
Also, CV isn't increasing.

For examples sake, lets say the Custom value of a unit is 20.
Code:
       Set CV = (Custom value of (Picked unit)) << So CV is now 20
                Unit - Order (Picked unit) to Attack Ground P
                Unit - Set the custom value of (Picked unit) to CV << They're both 20 still...
                Set CV = (CV + 20) << You increased the variable. But you're going to make it the Custom value again. Which is still 20.
 

dannyboydude

Ultra Cool Member
Reaction score
33
Hmm i realy dont know , the mortar has gound attack , long enough aquition
and good range .

Code:
Mortar 360 Attack
    Events
        Time - Every 0.50 seconds of game time
    Conditions
    Actions
        Set MortarGroup = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Mortar Team))
        Unit Group - Pick every unit in MortarGroup and do (Actions)
            Loop - Actions
                Set CV = (Custom value of (Picked unit)) // sets the CV to units custom value 
                Set P = ((Position of (Picked unit)) offset by 175.00 towards (Real(CV)) degrees)
                Unit - Order (Picked unit) to Attack Ground P
                Unit - Set the custom value of (Picked unit) to CV // sets the units custom value to CV the secnd time running and more , so i can re get the angle at which to fire at 
                Set CV = (CV + 20)
                Custom script:   call RemoveLocation ( udg_P )
        Custom script:   call DestroyGroup ( udg_MortarGroup )
 

Nina

New Member
Reaction score
8
for the CV thing you're setting it at what it's allready at I think you mean you want the cv+20 to be set as the units custom value, put the set cv = (cv +20) action above unit-set custom...
 

dannyboydude

Ultra Cool Member
Reaction score
33
Ok i changed it got rid of the useless CV thing lol

Heres the new code
Code:
Mortar 360 Attack
    Events
        Time - Every 1.50 seconds of game time
    Conditions
    Actions
        Set MortarGroup = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Mortar Team))
        Unit Group - Pick every unit in MortarGroup and do (Actions)
            Loop - Actions
                Set P = ((Position of (Picked unit)) offset by 400.00 towards (Real((Custom value of (Picked unit)))) degrees)
                Unit - Order (Picked unit) to Attack Ground P
                Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) + 20)
                Custom script:   call RemoveLocation ( udg_P )
        Custom script:   call DestroyGroup ( udg_MortarGroup )

But if iput the periodic any less it doesnt fire it missles
And in some games like maze makers you can create mortars that fire rapidly in a circle
 

Romek

Super Moderator
Reaction score
963
As I said, You should lower their cooldown.
 

dannyboydude

Ultra Cool Member
Reaction score
33
there cool down is 0.01
and when the periodic is on 1 they use there fire animation but nothing shows up

Any solution?
 

Romek

Super Moderator
Reaction score
963
Shorten the animation Backswing (I think that's the one)
It's the time it takes for a projectile to fire.
 

dannyboydude

Ultra Cool Member
Reaction score
33
Changed the back swing and a few others and it works like a charm at 0.4 periodic

Thanks everyone

+rep if i can
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top