Jump to content

Recommended Posts

This is my Create FOB function.

If you replace the event handler with removeAllCuratorEditingAreas, it will work.

I want to make it where you can place as many HQs as you want, But when they get destroyed so goes the editing area around it.

Spent like 4 hours trying to figure it out :sad:.

My first attempt i just made a _EA variable, but i wasn't sure if it was storing the code or the actual number, And if that number would stay with the event handler or change when the event handler fired, but then this attempt confirms that it wouldn't of worked anyway.

 

I know {} is code, and () is number, but it was still confusing as what if you recalled the function, would previous eventhandlers change?

HNK_createFOB = {
	params ["_veh"];
	_vehPos = getPos _veh;
	deleteVehicle _veh;
	_HQ = HQClass createVehicle _vehPos;
	myCurator addCuratorEditableObjects [[_HQ],true];

	_HQ setVariable ["_EA",((count curatorEditingArea myCurator) + 1)];
	myCurator addCuratorEditingArea [(_HQ getVariable "_EA"),position _HQ,100];

	_HQ addEventHandler ["Killed", {
		params ["_unit", "_killer", "_instigator", "_useEffects"];
		myCurator removeCuratorEditingArea (_HQ getVariable "_EA");
}];};

Share this post


Link to post
Share on other sites

That is because _HQ isn't defined in the eventhandler. Change this

myCurator removeCuratorEditingArea (_HQ getVariable "_EA");

to this

myCurator removeCuratorEditingArea (_unit getVariable "_EA");

 

  • Thanks 1

Share this post


Link to post
Share on other sites
16 minutes ago, 7erra said:

That is because _HQ isn't defined in the eventhandler. Change this


myCurator removeCuratorEditingArea (_HQ getVariable "_EA");

to this


myCurator removeCuratorEditingArea (_unit getVariable "_EA");

 

Thanks!

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

×