Jump to content
Sign in to follow this  
ravennx

Limiting Mr-Murray Arty Script.

Recommended Posts

To start with Im having problems with limiting this script.

I want the unit to be able to use Arty wherever so I grouped the unit with the trigger. The problem is... the Removeaction wont work because the trigger just keeps activating. Here are the scripts im using.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> Trigger On ACT:thislist exec westari\westaddaction.sqs"

On Dea:westadd=false

// westaddaction.sqs

_soldier = _this select 0

~1

ID = _soldier addaction ["FIRE 125M AT","westari\setfiresa.sqs"]

~1

ID = _soldier addaction ["FIRE 105M HEAT","westari\setfire.sqs"]

~1

ID = _soldier addaction ["FIRE CLUSTER ROUND","westari\setfireat.sqs"]

~1

ID = _soldier addaction ["FIRE SMOKE SCREEN","westari\setfiresm.sqs"]

westadd=true

@!westadd

_soldier removeaction ID

Exit

//setfire.sqs

setfire=true

titletext ["Click on the map to set coordinates. (ANTIARMOR RONDS)","plain down"]

onMapSingleClick "ATarget setpos _pos;setfire=false"

@!setfire

[] exec "westari\ari.sqs"

"Firepoint" setmarkerpos getpos ATarget

fire=true

publicvariable "fire"

publicvariable "ATarget"

onMapSingleClick ""

titletext ["","plain down"]

exit

//ari.sqs

#Loop

@(fire)

ERadio say "arty"

fire=false

?(!(local server)):exit

[West, "HQ"] sideChat "ROGER FIRE SUPPORT RECIEVED, LOADING 105M HE"

player addScore 5

~10

[W1,ATarget] exec "westari\feuer.sqs"

~ Random 2

[W2,ATarget] exec "westari\feuer.sqs"

~ Random 2

[W3,ATarget] exec "westari\feuer.sqs"

~ Random 2

[W4,ATarget] exec "westari\feuer.sqs"

~ Random 2

[W5,ATarget] exec "westari\feuer.sqs"

~ Random 2

[W6,ATarget] exec "westari\feuer.sqs"

~ Random 2

[West, "Base"] sideChat "ON THE WAY"

~6

[W1,ATarget] exec "westari\feuer.sqs"

~ Random 2

[W2,ATarget] exec "westari\feuer.sqs"

~ Random 2

[W3,ATarget] exec "westari\feuer.sqs"

~ Random 2

[W4,ATarget] exec "westari\feuer.sqs"

~ Random 2

[W5,ATarget] exec "westari\feuer.sqs"

~ Random 2

[West, "Base"] sideChat "SPLASH"

[W6,ATarget] exec "westari\feuer.sqs"

~ Random 2

~6

[W1,ATarget] exec "westari\feuer.sqs"

~ Random 2

[W2,ATarget] exec "westari\feuer.sqs"

~ Random 2

[W3,ATarget] exec "westari\feuer.sqs"

~ Random 2

[W4,ATarget] exec "westari\feuer.sqs"

~ Random 3

[W5,ATarget] exec "westari\feuer.sqs"

~ Random 2

[W6,ATarget] exec "westari\feuer.sqs"

~ Random 2

"Firepoint" setmarkerpos [0,0]

goto "Loop"

//feuer.sqs

~Random 2

_K = _this select 0

_Z = _this select 1

_X = Getpos _Z select 0

_Y = Getpos _Z select 1

_K DoWatch [_X,_Y,5000]

_A =_K Ammo "M119"

~5

_K fire "M119"

#Next

@ _A > _K Ammo "M119"

~2

_N = nearestObject [_K,"HeatM119"]

_X = _X+((Random 60)-40)

_Y = _Y+((Random 60)-40)

_H = "HeliHEmpty" CreateVehicle [_X,_Y]

~1

_H say "Ari"

~12

_N setpos [_X,_Y,0]

_Bomb="SH_125_HE" CreateVehicle [_X,_Y,0]

~0.5

deleteVehicle _H

exit

I want the Actions on a timer you can use them once every X Min.

Like I said the problem is, I want the unit to use Arty Anywhere, instead of OPFOR/Present Trigger.

Any help would be great.

Thanks!

RavennX

Share this post


Link to post
Share on other sites

Hi ravennx,

I'm not sure whether this is the best way to do this but I'd probably set up a constantly running looping script in sqf format that added the action to the unit and then once the action was triggered remove the action using a boolean public variable false sent from your ari.script. The looping script would then act as a timer and once the time was up it would reset the variable to true and re-add the action. I could write this part of the scritp for you but I'm pretty busy at the moment and it may take a few days.

Best wishes,

norrin

Share this post


Link to post
Share on other sites

That would be great Norrin.

I was also looking at just limiting the ammo the Arty starts with.

Any way I could go about doing that? To est it to an Exact number.

Thanks Again man you really helped me out here.

Share this post


Link to post
Share on other sites

You have to rename your names for the actionmenue entree´s

You always use ID. ID is the name of the entree. You can name it Entry1,Entry2... or sth like... whatever

Use it like this:

ID

IID

IIID

IIIID

If the player has used the Arty, remove all entree´s.

player removeAction ID

player removeAction IID

player removeAction IIID

player removeAction IIIID

~Your Delay

_soldier addaction ["FIRE 125M AT","westari\setfiresa.sqs"]

...

If I finished my guide i think I have have to rescript the arty.

Maybe with dialogues or sth like that.

@! Hey Norrin. Thanks for your respawn. Works very great wink_o.gif

Regards,

Mr-Murray

Share this post


Link to post
Share on other sites

@ravennxx here's the add/remove action code - you could really adapt it for any actions you want to add or remove in missions. It really just does what Mr-Murray suggested and its probably more complex than it needs to be but it works well with either AI-enabled or disabled.

To implement:

You'll need to create a init.sqf file and add the following code

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">/*

INIT.SQF

*/

waitUntil{player == player};

_units = ["w1","w2"];

_time_between_actions = 20;

{call compile format ["if (isplayer %1) then {call {[%1, _time_between_actions] execVM ""limit_action.sqf""}}", _x]} forEach _units;

if (true) exitWith {};

where w1 and w2 are the names of the playable units you want to use this code and _time_between_actions is the amount of time before the arti actions reappear.

Next you need to add a line to each of the setfire.sqs scripts

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

;line added by norrin

call compile format ["action_remove_%1 = true; publicVariable ""action_remove_%1""", player];

setfire=true

titletext ["Click on the map to set coordinates. (ANTIARMOR RONDS)","plain down"]

onMapSingleClick "ATarget setpos _pos; setfire=false"

@!setfire

[] exec "westari\ari.sqs"

"Firepoint" setmarkerpos getpos ATarget

fire=true

publicvariable "fire"

publicvariable "ATarget"

onMapSingleClick ""

titletext ["","plain down"]

exit

Finally you need to create a file called limit_action.sqf that contains the following code and place it in your mission directory.

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

/*

LIMIT ACTION SQF

© JULY 2007 - norrin (norrins_nook@iprimus.com.au).

*****************************************************************************************

Designed for use with Mr-Murrays RT script. Based on an idea by ravennx

*****************************************************************************************

start limit_action.sqf

*/

waitUntil {time == time};

_unit = _this select 0;

_sleep = _this select 1;

_name = call compile format ["%1", _unit];

_c = 0;

call compile format ["action_remove_%1 = false", _unit];

_run = true;

if (!local _name || !isplayer _name) exitWith {};

for [{}, {_run}, {_run}] do

{

//Place actions in here

call compile format ["

if(alive %1 && !action_remove_%1 && _c == 0) then

{

ID_1 = player addaction [""FIRE 125M AT"",""westari\setfiresa.sqs""];

ID_2 = player addaction [""FIRE 105M HEAT"",""westari\setfire.sqs""];

ID_3 = player addaction [""FIRE CLUSTER ROUND"",""westari\setfireat.sqs""];

ID_4 = player addaction [""FIRE SMOKE SCREEN"",""westari\setfiresm.sqs""];

_c = _c + 1;

};", player];

call compile format ["

if(alive %1 && !action_remove_%1 && _c == 1) then

{

sleep 1;

};", player];

call compile format ["

if (alive %1 && action_remove_%1 && _c == 1) then

{

sleep 1;

%1 removeaction ID_1;

%1 removeaction ID_2;

%1 removeaction ID_3;

%1 removeaction ID_4;

sleep _sleep;

_c = 0;

sleep 1;

action_remove_%1 = false;

publicVariable ""action_remove_%1"";

sleep 1;

};", player];

call compile format ["

if (!alive %1) then

{

%1 removeaction ID_1;

%1 removeaction ID_2;

%1 removeaction ID_3;

%1 removeaction ID_4;

waitUntil{alive %1};

_c = 0;

_remove_action = false;

action_remove_%1 = false;

publicVariable ""action_remove_%1"";

sleep 1;

};", player];

sleep 1;

};

PS: I have set up a test mission I could send you where the action scripts work but it doesn't have Mr Murray's full script just the bits you gave in your post so the arti never appears.

@Mr-Murray thanks m8 smile_o.gif I hope you don't mind me setting this up as its nice to work on something other than revive scripts for a change.

Share this post


Link to post
Share on other sites

Oh no, it´s very great! I´m very buzy at time because I have

exams and to finish my guide. There is no time to rescript my

scripts at time.

It´s only a basic idea of the arty. Everyone can feel free to

modify. It would be great to read my name in the credits.

Regards,

Mr-Murray

Share this post


Link to post
Share on other sites

Just wow, I must thank you bolth and will give due credit to all the scripts. You just wont belove how much I have learned about scripting this weekend. Looks like I have some more work to do.

Again Thank you.

P.S. Norrin do you ever get on your MSN? I would like to thank you personaly.

RavennX

Share this post


Link to post
Share on other sites

Everything is setup fine.

when i host a server everything works fine.

when i join my server as a client i get the actions but the m119's dont fire at all.

any suggestions?

thanks

Share this post


Link to post
Share on other sites

I haven't had a chance to look at this carefully but this line of code near the start of the ari.sqs script might be the problem

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?(!(local server)):exit as it could be preventing clients from running the script. ie. you must be local to the server for the ari.script to run.  I'll look into it more hopefully a little later today.

Share this post


Link to post
Share on other sites

I have removed that line of Code from all those scripts.

It works now however, Onmap click is real buggy and sometimes the bombs dont drop at all.

What I have done after that is take Mrmurrays script and MP example and drop it Exactly into what im working on. Still it doesent work.

Mrmurray now has my mission.pbo.

I hope to get this fixed lol

For now i removed the artillery completly from my mission.

Thanks

RavennX (Serenity in game)

Share this post


Link to post
Share on other sites

I've been thinking about this and whats needed to get Mr Murray's arti script working on a dedicated server and I think the problem has got to do with the locality of where the scripts are running. On a dedicated server with the current script the client activates the action locally which then fires the ari scripts also locally on the client so the artillery which exists on the server never gets the message to fire.

So what I think you might need is create a looping script that runs on the server that is designed to detect two public variables: a notification to fire and second public variable that gives the location of the target. The player then, running scripts local to the clients machine public variables these two vars and then the artillery which is local to the ded server receives the vars and fires away. I'm in the process of setting up something similar so that I can get close air support from AI choppers and if it works I'll let you know and we can try and set up something similar with Mr Murrays arti script for a ded server.

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  

×