Jump to content
major-stiffy

If I execVM an sqf on Act within a trigger, how do I...

Recommended Posts

Stop it on Deact?  I’ve tried terminate and others things I’ve found on the net but no joy. I have no hair left literally.

 

thanks

Share this post


Link to post
Share on other sites

Does it matter what is happening in the script at all, or is terminate a true killswitch? I wonder because he says he tried it.

Share this post


Link to post
Share on other sites

Good point @Harzach!

@major-stiffy - What is in the script? Can you please share so we can see and help you further.

Share this post


Link to post
Share on other sites

Sorry for late reply.

 

Let me start off by saying I'm very new to scripting so the things I've tried on the internet were probably not scripted properly by me.

I found a bullet cam script by KK and Benargee as follows.

//Bullet cam original work by Killzone Kid http://killzonekid.com/arma-scripting-tutorials-a-simple-bullet-cam/
//Script Edited By Benargee, 2015. http://wiki.benargee.com http://www.benargee.com http://steamcommunity.com/id/Benargee/

//Todo:add cam cancel (space)

//(findDisplay 46) displayAddEventHandler ["KeyDown","hint str (_this select 1);false;"];

if (isnil "BRNG_BulletCamDeEh") then {
BRNG_BulletCamDeEh = (findDisplay 46) displayAddEventHandler ["KeyDown","if ((_this select 1) == 57) then {BRNG_CamStatus = false;};false;"];
};
BRNG_CamStatus = true;

_EHIndex = player addEventHandler ["Fired", {
    _null = _this spawn {
		BRNG_CamStatus = true;
        _missile = _this select 6;
        _cam = "camera" camCreate (position player); 
        _cam cameraEffect ["External", "Back"];
        waitUntil {
            if ((isNull _missile) or !BRNG_CamStatus) exitWith {true};//(speed _missile < 1) dont wait on stuff like smoke grenades
            _cam camSetTarget _missile;
            _cam camSetRelPos [0,-3,0];
            _cam camCommit 0;
        };
        uiSleep 0.4;      //Slo-mo 
        _cam cameraEffect ["Terminate", "Back"];
        camDestroy _cam;
    };
}];

_EHIndex;

I was playing with a mission to be able to activate this script within a trigger area and it worked but when I leave the trigger I haven't been able to figure out the proper syntax to stop it. Also not just for this script but for any I might use in the future so others and myself can learn.

 

Thanks.

Share this post


Link to post
Share on other sites

you'd have to remove the event handler to do that but this scriptseems to include a key to toggle the bullet cam on and /off (spacebar)

 

Share this post


Link to post
Share on other sites

but the key wouldn't work I think.

Share this post


Link to post
Share on other sites

try this (untested):
 

BRNG_CamStatus = true;
if (isnil "BRNG_BulletCamDeEh") then {
BRNG_BulletCamDeEh = (findDisplay 46) displayAddEventHandler ["KeyDown","if ((_this select 1) == 57) then {
if (BRNG_CamStatus) then {BRNG_CamStatus = false; hint 'Bullet Cam: Off'; } else {BRNG_CamStatus = true; hint 'Bullet Cam: On'; };


};
false;"];
};


_EHIndex = player addEventHandler ["Fired", {
    _null = _this spawn {
		if !(BRNG_CamStatus) ExitWith {};
        _missile = _this select 6;
        _cam = "camera" camCreate (position player); 
        _cam cameraEffect ["External", "Back"];
        waitUntil {
            if ((isNull _missile) or !BRNG_CamStatus) exitWith {true};//(speed _missile < 1) dont wait on stuff like smoke grenades
            _cam camSetTarget _missile;
            _cam camSetRelPos [0,-3,0];
            _cam camCommit 0;
        };
        uiSleep 0.4;      //Slo-mo 
        _cam cameraEffect ["Terminate", "Back"];
        camDestroy _cam;
    };
}];
player setVariable ["BulletCam_eventHandler_index", _EHIndex, true];

////////////to completely remove bullet cam use code below somewhere (eg in a trigger)
//player removeEventHandler ["Fired",(player getVariable "BulletCam_eventHandler_index")];

Note that this script should work fine in SP but will need some work to work in MP
Pressing the spacebar should toggle bulletcam on and off, also if you want to change the key change the 57 to a value found here https://resources.bisimulations.com/wiki/DIK_KeyCodes

Share this post


Link to post
Share on other sites

Thanks Mr H.

 

Will give it a shot.

 

EDIT:

Worked perfect in the editor via the trigger but not key 57 (space). Prefer the trigger method anyway. Thank you sir.

Any input on how to make it work in MP?

Share this post


Link to post
Share on other sites

I have edited the code above, now the key works to toggle the bullet cam on and off (i've tested it) as for MP, you certainly do not want the bullet cam to activate every time you shoot and such things. The script above is nice but might need some other refinements. Bullet cam in MP seems quite dangerous since the player looses control over his unit  during camera shots. You could filter it to activate only when the player is using a specific weapon or firemod for instance.

Share this post


Link to post
Share on other sites

Got it and thanks Mr H.

I have this idea to only use it within a trigger during a small part of a mission. I only make MP missions my friends and I to play on the weekends I've never released anything to the public.

 

One small step for me on the learning curve.

 

Cheers

 

 

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

×