Jump to content
Sign in to follow this  
PSYKO_nz

remove version of addACTION

Recommended Posts

so close to finishing my mission, all i need is to remove a peskie action

heres how it works, any member of the team triggers a trigger, some words come up and the group leader "sniper1" gets a new menu item (this addaction) "call Arty - Fire Salvo" only the mission leader gets this option (altho other players gain it to if they come close, and can activate it (i wanna stop this 2))

once the action is used it dissapairs from the sniper1 (players) list of actions but is still up on any body near the leader, befor or after the activation of the thing

so heres my question, how do i make an action dissapare completely after one activation, i want it to work once then dissapare from all players regardless of were there or where ther may be during the mission for good

anybody got any ideas?

thanks in advance, and sorry for the noob question, im not good with this whole thing, it works fine in sp but mp, whole new kettle of fish!

Share this post


Link to post
Share on other sites

{_x removeAction actionName} forEach allUnits;
{_x removeAction actionName} forEach allDead;
{_x removeAction actionName} forEach vehicles;

Executing this on the server and all clients should totally and completely remove the action from the world.

Edited by RogueTrooper

Share this post


Link to post
Share on other sites

You should not add the action to the others at all then.

In the on act of the trigger surround your addAction command with:

if (player == sniper1) then { YOU_ADD_ACTION_STUFF_HERE };

Then only the player who is sniper1 will get the action. In the script that runs when you use the action you can add this which will remove the action:

(_this select 0) removeAction (_this select 2);

Share this post


Link to post
Share on other sites

here is how to control who sees the action when looking at each others bodys.

the highlighted part means that the one that can see the code needs to be the same one the code is placed upon, _target is the object action is on, _this is whoever looks at _target to gsee the action, now both needs to be same.

_id = _vehicle addAction ["call arty", "scriptname.sqf", [], 0, false, true, "", "[b]_target == _this[/b]"];

and as carlGustaffa said, there is a function to delete it correctly in the action itself.

in whatever script you call the action with, place this at the end or twhere you want it to be deleted:

_one_who_used_action = _this select 1;
_id_of_action = _this select 2;
_one_who_used_action removeAction _id_of_action;

names are only for clarification :D

edit, somewhat ninjaed. :D

Share this post


Link to post
Share on other sites

I've been having a problem removing some actions or rather putting them back later.

I'm creating an addaction for each unit accessed by another addaction ACT1 = ect

That all works, I get the list of actions and delete the first action act1.

I can also delete the other actions 5 seconds later.

So first time it's run it works perfectly and so does the second or appears to however instead of action id 0-3 it's 4 -7 so when I try to remove them they're not deleted and I get multiple actions.

Can anyone spot the problem?

_count = 0;

_groupunits = [];

player removeAction act1;

///////// create ////////////
{ 
if (player != _x) then { 

 _count = player  addaction [str _x,"kull.sqf",_x,1,true,true,"",""];  
   _groupunits = _groupunits + [_count];

   hint format ["%1",_count];
  _count = _count+1;
sleep 0.2;
};
} foreach units group player;


sleep 5;

_count = 0;
////////////// delete //////////
{  
player removeAction ( _count+1);
_groupunits = _groupunits - [ _count];
 _count = _count + 1;
} foreach _groupunits;


act1 = player addaction ["Dissmiss Unit","dissmiss.sqf",[],0,false,false,"",""]

Share this post


Link to post
Share on other sites

something like this, i removed the count = count + 1 parts, and just used _x to reference it.

did that do it?

[s]_count = 0;[/s]
_groupunits = [];
player removeAction act1;

///////// create ////////////
{
if (player != _x) then {
	_count = player  addaction [str _x,"kull.sqf",_x,1,true,true,"",""];
	_groupunits = _groupunits + [_count];

	hint format ["%1",_count];
	sleep 0.2;
};
} foreach units group player;


sleep 5;
////////////// delete //////////
{
player removeAction _x;
[s]	_groupunits = _groupunits - [_count];[/s]
} foreach _groupunits;


act1 = player addaction ["Dissmiss Unit","dissmiss.sqf",[],0,false,false,"",""]

edit: striked out unnccesary parts.

also you can easily replace act1 with a local handle, and delete it via

_this select 2;

you dont need it to be global, as it references itself.

ofc only if you dont need to reference it from outside of this script.

Edited by Demonized

Share this post


Link to post
Share on other sites

Actually it did work Thanks., I tried player removeAction _x; many times before but not since I added the array.

It looks like you can't reclaim the _handle number as they seem to increase even after removing the action.

I still have another problem but I'll try and sort it first.

Thanks.

.

Share this post


Link to post
Share on other sites

trying a few, of these now, thank you all for your help, posting this thread i was expecting to be flamed but you all have been so helpfull and explaned the differnt ways great, thanks heaps!

ill let you know how i get on!

Share this post


Link to post
Share on other sites
{_x removeAction actionName} forEach allUnits;
{_x removeAction actionName} forEach allDead;
{_x removeAction actionName} forEach vehicles;

Executing this on the server and all clients should totally and completely remove the action from the world.

still having a slight problem, was wondering if you could clarafy for me

how do i make it run on the server and all clients?

im very noob to scripting if you could give me an example it would be great!

note: the problem is after its activated the other players can still activate it if there nera and looking at "sniper one"

Share this post


Link to post
Share on other sites
Actually it did work Thanks., I tried player removeAction _x; many times before but not since I added the array.

It looks like you can't reclaim the _handle number as they seem to increase even after removing the action.

I still have another problem but I'll try and sort it first.

Thanks.

.

If you are removing and readding the same actions it'd probably be better to add it once with a condition.

Share this post


Link to post
Share on other sites

heres what the script currently looks like

(_this select 0) removeAction (_this select 2);

{_x removeAction actionName} forEach allUnits;

{_x removeAction actionName} forEach allDead;

{_x removeAction actionName} forEach vehicles;

_one_who_used_action = _this select 1;

_id_of_action = _this select 2;

_one_who_used_action removeAction _id_of_action;

hint "Take cover, Arty's on the way in. Marked white";

motar fire "M252";

waitUntil sleep 1.5;

bomb = "SmokeShell" createVehicle [(getmarkerPos "smoke" select 0),( getmarkerPos "smoke" select 1), 150];

M119c fire "M119";

waitUntil sleep 0.5;

bomb = "ARTY_Sh_105_WP" createVehicle [(getmarkerPos "burn" select 0),( getmarkerPos "burn" select 1), 2500];

waitUntil sleep 0.5;

M119c fire "M119";

waitUntil sleep 0.5;

M119b fire "M119";

waitUntil sleep 0.5;

bomb = "ARTY_Sh_105_WP" createVehicle [(getmarkerPos "burn2" select 0),( getmarkerPos "burn2" select 1), 2500];

waitUntil sleep 0.5;

M119D fire "M119";

waitUntil sleep 0.5;

M119a fire "M119";

waitUntil sleep 0.5;

bomb = "ARTY_Sh_105_HE" createVehicle [(getmarkerPos "burn3" select 0),( getmarkerPos "burn3" select 1), 2500];

waitUntil sleep 0.5;

M119c fire "M119";

waitUntil sleep 0.5;

M119d fire "M119";

waitUntil sleep 0.5;

bomb = "ARTY_Sh_105_HE" createVehicle [(getmarkerPos "burn4" select 0),( getmarkerPos "burn4" select 1), 2500];

waitUntil sleep 0.5;

M119b fire "M119";

waitUntil sleep 0.5;

M119a fire "M119";

waitUntil sleep 0.5;

bomb = "ARTY_Sh_105_HE" createVehicle [(getmarkerPos "burn5" select 0),( getmarkerPos "burn5" select 1), 2500];

waitUntil sleep 0.5;

M119b fire "M119";

waitUntil sleep 0.5;

M119c fire "M119";

waitUntil sleep 0.5;

bomb = "ARTY_Sh_105_WP" createVehicle [(getmarkerPos "burn6" select 0),( getmarkerPos "burn6" select 1), 2500];

waitUntil sleep 0.5;

M119A fire "M119";

waitUntil sleep 0.5;

M119d fire "M119";

waitUntil sleep 0.5;

bomb = "ARTY_Sh_105_HE" createVehicle [(getmarkerPos "burn7" select 0),( getmarkerPos "burn7" select 1), 2500];

waitUntil sleep 0.5;

M119a fire "M119";

waitUntil sleep 0.5;

M119b fire "M119";

waitUntil sleep 0.5;

bomb = "ARTY_Sh_105_HE" createVehicle [(getmarkerPos "burn8" select 0),( getmarkerPos "burn8" select 1), 2500];

waitUntil sleep 0.5;

M119c fire "M119";

waitUntil sleep 0.5;

M119d fire "M119";

waitUntil sleep 0.5;

bomb = "ARTY_Sh_105_HE" createVehicle [(getmarkerPos "burn9" select 0),( getmarkerPos "burn9" select 1), 2500];

waitUntil sleep 0.5;

M119a fire "M119";

waitUntil sleep 0.5;

M119D fire "M119";

waitUntil sleep 0.5;

bomb = "ARTY_Sh_105_WP" createVehicle [(getmarkerPos "wp2" select 0),( getmarkerPos "wp2" select 1), 2500];

waitUntil sleep 0.5;

M119B fire "M119";

waitUntil sleep 0.5;

M119C fire "M119";

waitUntil sleep 0.5;

bomb = "ARTY_Sh_105_Wp" createVehicle [(getmarkerPos "wp" select 0),( getmarkerPos "wp" select 1), 2500];

waitUntil sleep 0.5;

M119a fire "M119";

waitUntil sleep 0.5;

M119D fire "M119";

waitUntil sleep 0.5;

bomb = "ARTY_Sh_105_Wp" createVehicle [(getmarkerPos "wp1" select 0),( getmarkerPos "wp1" select 1), 2500];

waitUntil sleep 0.5;

M119B fire "M119";

waitUntil sleep 0.5;

M119C fire "M119";

waitUntil sleep 0.5;

bomb = "ARTY_Sh_105_HE" createVehicle [(getmarkerPos "MISS" select 0),( getmarkerPos "MISS" select 1), 2500];

waitUntil sleep 0.5;

M119a fire "M119";

waitUntil sleep 0.5;

M119D fire "M119";

waitUntil sleep 0.5;

bomb = "ARTY_Sh_105_Wp" createVehicle [(getmarkerPos "MISS2" select 0),( getmarkerPos "MISS2" select 1), 2500];

waitUntil sleep 0.5;

M119D fire "M119";

waitUntil sleep 0.5;

M119A fire "M119";

waitUntil sleep 0.5;

bomb = "ARTY_Sh_105_HE" createVehicle [(getmarkerPos "MISS3" select 0),( getmarkerPos "MISS3" select 1), 2500];

waitUntil sleep 0.5;

M119B fire "M119";

waitUntil sleep 0.5;

M119C fire "M119";

waitUntil sleep 0.5;

bomb = "ARTY_Sh_105_HE" createVehicle [(getmarkerPos "MISS4" select 0),( getmarkerPos "MISS4" select 1), 2500];

(_this select 0) removeAction (_this select 2);

{_x removeAction actionName} forEach allUnits;

{_x removeAction actionName} forEach allDead;

{_x removeAction actionName} forEach vehicles;

_one_who_used_action = _this select 1;

_id_of_action = _this select 2;

_one_who_used_action removeAction _id_of_action;

what do i need to change in it or add to it?

Share this post


Link to post
Share on other sites

PSYKO,

If you would like to ensure scripts are being executed on particular clients, or all clients, and don't want to be bothered doing it yourself, such as me, I would highly suggest a script by Seth over at Armaholic forums RSL (Remote Script Launcher), easy to use, and works well.

Hope that helps.

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  

×