Home   Help Search Login Register  

Author Topic: OFPR, Reaper's Artillery Script v2.0  (Read 1908 times)

0 Members and 1 Guest are viewing this topic.

Offline GoldGazelle

  • Members
  • *
  • Knowledge can be taught. Wisdom can not.
OFPR, Reaper's Artillery Script v2.0
« on: 26 Apr 2010, 09:15:07 »
Hello anyone or every one,

      First of all I'd just like to mention that I am a new member to this forum and that i would like to thank, ahead of time, anyone than can offer up any helpful tips to my dilemma. I have just recently started what I like to call serious scripting and would be very grateful if any someone could help me out

      I have been playing around with Reaper's Artillery Script v2.0, which is a very excellent script in its self, but I want to make it even better (if it is even possible). I am trying to create a number of radio menus that will allow the unit to have more than one shell_type at there disposal and have two different target radius' (tight spread, loose spread) for each shell_type (three to be exact: 73mm, 105mm and 125mm)
       All my menus seam to work fine (all in order and work together) but when I send the final radio transmission...

       "Fire 10-rnd Salvo"...

I get my...

        arty_unit sidechat "Coordinates received for Howitzer fire mission with Tight spread. Commencing fire mission..."...

confirmation from the arty_unit then the time ticks by for the shell_delay and I get the...

#NO_SHELL "All ammo depleted!"...

 confirmation.

      I am assuming that there is a problem with the #CHECK_AMMO part of the script or it just is not possible to put in more than one shell_type. Thank you to anyone who can serve up there thoughts on this problem. I can send anyone the arty_script.sqs and arty_options.sqs files that I have created if it would help. I will paste the arty_options.sqs here any way so you all can have a look.

Thank you for your time,
GoldGazelle    

PS I omitted the mine drop (just didn't need it) and with my whole setup, even though the shells won't fire, the smoke and flares still work (if that helps)

Code: [Select]
;---------------------------------
;----------Begin Options----------
;---------------------------------

; Name of a friendly unit that represents your arty (used for radio messages):
; Tip: Kill this unit in your mission to disable arty support at any time.
arty_unit = arty

; The name of the marker used to aim the shells (must be in quotes):
arty_target = "target"

; The number of simulated guns:
arty_salvo = 10
arty_salvo_5 = 15
arty_salvo1 = 10
arty_salvo1_5 = 15
arty_salvo2 = 10
arty_salvo2_5 = 20

; Time for shells to travel to target:
shell_delay = 12

; Random delay between shell reloading:
shell_load = 10

; Type of round to fire (must be in quotes):
;    Shell73 = 73mm HE
;    Shell105 = 105mm HE
;    Shell120 = 120mm HE
;    Shell125 = 125mm HE
;    Laserguidedbomb = 500lb. Bomb (ARE YOU NUTS!)
shell = "125mm HE"
shell_5 = "125mm HE"
shell1 = "105mm HE"
shell1_5 = "105mm HE"
shell2 = "73mm HE"
shell2_5 = "73mm HE"

; Ammount of artillery rounds available:
count_shell = 10
count_shell_5 = 15
count_shell1 = 10
count_shell1_5 = 15
count_shell2 = 10
count_shell2_5 = 20

; Accuracy of the artillery rounds (lower number = more accurate):
radius_shell = 15
radius_shell_5 = 20
radius_shell1 = 15
radius_shell1_5 = 25
radius_shell2 = 20
radius_shell2_5 = 40

; Type of smoke shell to use (must be in quotes):
;    smokeshell = white smoke
;    smokeshellred = red smoke
;    smokeshellgreen = green smoke
smoke_type = "smokeshellred"

; Ammount of smoke shells available:
count_smoke = 10

; Accuracy for smoke rounds (lower number = more accurate):
radius_smoke = 10

; Number of smoke shells to fire at a time
; Drop single for checking aim, drop multiple for creating smoke screens (hard on FPS).
num_smoke = 1

; Type of flare to use (must be in quotes):
;    flare = white flare
;    flarered = red flare
;    flaregreen = green flare
;    flareyellow = yellow flare
flare_type = "flare"

; Ammount of flares available:
count_flare = 100

; Accuracy for flare rounds (lower number = more accurate):
radius_flare = 50

; Number of flares to drop at a time
num_flare = 5

;-------------------------------
;----------End Options----------
;-------------------------------


1 setradiomsg "Mark Target"
2 setradiomsg "null"
3 setradiomsg "null"
4 setradiomsg "null"
5 setradiomsg "null"
6 setradiomsg "null"

arty_target setmarkerpos [0,0]
order_fire = false

shell_type = "SHELL"
shell_type_5 = "SHELL_5"
shell_type1 = "SHELL1"
shell_type1_5 = "SHELL1_5"
shell_type2 = "SHELL2"
shell_type2_5 = "SHELL2_5"
menu = 0

 
« Last Edit: 29 Apr 2010, 05:51:39 by bedges »

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: OFPR, Reaper's Artillery Script v2.0
« Reply #1 on: 29 Apr 2010, 06:03:10 »
Welcome to OFPEC.  :good:

Some more information would be helpful in helping us to help you. Could you perhaps put together a quick missionette on the desert island illustrating your issue and attach it to this thread, as it's very difficult to diagnose a problem like this from one script out of (what sounds like) many.

Once again welcome.

Offline GoldGazelle

  • Members
  • *
  • Knowledge can be taught. Wisdom can not.
Re: OFPR, Reaper's Artillery Script v2.0
« Reply #2 on: 05 May 2010, 06:29:51 »
To bedges,

I have to apologize for my lack of knowledge. I can attach each individual file from my missionette except the mission.sqm file (error: can't attach that type of file). And I can't attach the entire missionette after sending it to Single Missions folder because you can't attach .pbo files to a forum posting. How shall I get the necessary files from the missionette to you (or to my forum posting)?

Thank you again for your help,

GoldGazelle


Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: OFPR, Reaper's Artillery Script v2.0
« Reply #3 on: 05 May 2010, 13:10:55 »
What you can do is zip/rar the mission folder and attach the compressed folder to the post instead.

Offline GoldGazelle

  • Members
  • *
  • Knowledge can be taught. Wisdom can not.
Re: OFPR, Reaper's Artillery Script v2.0
« Reply #4 on: 05 May 2010, 19:32:44 »
Why didn't I think of that? :D

Well here it is. It is actually a missionette on Nogova. I hope that it works out for you because I have a whole random assortment of addons with this mission. Good luck.

Thank you for your help,

GoldGazelle

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: OFPR, Reaper's Artillery Script v2.0
« Reply #5 on: 05 May 2010, 21:27:08 »
Well there were a few issues with the script; it works, granted, but it could be done a wee bit more elegantly than with masses of goto markers and so many global variables. In any case, the issue was (I suspect) two-fold:

Code: (arty_options.sqs) [Select]
; Type of round to fire (must be in quotes):
;    Shell73 = 73mm HE
;    Shell105 = 105mm HE
;    Shell120 = 120mm HE
;    Shell125 = 125mm HE
;    Laserguidedbomb = 500lb. Bomb (ARE YOU NUTS!)

What I think is expected here is

Code: [Select]
shell = "Shell125"
shell_5 = "Shell125"
shell1 = "Shell105"
shell1_5 = "Shell105"
shell2 = "Shell73"
shell2_5 = "Shell73"

which are the config values for the default ordnance rounds in OFP, whereas what you had was

Code: [Select]
shell = "125mm HE"
shell_5 = "125mm HE"
shell1 = "105mm HE"
shell1_5 = "105mm HE"
shell2 = "73mm HE"
shell2_5 = "73mm HE"

This is all assuming that the second set of values are not the config names of ordnance in an addon you have loaded. If they are, fair enough; dunno what the problem might be in that case - possibly not using the correct config values from the addon perhaps.

The second issue:

Code: (Arty.sqs) [Select]
_fire = shell createvehicle [_x,_y,_z]
That was the same for each type of ordnance selected, which would mean you'd be firing the same type of round regardless of what was selected via the radio commands.

Attached is a missionette with the working scripts.

Offline GoldGazelle

  • Members
  • *
  • Knowledge can be taught. Wisdom can not.
Re: OFPR, Reaper's Artillery Script v2.0
« Reply #6 on: 06 May 2010, 02:39:12 »
 :clap:Thank you very much bedges, :good:

It works great. Sorry for my lack of knowledge, the mistake with the shell type in arty_options.sqs was pretty bad on my part.

Yes you are right, it is a massively unrefined script due to my level of scripting knowledge. And for that I apologize. Don't take this the wrong way, but if you (or anyone) ever have some spare time and would like to refine the script, it would be awesome.

Thank you again for your patience and superior knowledge,

GoldGazelle



Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: OFPR, Reaper's Artillery Script v2.0
« Reply #7 on: 06 May 2010, 08:53:05 »
I'm glad it works.  :good:

There's also no need to apologise for lack of scripting expertise or editing skill in general - OFPEC exists to support editors of all levels. We don't sit up on some high pedestal looking down our noses at lesser minions who've just started out on the editing journey; rather we point out areas where improvement has been shown to be possible, and nudge you in the direction of the answer so you can discover these things for yourself - surely the best way to learn. We all started out as noobs.

On which note: any place in a script where you are repeating code which does the same thing can be distilled into one segment, passing it the values which change.

(Hint - it's the bit where the shells get fired ;) )

Offline GoldGazelle

  • Members
  • *
  • Knowledge can be taught. Wisdom can not.
Re: OFPR, Reaper's Artillery Script v2.0
« Reply #8 on: 17 May 2010, 21:48:55 »
Thank you for your continuing help bedges,

I am assuming you mean condensing the Fire Howitzer Tight, Fire Howitzer Loose, Fire Heavy Mortar Tight etc. sections into one section? "Passing it the values which change", by this do you mean instead of having one section for firing of each shell, there would be one section for all shells and in place of "shell", "shell_5", "shell1" etc. there would be a general value that changes depending on what type of artillery is selected in the radio menus? :blink:

I've been messing around with it some more, but without any luck. I think it looks even more messy and I've done it totally wrong. Would it be possible to get another hint?

Thank you for your time and patience.

Offline RKurtzDmitriyev

  • Former Staff
  • ****
Re: OFPR, Reaper's Artillery Script v2.0
« Reply #9 on: 18 May 2010, 14:56:11 »
I don't quite have the time to look through the whole script, but in response to:

Quote
"Passing it the values which change", by this do you mean instead of having one section for firing of each shell, there would be one section for all shells and in place of "shell", "shell_5", "shell1" etc. there would be a general value that changes depending on what type of artillery is selected in the radio menus?

The answer is almost certainly yes. It sounds as though you need to run your script with different parameters according to what shelltype the player selects through the radio menu.

Every OFP script has a reserved variable _this which represents the parameters entered into the script. That's what can make the same code provide different results. If _this is an array (and it almost always is), use the select command to return each element of the array.

So if I have a script, "teleport.sqs", that says

Code: [Select]
_teleportme = _this select 0
_someguy = _this select 1
_teleportme setPos getPos _someguy
exit

I will get different results according to the parameters I put in. If I put in

Code: [Select]
[player, loon1] exec "teleport.sqs"

I will be teleported to the location of loon1. If I put in

Code: [Select]
[loon1, evilGuba] exec "teleport.sqs"

then loon1 will be teleported to the location of evilGuba. That's because _this means whatever the parameters passed to the script are. I don't need to have separate sections to define what happens to loon1, to the player, to evilGuba, etc., because they're all going to be processed through the same code. I "pass" different variables to the same code.

Similarly, you can have one section that says how to fire shells, and "pass" it different variables according to the parameters of the script.

Does it all make any more sense now? :cool2:
The OFP Editing Center wishes to remind you that the faithful COMREF will never threaten to stab you and, in fact, cannot speak.
However, in the event that it does speak, you are encouraged to heed its advice. ;)