Jump to content
Sign in to follow this  
froggyluv

RemoveAction help

Recommended Posts

I'm using a trigger near an object to initiate a "Photograph" action as well as call a task finished.

player addAction ["Photograph", "cam2.sqs"]

this calls a 'camera.sqs' script and gives the effect of taking a picture.

 ....
player cameraEffect ["terminate", "back"]
camDestroy _camera

[b]player removeAction ["Photograph", "cam2.sqs"][/b]


tsk2 setTaskState "SUCCEEDED";nul = [objNull, ObjNull, tsk2, "SUCCEEDED"] execVM "CA\Modules\MP\data\scriptCommands\taskHint.sqf";hint "War crime evidence found";nul = execvm "spawn3.sqf";

but I can't cancel the action after the shot is taken and it's pretty disruptive during combat. I know that's not the proper way to end an action as I need some kind of an index but I really don't understand how to call it.

Share this post


Link to post
Share on other sites

I did this for mine...

player addAction ["Assist","scripts\assist.sqf"]

That is the scripts call, as usual.

Now this is what's written in the assist.sqf file.

assist = true;
s1 sideChat "ROGER PAPABEAR WE WILL ASSIST AT PETROVKA, OVER.";
player removeAction 0;
player removeAction 1;

"dkz_attack" setMarkerAlpha 1;
"vy" setMarkerAlpha 1;
"obj2" setMarkerAlpha 1;

tskObj1=player createSimpleTask ["Liberate Petrovka"];
tskObj1 setSimpleTaskDescription ["Petrvoka is currently under attack by CHDKZ forces, stop them.","Liberate Petrovka","Liberate Petrovka"];
player setCurrentTask tskObj1;

Share this post


Link to post
Share on other sites

Hmm, didn't work for me. Is 'Assist' the name of your action and shouldn't it be in quotes?

trigger when player approaches and its OnActiv is player addactiv is

player addAction ["Photograph", "cam2.sqs"]

Cam.sqs

 [b]photograph = true;
player removeaction 0;
player removeaction 1[/b];

cutText ["", "BLACK IN", 5]
showCinemaBorder true
_camera = "camera" camCreate [0,0,0]
_camera cameraEffect ["internal", "back"]
_camera camPrepareTarget [-82857.03,-29270.84,-39317.81]
_camera camPreparePos [3279.63,2884.74,2.11]
_camera camPrepareFOV 0.700
_camera camCommitPrepared 0
@camCommitted _camera
~2
player sidechat "holy...Shit"
playsound "sound7"
_camera camPrepareTarget [-82857.03,-29270.84,-39317.91]
_camera camPreparePos [3279.37,2884.65,2.14]
_camera camPrepareFOV 0.611
_camera camCommitPrepared 0
@camCommitted _camera

~2
_camera camPrepareTarget [-82857.03,-29270.84,-39317.90]
_camera camPreparePos [3279.43,2884.57,2.13]
_camera camPrepareFOV 0.349
_camera camCommitPrepared 0
@camCommitted _camera

player cameraEffect ["terminate", "back"]
camDestroy _camera




tsk2 setTaskState "SUCCEEDED";nul = [objNull, ObjNull, tsk2, "SUCCEEDED"] execVM "CA\Modules\MP\data\scriptCommands\taskHint.sqf";hint "War crime evidence found";nul = execvm "spawn3.sqf";

---------- Post added at 05:03 AM ---------- Previous post was at 04:09 AM ----------

Finally got it. It seems that the 'ID' element must be the removed one so

player removeaction 2

did the trick :)

Edited by froggyluv

Share this post


Link to post
Share on other sites

@froggyluv

call your Addaction with :

ID1 = player addAction ["Photograph", "cam2.sqs", [], 0, false,false,'teamSwitch',""];

ID2 = player addAction ["Action2", "Script2.sqs", [], 0, false, false, 'teamSwitch',""];

Syntax:

Number = unitName addAction [title, filename, (arguments, priority, showWindow, hideOnUse, shortcut, condition)]

to remove : player removeaction ID1;

so ID1 & ID2 are the Index of your Actions.

CU

Edited by fbbull

Share this post


Link to post
Share on other sites

Thanks fbbull. Your way seems far cleaner than how I did it.

Actually I'm not even sure why my way worked. I changed the initial detection trigger to

player exec "photo.sqs;
"

 photoact = player addAction ["Photograph", "cam2.sqs"];
player removeaction 0;
player removeaction 1;

...and the cam2.sqs is the same as above but at the end of it I put the

player removeaction 2

and for some reason it worked :confused: I'm surprised that it knew what the "2" was relevant towards as it's in an entirely different script.

This stuff is great but all knew to me. After hours studying the bikis trying to really grasp 'Arrays, elements, and local vs global variables, it's slowly starting to sink in. Someone needs to make a school for this stuff :D

Share this post


Link to post
Share on other sites

removeaction 2 calls the 2'nd Addaction you made. If you use the ID variante you don't have to count all your Actions to remove the right one!! :)

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  

×