Jump to content
Sign in to follow this  
epicgoldenwarrior

A Few Questions

Recommended Posts

1) How to cancel a script?

Ex: I want to arm the bomb with an addaction, then defuse comes up, but I want defuse to cancel the other action.

Didnt want to write out the script but heres kinda the super basics of what im thinking

arm = box addaction ["Arm Bomb", "arm.sqf"];

then in arm.sqf:

systemchat "Bomb is armed";

box removeAction arm;

box addAction ["Defuse", "defuse.sqf"];

sleep 40;

box setDamage 1;

in defuse.sqf I want it to CANCEL the arm.sqf

and of course add action again and so on.

2) How to do 3d markers?

Edit: I think I found a way, I'll test it. If you have a better solution than a script feel free to tell me.

Thanks

Share this post


Link to post
Share on other sites

Try:

In whatever box/bomb you are using, put this in its init field:

this addAction ["Arm Bomb", "arm.sqf", [true, false], 5, false, true, "_this distance _target < 3"];

arm.sqf:

_box = (_this select 0);
_id = (_this select 2);
_arming = (_this select 3) select 0;
_defuse = (_this select 3) select 1;

if (!_arming && _defuse) then { 

_box removeAction _id; 
_arming = false;
_defuseID = _box addAction ["Arm Bomb", "arm.sqf", [true, false], 5, false, true, "_this distance _target < 3"];

};

while (_arming) do {

systemChat "Bomb is armed.";
_box removeAction _id;
_defuseID = _box addAction ["Defuse Bomb", "arm.sqf", [false, true], 5, false, true, "_this distance _target < 3"];

_defuseTime = [] spawn { sleep 40; }; //40 seconds until bomb "explodes"

waitUntil {scriptDone _defuseTime || _defuse}; //wait until 40 seconds is up or _defuse has been set to true

if (!_arming && _defuse) exitWith {  
systemChat "Bomb Defused";
_box removeAction _defuseID;
_box addAction ["Arm Bomb", "arm.sqf", [true, false], 5, false, true, "_this distance _target < 3"]; 
};

if (scriptDone _defuseTime) exitWith { _box setDamage 1; }; //explosion?


sleep 3;

};

To be honest I feel as if I'm missing something, but I'm too tired to think about it, but hopefully someone will come and find what I'm missing :p. I may also have some extra un-needed or improper checks, but as I said...

Edited by JShock

Share this post


Link to post
Share on other sites

Also, how do you move a marker (spawn point) I tried attachTo after a trigger but that doesnt work.

---------- Post added at 19:46 ---------- Previous post was at 19:45 ----------

Thx for the answer, I'll check it out later :)

Share this post


Link to post
Share on other sites
Also, how do you move a marker (spawn point) I tried attachTo after a trigger but that doesnt work.

You mean like the "respawn_west" marker?

You would just put this in your trigger's onAct field:

"respawn_west" setMarkerPos (getPos newPos);//obviously define your new position

And for your 3D markers question:

drawIcon3D

Share this post


Link to post
Share on other sites

Works great, thanks!

---------- Post added at 22:49 ---------- Previous post was at 21:54 ----------

One more question - I'm using the module "Respawn Tickets" what code do I use so that when the tickets reach 0 then the game ends?

opfor wins

Share this post


Link to post
Share on other sites
while (true) do {

_tickCount = [WEST, 0, false] call BIS_fnc_respawnTickets;

if (_tickCount <=0) exitWith {["END1", false, 2] call BIS_fnc_EndMission};//<<Change the false to true for a Successful Mission ending, false means it will display the Failed Mission ending.

sleep 5;

};

Share this post


Link to post
Share on other sites

To "cancel" a script:

scriptHandle = [] execVM "myScript.sqf";
hint "I didn't mean to run that script after all";
terminte scriptHandle;

terminate

Share this post


Link to post
Share on other sites
To "cancel" a script:

scriptHandle = [] execVM "myScript.sqf";
hint "I didn't mean to run that script after all";
terminte scriptHandle;

terminate

You would have thought I would have remember that, considering we went over that last night....

---------- Post added at 00:40 ---------- Previous post was at 00:03 ----------

EDIT: Replace the ( ) on the "while" in the while loop to { }, my mistake, made the same mistake in another thread, damn Java class......

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  

×