Jump to content
Sign in to follow this  
nickk13579

On Map Click Artillery Help

Recommended Posts

I've been using the On map click Artillery by SoLo, and noticed that all units on West have the ability to use the radio to call in artillery. I want to make it so that only designated units can use the artillery, such as a team leader. What do i need to change?

Here is the arty.sqs script:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; OnMapClick Artillery v1.0

; ---------------------------

; Exit if busy

?busy and !order_fire : exit

; First Check if arty is available:

?!alive arty_unit : goto "ARTY_DEAD"

;------------------------------

;----------Begin Menu----------

;------------------------------

_radio = _this select 0

?menu == 0 : goto "RADIO0"

?menu == 1 : goto "RADIO1"

?menu == 2 : goto "RADIO2"

?menu == 3 : goto "RADIO3"

?menu == 4 : goto "RADIO4"

exit

;----------Default Menu----------

#MENU0

1 setradiomsg "Mark Target"

2 setradiomsg "null"

3 setradiomsg "null"

4 setradiomsg "null"

5 setradiomsg "null"

6 setradiomsg "null"

menu = 0

exit

#RADIO0

?_radio == "A" : goto "SET_TARGET"

exit

;----------Mark Target Menu----------

#MENU1

1 setradiomsg "Target Marked"

2 setradiomsg "Clear Target"

3 setradiomsg "null"

4 setradiomsg "null"

5 setradiomsg "null"

6 setradiomsg "null"

menu = 1

exit

#RADIO1

?_radio == "A" : goto "MENU2"

?_radio == "B" : goto "CLEAR"

exit

;----------Fire Menu----------

#MENU2

shell_type = "SHELL"

onmapsingleclick "nil"

1 setradiomsg "Single Salvo"

2 setradiomsg "Fire for Effect"

3 setradiomsg "Smoke on Target"

4 setradiomsg "Light up Target"

5 setradiomsg "Drop AT Mines"

6 setradiomsg "Clear Target"

menu = 2

exit

#RADIO2

1 setradiomsg "Stand By"

2 setradiomsg "null"

3 setradiomsg "null"

4 setradiomsg "null"

5 setradiomsg "null"

6 setradiomsg "null"

menu = nil

?_radio == "A" : goto "FIRE_SINGLE"

?_radio == "B" : goto "OPEN_FIRE"

?_radio == "C" : goto "SET_SMOKE"

?_radio == "D" : goto "SET_FLARE"

?_radio == "E" : goto "SET_MINE"

?_radio == "F" : goto "CLEAR"

exit

;----------Cease Fire Menu----------

#MENU3

1 setradiomsg "Stand By"

2 setradiomsg "null"

3 setradiomsg "null"

4 setradiomsg "null"

5 setradiomsg "null"

6 setradiomsg "null"

menu = nil

~random shell_load

arty_unit sidechat "Holding fire..."

~shell_delay

order_fire = false

exit

#RADIO3

?_radio == "A" : goto "MENU3"

exit

;----------------------------

;----------End Menu----------

;----------------------------

;----------Set Target----------

#SET_TARGET

onmapsingleclick "arty_target setmarkerpos _pos"

?order_fire : exit

goto "MENU1"

;----------Clear Target----------

#CLEAR

arty_target setmarkerpos [0,0]

goto "MENU0"

;----------Fire Single Salvo----------

#FIRE_SINGLE

busy = true

?shell_type == "SHELL" : _goto_fire = "FIRE_SHELL"

?shell_type == "MINE" : _goto_fire = "FIRE_MINE"

?shell_type == "SMOKE" : _goto_fire = "FIRE_SMOKE"

?shell_type == "FLARE" : _goto_fire = "FIRE_FLARE"

_mx = getmarkerpos arty_target select 0

_my = getmarkerpos arty_target select 1

_return = "READY_SINGLE"

goto "CHECK_AMMO"

#READY_SINGLE

~random shell_load

?shell_type == "SHELL" : arty_unit sidechat "Roger, firing single salvo..."

?shell_type == "MINE" : arty_unit sidechat "Roger, dropping mines..."

?shell_type == "SMOKE" : arty_unit sidechat "Roger, dropping smoke..."

?shell_type == "FLARE" : arty_unit sidechat "Roger, lighting up the area..."

_return = "END_SINGLE"

~shell_delay

goto _goto_fire

#END_SINGLE

busy = false

goto "MENU2"

;----------Continuous Fire----------

#OPEN_FIRE

busy = true

1 setradiomsg "Cease Fire"

2 setradiomsg "null"

3 setradiomsg "null"

4 setradiomsg "null"

5 setradiomsg "null"

6 setradiomsg "null"

menu = 3

_return = "READY_OPEN"

goto "CHECK_AMMO"

#READY_OPEN

order_fire = true

~random shell_load

arty_unit sidechat "Firing away..."

~1

arty_unit sidechat "Make target adjustments as necessary."

_return = "ARTY_LOOP"

~shell_delay

onmapsingleclick "arty_target setmarkerpos _pos"

#ARTY_LOOP

_mx = getmarkerpos arty_target select 0

_my = getmarkerpos arty_target select 1

~random shell_load

?!order_fire : goto "END_ARTY_LOOP"

goto "FIRE_SHELL"

#END_ARTY_LOOP

busy = false

goto "MENU2"

;----------Check Ammo----------

#CHECK_AMMO

?shell_type == "SHELL" : _count = count_shell; _empty = "NO_SHELL"

?shell_type == "MINE" : _count = count_mine; _empty = "NO_MINE"

?shell_type == "SMOKE" : _count = count_smoke; _empty = "NO_SMOKE"

?shell_type == "FLARE" : _count = count_flare; _empty = "NO_FLARE"

?_count < 1 : goto _empty

goto _return

;----------Fire Artillery Rounds----------

#FIRE_SHELL

_gun = arty_salvo

#SHELL_LOOP

?!alive arty_unit : goto "ARTY_DEAD"

_randx = random radius_shell

_randy = random radius_shell

_z = 50

_randz = random 2

?_randz >= 1 : _x = _mx + _randx

?_randz < 1 : _x = _mx - _randx

_randz = random 2

?_randz >= 1 : _y = _my + _randy

?_randz < 1 : _y = _my - _randy

_fire = shell createvehicle [_x,_y,_z]

count_shell = count_shell - 1

?count_shell < 1 : goto "NO_SHELL"

~random 1

_gun = _gun - 1

?_gun > 0 : goto "SHELL_LOOP"

goto _return

;----------Drop AT Mines----------

#SET_MINE

shell_type = "MINE"

goto "FIRE_SINGLE"

#FIRE_MINE

_gun = num_mine

#MINE_LOOP

?!alive arty_unit : goto "ARTY_DEAD"

_randx = random radius_mine

_randy = random radius_mine

_randz = random 2

?_randz >= 1 : _x = _mx + _randx

?_randz < 1 : _x = _mx - _randx

_randz = random 2

?_randz >= 1 : _y = _my + _randy

?_randz < 1 : _y = _my - _randy

_fire = "mine" createvehicle [_x,_y]

count_mine = count_mine - 1

?count_mine < 1 : goto "NO_MINE"

~random 1

_gun = _gun - 1

?_gun > 0 : goto "MINE_LOOP"

goto _return

;----------Fire Smoke----------

#SET_SMOKE

shell_type = "SMOKE"

goto "FIRE_SINGLE"

#FIRE_SMOKE

_gun = num_smoke

#SMOKE_LOOP

?!alive arty_unit : goto "ARTY_DEAD"

_randx = random radius_smoke

_randy = random radius_smoke

_z = 100

_randz = random 2

?_randz >= 1 : _x = _mx + _randx

?_randz < 1 : _x = _mx - _randx

_randz = random 2

?_randz >= 1 : _y = _my + _randy

?_randz < 1 : _y = _my - _randy

_fire = smoke_type createvehicle [_x,_y,_z]

count_smoke = count_smoke - 1

?count_smoke < 1 : goto "NO_SMOKE"

~random 1

_gun = _gun - 1

?_gun > 0 : goto "SMOKE_LOOP"

goto _return

;----------Fire Flare----------

#SET_FLARE

shell_type = "FLARE"

goto "FIRE_SINGLE"

#FIRE_FLARE

_gun = num_flare

#FLARE_LOOP

?!alive arty_unit : goto "ARTY_DEAD"

_randx = random radius_flare

_randy = random radius_flare

_z = 150

_randz = random 2

?_randz >= 1 : _x = _mx + _randx

?_randz < 1 : _x = _mx - _randx

_randz = random 2

?_randz >= 1 : _y = _my + _randy

?_randz < 1 : _y = _my - _randy

_fire = flare_type createvehicle [_x,_y,_z]

count_flare = count_flare - 1

?count_flare < 1 : goto "NO_FLARE"

~random 1

_gun = _gun - 1

?_gun > 0 : goto "FLARE_LOOP"

goto _return

;----------Out of Shell Ammo----------

#NO_SHELL

~random shell_load

arty_unit sidechat "All ammo depleted!"

busy = false

order_fire = false

goto "MENU2"

;----------Out of AT Mine's----------

#NO_MINE

~random shell_load

arty_unit sidechat "All mines have been droped!"

busy = false

goto "MENU2"

;----------Out of Smoke----------

#NO_SMOKE

~random shell_load

arty_unit sidechat "All smoke shells depleted!"

busy = false

goto "MENU2"

;----------Out of Flare's----------

#NO_FLARE

~random shell_load

arty_unit sidechat "All flares depleted!"

busy = false

goto "MENU2"

;----------Arty is Dead----------

#ARTY_DEAD

1 setradiomsg "null"

2 setradiomsg "null"

3 setradiomsg "null"

4 setradiomsg "null"

5 setradiomsg "null"

6 setradiomsg "null"

menu = nil

onmapsingleclick "nil"

exit

Share this post


Link to post
Share on other sites
setRadioMsg can be used to prevent specific units from activating radio triggers.

Share this post


Link to post
Share on other sites

I have also question concerning this script:

I made MP mission with this and it seems that artillery strikes x many times as there are players even only 1 player activates it. So how can i prevent that so it only activates once?

Share this post


Link to post
Share on other sites

I have not noticed that.. Maybe i should check it out. You can probably get into the script and change it.

Share this post


Link to post
Share on other sites

It sounds like the script is being executed on all clients, since it appears the artillery is called by radio triggers. You need to make sure the part of the script that uses createVehicle is only executed on the server.

I made an artillery command dialog for 1.05, I should finish it.

Share this post


Link to post
Share on other sites

I know I know!!!

Finally lol i know something, ok....

make a sqs, call it radiocheck or something, then into it put:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?(name player) == (name Moore): Goto "OKPLAYER"

;clear for all others

1 setradiomsg "NULL"

2 setradiomsg "NULL"

3 setradiomsg "NULL"

4 setradiomsg "NULL"

5 setradiomsg "NULL"

6 setradiomsg "NULL"

7 setradiomsg "NULL"

8 setradiomsg "NULL"

exit

#OKPLAYER

1 setradiomsg "Broken Arrow"

2 setradiomsg "Broken Arrow"

3 setradiomsg "Broken Arrow"

In the example above it's so Colonel Moore is the only guy able to call a Broken arrow. Change so it fits

Share this post


Link to post
Share on other sites

tried all sorts of ways.. i dont think putting it in a seperate script will work because i have a feeling they will conflict. Is there any way to put what you have given me into the script above, so that it checks if the player is "x" and then allows it to move forward?

Share this post


Link to post
Share on other sites

here is how I do it...in your init.sqs use 1 setradiomsg "null".

Then make a trigger, and using groups (F2), group the trigger to the group leader. Then inside the trigger, set the activation to "Group Leader", in the on activation use 1 setradiomsg "call my script". Then make another trigger, activation Radio Alpha, on activation [] exec "myscript.sqs"

Hope this helps.............

All works fine for me, except I have a west and an east set up as described, with east on radio bravo...problem is both the east and the west squad leaders see and can activate both radios...any ideas about that?

I use it with Mr. Murrays arty script and have no other problems

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×