Home   Help Search Login Register  

Author Topic: Advanced Fire Mission  (Read 3889 times)

0 Members and 1 Guest are viewing this topic.

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Advanced Fire Mission
« on: 04 Sep 2002, 17:22:16 »
ok - i downloaded snYpirs user defined marker script which also came with a smoke mission....

now - i want to convert it slightly to do the following:

1. Player asks for fire missions - mission accepted

2. Player selects user defined marker (double clicks on map)

3. Naval Artilery fires 1 red smoke shell - range finding - (at the moment its like 15)

4. Naval Artilery asks for confirmation on live rounds fire mission - to check if red smoke is in correct place to player or if any allies have wandered into fire zone.

5. Player can answer AFFIRMATIVE or NEGATIVE - available through the radio - only visible when Naval asks for confirmation.

6. Fire missions goes out - BAMN BAMN BAMN - wide spread of artilery fire

7. 2 Minute reload period - no new fire mission untill 2 mins is up

8. If radio man is killed - radio option for fire mission dissapears.


thats the jist of it.. Now looking at snYpirs script confuses me - i have a bit of scripting knowledge but this is out of my league - i dont know where to start.

the user defined marker script is this:

Code: [Select]
; user defined marker detection script v1
; by snYpir for the OFP editing center

;---------------------------------------------
; this script will constantly monitor for new user-defined markers
; it is designed to be called right at the start of a mission

; every time a new user defined marker is created:

; the global variable 'userMarker' will equal the latest marker
; the global variable 'userMarkerPos' will equal the position of the latest marker
; the global variable 'userMarkerX' will equal the X coord of latest marker
; the global variable 'userMarkerY' will equal the Y coord of latest marker
; the global variable 'userMarkerSet' will equal true.

; it is YOUR responsibility to set userMarkerSet back to false! ie in your artillery script or wherever. If you don't it doesn't matter, if the user enters a new marker then the new marker information will override the global variables

; it does not matter how many markers already exist on the map, this script will just hunt for the first user defined marker the player places, then the next etc.

; WARNING!!!! THE DELETE BUTTON IS THE ACHILE'S HEEL OF THIS SCRIPT!!!!!

; PARAMETERS: takes the number of pre-defined markers you have already set in the editor
;----------------------------------------------

; BEGIN BITS U CAN EDIT
;----------------------

; set the time between marker checks - should be between 0.25 and 1
_pause = 0.5

; time in seconds to show 'destroy' icon before the marker will disappear, default is 1
; careful, you don't want the player adding new markers while we are waiting for the
; destroy icon to disappear, so don't make this value too high
_hidedelay = 3

; the icon to display for user-defined markers
_icon = "destroy"

; END BITS U CAN EDIT
;--------------------

userMarkerPause = false
userMarkerSet = false

_nEditorMarkers = _this select 0

; this loop will run until the end of the mission
#missionLooop

;wait for a marker to be added
#loop2

;halt the script if requested
@NOT(userMarkerPause)

; find the id of what will be the next user-defined marker
_counter = _nEditorMarkers
#loop1
_markerposn = getMarkerPos format["_USER_DEFINED #0/%1",_counter]
? ((_markerposn select 0) == 0 AND (_markerposn select 1) == 0) : goto "nextmarkerspotfound"
_counter = _counter + 1
goto "loop1"

; ok so now _counter will equal the position of where a new marker will go.
#nextmarkerspotfound

; make sure another marker has not been added during the loop above
? ((_markerposn select 0) != 0 AND (_markerposn select 1) != 0) : _counter = _counter + 1

~_pause

_markerposn = getMarkerPos format["_USER_DEFINED #0/%1",_counter]
? (_markerposn select 0) == 0 AND (_markerposn select 1) == 0 : goto "loop2"

; remember the new marker information in userMarker, userMarkerPos, userMarkerPosX, userMarkerPosY
userMarker = format["_USER_DEFINED #0/%1",_counter]
userMarkerPos = _markerposn
userMarkerX = (_markerposn select 0)
userMarkerY = (_markerposn select 1)

; change markers icon
userMarker SetMarkerType _icon

; switch the userMarkerSet flag to true - it is your responsibility to switch it back to false
userMarkerSet = true

; uncomment for information about new marker to be printed to screen
;hint format["Marker %1 placed at position: (%2,%3)",_counter,userMarkerX,userMarkerY]

; short pause to allow icon to change
~_hidedelay

; hide the marker (so the player will not intentionally delete it)
userMarker SetMarkerType "empty"

; loop back up to wait for the next marker

goto "missionLooop"

and this is the smoke mission:

Code: [Select]

; smoke fire mission script version 1.0
; by snYpir

; paramters:
; ----------
; 1 - name of the leader of a US infantry squad soley for the use of this script
; 2 - number of salvos of smoke to fire

; REQUIRES usermarker.sqs to be called PRIOR to calling this script

; values u can adjust

; radius of the circle in which smoke will fall
_smokeradius = 100

; colour of smoke, can be "SmokeShell" (white smoke), "SmokeShellGreen" or "SmokeShellRed"
_colour = "SmokeShellRed"

; radio msg for when script starts ("null" for none)
_startmsg = "Send coordinates for fire mission, over"

; radio msg for when rounds are inbound ("null" for none)
_inboundmsg = "Acknowledged, smoke rounds inbound, out"

; radio msg for when fire mission is complete ("null" for none)
_endmsg = "Rounds complete, out"

; radio msg for if a smoke mission is already in progress
_smokecalledmsg = "Fire mission in progress, wait out"

; end values u can adjust





; edit beyond here at own risk




; is a script already running?

? smokecalled :  (_this select 0) SideChat _smokecalledmsg; exit

smokecalled = true

; make an array of the incoming group
_smokeArr = units group (_this select 0)

; set up squad that will be throwing smoke
"RemoveAllWeapons _x" foreach _smokeArr
_tmp = 0
#for3
(_smokeArr select _tmp) disableAI "move"
? _tmp < count _smokeArr : _tmp = _tmp + 1; goto "for3"

? _startmsg != "null" : (_this select 0) SideChat _startmsg

; wait until the player has set a user marker
userMarkerSet = false
@userMarkerSet

? _inboundmsg != "null" : (_this select 0) SideChat _inboundmsg

; number of smoke salvos to fire
_salvos = _this select 1

? _salvos == 0 : hint "Invalid number of salvos. Must be greater than 1."; exit

; remember the starting loc of the group
_startPos = GetPos (_this select 0)



; Y offset - needs to be increased if u put the shooters higher
userMarkerY = userMarkerY + 150



_salvocount = 1
#salvoloop

; slight pause
~2

"_x SetDammage 0" foreach _smokeArr

; throw smoke
_tmp = 0
#for1
(_smokeArr select _tmp) addmagazine _colour
(_smokeArr select _tmp) fire ["throw",_colour,_colour]
? _tmp < count _smokeArr : _tmp = _tmp + 1; goto "for1"

~2

_tmp = 0
#for2

; get random position in relation to userMarkerY
_randx = RANDOM 100
_tmprndx = RANDOM 10
_randy = RANDOM 100
_tmprndy = RANDOM 10
? _tmprndy < 5 : _randy = _randy * -1
? _tmprndx < 5 : _randx = _randx * -1

; set above firing point
(_smokeArr select _tmp) SetPos [userMarkerX+_randx,userMarkerY+_randy,1000]

; set random direction
(_smokeArr select _tmp) SetDir 180

? _tmp < count _smokeArr : _tmp = _tmp + 1; goto "for2"


; pause to throw smoke
~3


; BACK TO ORIGINAL LOCATION
_tmp = 0
#for4
(_smokeArr select _tmp) SetPos [(_startPos select 0),(_startPos select 1),0]
? _tmp < count _smokeArr : _tmp = _tmp + 1; goto "for4"



? _salvocount < _salvos : _salvocount = _salvocount + 1; goto "salvoloop"


? _endmsg != "null" : (_this select 0) SideChat _endmsg

smokecalled = false

its activated using an init field exec:

Code: [Select]
[0] exec "usermarker.sqs"

and a trigger radio exec (request fire mission):

Code: [Select]
[smoke,3] exec "smoke.sqs"

pleeeeeeeeeeeasse help... :help:

cheers

:thumbsup:
« Last Edit: 04 Sep 2002, 17:26:03 by Messiah »
Proud Member of the Volunteer Commando Battalion

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:Advanced Fire Mission
« Reply #1 on: 05 Sep 2002, 19:49:49 »
hmmm - is this too hard?

ive had a go myself - but as soon as i add aything the damn thing errors like crazy... aaaargh.  :-\
Proud Member of the Volunteer Commando Battalion

Gameer_77

  • Guest
Re:Advanced Fire Mission
« Reply #2 on: 05 Sep 2002, 21:34:44 »
I think people are being put off by the biiiiiiig Thread!  :o

Maybe if you told us what the script does originally then we could help you further.

 8)PEACE

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:Advanced Fire Mission
« Reply #3 on: 05 Sep 2002, 21:44:50 »
hmmmm, i see ya point.

k, well the script b asically asks you if you want a fire mission (via radio) and when u select a fire mission the script then waits for you to place a user defined marker (double clikc on the map and it adds a nice marker for ya)....

then this script cam creates lots of red smoke shells...

now i want to use this script but change what it does after u double click on the map - but thats where i fall short (what i want it to do is on first post)

any ideas?
Proud Member of the Volunteer Commando Battalion

Gameer_77

  • Guest
Re:Advanced Fire Mission
« Reply #4 on: 05 Sep 2002, 21:52:34 »
Well, everything beyond:

; wait until the player has set a user marker
userMarkerSet = false
@userMarkerSet


Is the artillery. Ill have a look just now and see what i can do.

 8) PEACE

Gameer_77

  • Guest
Re:Advanced Fire Mission
« Reply #5 on: 05 Sep 2002, 22:05:08 »
Make a new radio (A free one). In the init put:

# setradiomsg null

And the # is the number (alpha, bravo...)

in the onactivation put confirmed=1

Do the same as above with a different radio and in the onactivation put confirmed=2

Now, this is as far as i can go the now. A few Q's:

Does this script fire a barrage of smoke?

If so, does it all come down at once?

Who is the radio guy?

Thanks
« Last Edit: 05 Sep 2002, 22:20:16 by Gameer_77 »

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:Advanced Fire Mission
« Reply #6 on: 05 Sep 2002, 22:17:41 »
ok - it does fire smoke and the smoke comes down at once (unfortunatly) and the radio guy is the player.

cheers for the help
Proud Member of the Volunteer Commando Battalion

Gameer_77

  • Guest
Re:Advanced Fire Mission
« Reply #7 on: 05 Sep 2002, 22:52:54 »
Ok, ive modified it but have'nt tested it. Just paste this over the top of the script. (make a copy of the original if you want)

Code: [Select]
_colour = "SmokeShellRed"
_startmsg = "Send coordinates for fire mission, over"
_inboundmsg = "Acknowledged, smoke rounds inbound, out"
_endmsg = "Rounds complete, out"
_smokecalledmsg = "Fire mission in progress, wait out"
_confirmMsg= "Can you confirm the artillery co-ordinates?"
shelllimit= 30

? smokecalled :  (_this select 0) SideChat _smokecalledmsg; exit
smokecalled = true

_smokeArr = units group (_this select 0)
"RemoveAllWeapons _x" foreach _smokeArr


_tmp = 0
#for3
(_smokeArr select _tmp) disableAI "move"
? _tmp < count _smokeArr : _tmp = _tmp + 1; goto "for3"

? _startmsg != "null" : (_this select 0) SideChat _startmsg

; wait until the player has set a user marker
userMarkerSet = false
@userMarkerSet

? _inboundmsg != "null" : (_this select 0) SideChat _inboundmsg

_salvos = _this select 1
? _salvos == 0 : hint "Invalid number of salvos. Must be greater than 1."; exit

_startPos = GetPos (_this select 0)
userMarkerY = userMarkerY + 150

_salvocount = 1
#salvoloop

~2

"_x SetDammage 0" foreach _smokeArr

_tmp = 0
#for1
(_smokeArr select _tmp) addmagazine _colour
(_smokeArr select _tmp) fire ["throw",_colour,_colour]
? _tmp < count _smokeArr : _tmp = _tmp + 1; goto "for1"

~2

_tmp = 0
#for2

_randx = RANDOM 100
_tmprndx = RANDOM 10
_randy = RANDOM 100
_tmprndy = RANDOM 10
? _tmprndy < 5 : _randy = _randy * -1
? _tmprndx < 5 : _randx = _randx * -1


(_smokeArr select _tmp) SetPos [userMarkerX+_randx,userMarkerY+_randy,1000]

(_smokeArr select _tmp) SetDir 180


? _tmp < count _smokeArr : _tmp = _tmp + 1; goto "for2"

~3

_tmp = 0
#for4
(_smokeArr select _tmp) SetPos [(_startPos select 0),(_startPos select 1),0]
? _tmp < count _smokeArr : _tmp = _tmp + 1; goto "for4"


? _salvocount < _salvos : _salvocount = _salvocount + 1; goto "salvoloop"

? _endmsg != "null" : (_this select 0) SideChat _Confirmmsg

1 setradiomsg "Affirmative"
2 setradiomsg "Negative"

#for5
? confirmed=="1":goto "Barrage"
? confirmed=="2":goto "Retry"
~0.5
goto "for5"

#retry

player sidechat "Negative base, attempting to relay new co-ordinates to you."

smokecalled=false

exit

;AT THIS POINT RE-MARK THE MAP AND RADIO AGAIN!
#Barrage

shellssofar=0

#for6
_shel= "shell120" CamCreate [userMarkerX + (random 40), userMarkerY + (random 40), 400]

shellssofar=shellssofar + 1

?shellssofar>=shelllimit: (_this select 0) SideChat _Endmsg;goto "delay"

~Random 3

goto "for6"

#delay

~120

smokecalled=false

Things you can edit:

_confirmMsg= "Can you confirm the artillery co-ordinates?"
shelllimit= 30

Shelllimit is the amount of artillery shells you want. Confirmmsg is the message said when the radio guy asks to confirm the pos of the smoke thing.

Now, i don't know how many smoke things drop for you, is it just one?

Anyway, guidelines:

Make two new radio triggers:

One of them will be the "affirmative" and one will be "negative". (put them in this order ie. radiomsg 3= affirmative and 4=negative)

Now in the script where it says:

1 setradiomsg "Affirmative"
2 setradiomsg "Negative"

Change the numbers to the numbers of the radio and in the init.sqs put:

1 setradiomsg null
2 setradiomsg null

Again, changing it to suit the number n the radio trigger.

Anything else?

Hope not. Phew.

There will be problems i just know it but hey, we'll all help ya!

Im going now so the next time i'll see this will be tommorow so maybe someone else can help ya until then, see ya!

 8) PEACE

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:Advanced Fire Mission
« Reply #8 on: 06 Sep 2002, 00:12:17 »
ok.... actually about 15 smoke shells came down, but i'll modify to suit.... or try to... hehe

thanx thanx thanx for the help - i'll try this out tonite and the report back

:thumbsup:
Proud Member of the Volunteer Commando Battalion

Gameer_77

  • Guest
Re:Advanced Fire Mission
« Reply #9 on: 06 Sep 2002, 18:59:29 »


[attachment deleted by admin]

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:Advanced Fire Mission
« Reply #10 on: 06 Sep 2002, 19:31:58 »
aaaah, dude, you are the man  ;)

*adds gamer to his credits list*

as for the smoke... hmmm... nevermind, i'll try and look at it with some scripting buddies of mine when they get back..

cheers

:thumbsup:
Proud Member of the Volunteer Commando Battalion

Gameer_77

  • Guest
Re:Advanced Fire Mission
« Reply #11 on: 06 Sep 2002, 21:09:48 »
Cheers Matey!  :) I'll think about it and see if I can fix it. Must be that damn wind!  >:(

Gameer

 8)PEACE

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:Advanced Fire Mission
« Reply #12 on: 06 Sep 2002, 23:12:44 »
lol - tested it out and lol - well it does miss where the smoke goes  :)

so.... one more question - the artillery - how can i make the spread go over a larger area?

at the moment its to concentrated - thats some dam good artilery  ;) and also maybe slow it down?

sorry - im a dense at this  ;)
Proud Member of the Volunteer Commando Battalion

Gameer_77

  • Guest
Re:Advanced Fire Mission
« Reply #13 on: 06 Sep 2002, 23:41:17 »
hey man, good news! I figured out a way to make it work!  :D

Instead of using a guy to chuck the smoke i used camcreate so i can use that as a target for the artillery.

Ill post it up in about 10 minutes and tell you how to make it wider as its different code im going to give you.

Cheers

Gameer

 8)PEACE

Gameer_77

  • Guest
Re:Advanced Fire Mission
« Reply #14 on: 06 Sep 2002, 23:50:20 »
Ok Mate, here t'is:

Code: [Select]
_colour = "SmokeShellRed"
_startmsg = "Send coordinates for fire mission, over"
_inboundmsg = "Acknowledged, smoke rounds inbound, out"
_endmsg = "Rounds complete, out"
_smokecalledmsg = "Fire mission in progress, wait out"
_confirmMsg= "Can you confirm the artillery co-ordinates?"
_inboundArtmsg = "Acknowledged, smoke rounds inbound, out"
shelllimit= 30

? smokecalled :  (_this select 0) SideChat _smokecalledmsg; exit
smokecalled = true

_smokeArr = units group (_this select 0)
"RemoveAllWeapons _x" foreach _smokeArr


_tmp = 0
#for3
(_smokeArr select _tmp) disableAI "move"
? _tmp < count _smokeArr : _tmp = _tmp + 1; goto "for3"

? _startmsg != "null" : (_this select 0) SideChat _startmsg

; wait until the player has set a user marker
userMarkerSet = false
@userMarkerSet

? _inboundmsg != "null" : (_this select 0) SideChat _inboundmsg

_salvos = _this select 1
? _salvos == 0 : hint "Invalid number of salvos. Must be greater than 1."; exit

_startPos = GetPos (_this select 0)
userMarkerY = userMarkerY + 150

_salvocount = 1
#salvoloop

~4

_tmp = 0
#for2

_randx = RANDOM 100
_tmprndx = RANDOM 10
_randy = RANDOM 100
_tmprndy = RANDOM 10
? _tmprndy < 5 : _randy = _randy * -1
? _tmprndx < 5 : _randx = _randx * -1

_smokey= "SmokeShellRed" camCreate [userMarkerX + _randx,userMarkerY + _randy,500]

;? _tmp < count _smokeArr : _tmp = _tmp + 1; goto "for2"

~9

;? _salvocount <= _salvos : _salvocount = _salvocount + 1; goto "salvoloop"

? _endmsg != "null" : (_this select 0) SideChat _Confirmmsg

2 setradiomsg "Affirmative"
3 setradiomsg "Negative"

#for5
? confirmed==1:goto "Barrage"
? confirmed==2:goto "Retry"
~0.5
goto "for5"

#retry

player sidechat "Negative base, attempting to relay new co-ordinates to you."

Confirmed=0

2 setradiomsg "null"
3 setradiomsg "null"

smokecalled=false

exit

;AT THIS POINT RE-MARK THE MAP AND RADIO AGAIN!
#Barrage

(_this select 0) SideChat _inboundArtmsg

2 setradiomsg "null"
3 setradiomsg "null"

shellssofar=0

#for6
_shel= "shell120" CamCreate [(getpos _smokey select 0) +(random 40), (getpos _smokey select 1) + (random 40), 200]

shellssofar=shellssofar + 1

?shellssofar>=shelllimit: (_this select 0) SideChat _Endmsg;goto "delay"

~Random 3

goto "for6"

#delay

~120

smokecalled=false

Again, just copy over the top of the old one.

Now, to change the spread of the artillery, change the parts in this code to whatever (Original=40):

_shel= "shell120" CamCreate [(getpos _smokey select 0) +(random #), (getpos _smokey select 1) + (random #), 200]

Also, you can change the type of artillery shell by changing the "Shell120" bit.

For the timing change this bit (3 lines below the above code):

~Random 3

Change the 3 to whatever.

There y'a go matey.

Cheers

Gameer

 8)PEACE