Jump to content
Sign in to follow this  
taro8

[WIP] Improving Bon's artillery script (scripting help help needed)

Recommended Posts

Hello everyone.

Im working on improving Bon's great artillery request script. It has some problems, but I really like it. However Im not much of a coder so I need some help as I run into some troubles, but I have been busy so here is list of stuff I have done or plan to do:

Changelog

V3

*fixed cluster munition

*rewritten dialogues, now all data is relayed in message, also its more in line with military fire mission request protocol

*added radio protocol beeeps and boops and static to messages ( JSRS sounds, got permission)

*added possibility to start script by radio trigger, usefull if you use map

*changed "Fire Mission canceled" message to hint

*removed not working ammo types

*added new variables:

HW_arti_reload_time

HW_arti_flight_time

HW_arti_flight_time_random

HW_arti_salvo_time

HW_arti_salvo_time_random

HW_arti_start_delay

V4

*replace height slider with manual input like direction or distance

*added new variables:

HW_arti_shell_number_reset_time

V5

*stopped script from reseting data when you press cancel, it messed up fire mission in progress

*set velocity to all shells spawned

*rotate all shells so they point downwards

*change cluster munition so initial explosion happens in the air followed by clusters dropping down

*properly working SADARM munition

*DIPCM smoke effects

*some changes in diolgue box

V6

*fixed illumination shell

Stuff to do:

*add IR adjustment (?)

*change dialogue callsign of artillery from "crossroad" to name specified in init

*add script that would read coordinates of point clicked by player, so player can drop barrage directly there (?) - partially done, script creating marker works, but I have problems integrating it into dialogue box

Now here are issues I need help with:

*Check radio protocol. I need someone with military knowledge to read my messages and see if they fall in line how it should be done in real life.

Here is v6 WIP version: http://www.mediafire.com/?7n58tbhjfh1qqow

Just put in mission folder, add "server" game logic and start mission. If you want to be able to call arty by radio, the create repeatable radio trigger with this: 0 = execVM (BON_ARTI_PATH+"bon_arti_call_by_radio.sqf")

Credits:

*bon - original script

*LordJarhead - for radio sounds

*Rydygier - for massive scripting help

Edited by Taro8

Share this post


Link to post
Share on other sites
*Speeding up shells. Codding help needed.

_bomb = _artitype createVehicle [(_splashpos select 0) + _spread - random (2*_spread),(_splashpos select 1) + _spread - random (2*_spread),100];

I believe, and I took a look at the rest of the script, Bon on that bit of code is just deploying a shell where it is supposed to land "_splashpos(ition)", not the projectile itself. If i am not mistaken changing projectile velocities only in weapon/ammo config.

Share this post


Link to post
Share on other sites

The problem is that shells are spawned and fall to the ground with their gravity speed. While its not a problem for normal shells, bombs glide to the ground and veer off the target. I just tested this on vehicle with set position and its perfectly possible to speed up falling object. My test involved vehicle with this in init field:

this setPos [getPos this select 0, getPos this select 1, 100]; this setVelocity [0, 0, -200]

Compare how vehicle falls from 100m without velocity being set. Now Im trying to spawn a bomb and speed it up.

EDIT: Ok I thinkt that I need to add "this setVelocity [0, 0, -200]" to any bomb created by using "setVehicleInit " command. But how to do that when you create object by script?

Im trying with this script:

_bomb = "ah1z" createVehicle (position target); 

sleep 1

_bomb spawn {
				_bomb = _this;
				_this setVehicleInit "this setVelocity [0, 0, 200]"
			};

But it dosent work for me. Object spawned remains on the ground, while it should fly upward.

Edited by Taro8

Share this post


Link to post
Share on other sites

You mean no incoming shell sounds or no radio bleeps? If so it means you are missing Description.ext or to be more precise:

class CfgSounds {
#include "bon_artillery\cfgSounds.sqf"
};

It is weird as it works for me. In short it has something to do with cfgSounds.sqf.

I will upload my current version (v4) and let you guys see if it is fine.

EDIT: Ok so I figured out how to get object position and add randomization to it. however I just cant get this stuff working together. Also I had to do things in horribly inefficient way by using invisible H and placed marker. I need some scripting help.

Basically I want this:

Player clicks on button "Mark on map" in dialog window and script runs (I know how to do that)

1. Arty dialog window is closed

2. Player is shown map

3. Player clicks on map

4. Marker is created at point clicked by player

4. Marker position is sent to dialog window as coordinates designated by player

5. Script waits until player close map

6. Dialog window is shown again

Here is my pitiful try:

CloseDialog 0;

openmap true;

onMapSingleClick "target_h setpos _pos; "arty_target_marker" setMarkerPos getpos target_h;";

WaitUntil {!VisableMap}; 

onMapSingleClick "";

execVM (BON_ARTI_PATH+"dialog\openMenu.sqf"),["Arti_dlg"],-1,false,true,"",bon_arti_condition];


BTW: This is why I said I suck at coding.

Edited by Taro8

Share this post


Link to post
Share on other sites

Maybe this will help a bit with to slow bomb falling and its horizontal orientation problem:

_bomb = createVehicle ["Bo_GBU12_LGB", [((position T1) select 0),((position T1) select 1),100], [], 0, "NONE"]; //create a bomb 100 meters above object named T1

_bomb setVectorUp [0,-1,-0.001]; // make the bomb vertical oriented (point downward) 

_vel = -50; //initial velocity at spawning height
while {((getpos _bomb) select 2) > 1} do // loop for keeping growing (or constant, if acceleration = 0) velocity until bomb is at least 1 meter above terrain
{
_vel = _vel - 0.05; //acceleration per cycle
_bomb setVelocity [0, 0, _vel]; //adjusting velocity
};

Tested this as sqf executed by radio trigger and with various values of _vel, acceleration, initial height and so on with good results.

Edited by Rydygier

Share this post


Link to post
Share on other sites

I just put this into fire script and it WORKS! Thanks man.

Share this post


Link to post
Share on other sites

WIP v5 is released. Quite a few improvments.

Share this post


Link to post
Share on other sites

Im using ACE and I didnt notice any problems. All shells worked correctly.

EDIT: Correction: Illumination dosnt work properly. I think this may be caused by ACE.

Edited by Taro8

Share this post


Link to post
Share on other sites

Yes you are correct not sure why it did not work last time maybe i set teh distance wrong :) - - but working now - - however I get no chat text anymore just the radio beeps , any idea ?

Share this post


Link to post
Share on other sites

That is odd. Maybe you have disabled subtitles? Everything except for Illumination works for me right now.

I think I know why illumination does not work. It simply falls to fast due to scripted acceleration. I think I will need t throw in condition about arty type for illumination shell so it will fall with normal speed.

Share this post


Link to post
Share on other sites

WIP v6 six released, check first post.

I fixed illumination shell problem. As I expected it was caused by scripted acceleration. I added condition for ammo type and its fine and dandy now. As sort of bonus now Illumination shell dosent make incoming sound AND, thanks to increased spawn height, it lits pretty big area (about 450m) for quite some time.

Share this post


Link to post
Share on other sites

Ok lads I have a problem.

Im just few steps away from allowing mapclick designation for fire mission coordinates (dont worry, there will be changeable error). However I run into rather big problem: for some reason dialogue box displays idc for x and y coords of marker set by script. I will explain:

I have a script that sets marker by clicking, it is run from dialogue box (open map, wait for click, close map). I have this at the end:

BON_ARTY_MAP_XRAY = (getmarkerPos BA_Mrkr1 select 0)+ random HW_arti_mapclick_error - random (2*HW_arti_mapclick_error);
BON_ARTY_MAP_YANKEE = (getmarkerPos BA_Mrkr1 select 1)+ random HW_arti_mapclick_error - random (2*HW_arti_mapclick_error);

This one works as I checked it via hint reporting both values.

In a seperate script that sets text, that shows up in some parts of dialogue box, I have this:

ctrlSetText [bON_ARTY_MAP_XRAY_Text,format["Latitude: %1",round BON_ARTY_MAP_XRAY]];
ctrlSetText [bON_ARTY_MAP_YANKEE_Text,format["Longitude: %1",round BON_ARTY_MAP_YANKEE]];

However in dialogue box instead of position it shows idc's of BON_ARTY_MAP_XRAY and BON_ARTY_MAP_YANKEE (999898 and 999899).

What is wrong?

Edited by Taro8

Share this post


Link to post
Share on other sites
*Check radio protocol. I need someone with military knowledge to read my messages and see if they fall in line how it should be done in real life.

Haven't big knowledge, and haven't enough time, but know, where info about Call for Fire procedures can be found. For example:

http://www.globalsecurity.org/military/library/policy/army/fm/6-30/f630_5.htm

As far, as I know first is always so called "locstat" - GRID position of FO. Obviously neccessary for POLAR, but also needed to aware the battery, where shouldn't fire. :)

Share this post


Link to post
Share on other sites
Have you tried this on a Dedi box yet as it work great when i host but on a dedi box the explosions never happen ?

Yes atm there is a problem with dedicated server, I can pinpoint the location in the init, were the is if (isServer) the script never get in that If. It's strange and I tried to change it to:

if (isServer || isDedicated) then 

But it dosen't work.

I think it got soemthing to do with the latest BIS patch. I tested it using the MCC command line. when I type

if (isServer || isDedicated) then {server globalchat "hello world};

and broadcast it to all clients and server using CBA globalevent I get no response.

But if i'll type:

server globalchat "hello world;

and broadcast it I get two responses. It's like the isServer never go true any more. But the isServer is working for me on someother scripts so I can't really tell.

I will need to dig into it later on.

Taro8 if you need some help scripting, dialogs, or military advice feel free to PM me.

Share this post


Link to post
Share on other sites

Hi i've also been modifying bon script for use in a campaign i'm making but you have done a lot more that me, nice work!

I think you may still be missing a check to see if the player has confirmed the strike, or at least the sound played for me even if i had not and it relatively easy to add. Just add a script file to be activated where bon_arti_request.sqf normaly is saying the following and RCMready = true at the end of the setup file.

]//by RCMW*

if (RCMready) then {player execVM 'bon_artillery\bon_arti_request.sqf';} else {player execVM 'bon_artillery\bon_arti_cancle.sqf';};

RCMready = false;

if(true) exitWith{};

I think I may also have so radio chatter you can add if you want some voices saying “shot, out†and the like. Let me know.

Edited by RCMW

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  

×