Jump to content
Sign in to follow this  
pcc

allowDamage false for 3 minutes on warfare structures

Recommended Posts

I'm trying to prevent damage to warfare base structures during the first 3 minutes like spawn protection.

Tried this in Construction_MediumSite.sqf, but with the "if (time <180)" statement, the handledamage and allowDamage false stops working.

 

Spoiler

//Set default allowed factions for structure.
	_data = [_site] Call BIS_WF_GetDataOnBaseStructure;
	if (Count _data > 0) then 
	{
		_site SetVariable["factions",_data Select 7,true];
		[_data select 6, MSGBaseStructureConstructed,_data Select 0] Call BIS_WF_SideMessage;
		if (time < 180) then
		{
			_site allowDamage false;
		}
		else
		_site addEventHandler ["HandleDamage",{if (_this select 1=="") then {damage (_this select 0)+((_this select 2)/2)}}];
	};
};

 

 

 

Share this post


Link to post
Share on other sites

Check .rpt log, it should have thrown an error.  The "else" isn't coded correctly.  Also, there's no return when select 1 isn't an empty string (""), and the allowDamage false would be continuous beyond 180.  Maybe try this:

if (time < 180) then
{
	_site allowDamage false;
	WaitUntil {time >= 180};
	_site addEventHandler ["HandleDamage",{if (_this select 1 == "") then {damage (_this select 0)+((_this select 2)/2)} else {damage (_this select 0)+(_this select 2)};}];
	_site allowDamage true;
} else
{
	_site addEventHandler ["HandleDamage",{if (_this select 1 == "") then {damage (_this select 0)+((_this select 2)/2)} else {damage (_this select 0)+(_this select 2)};}];
};

If you reinstalled Steam recently check to be sure you still have startup param -showScriptErrors.  Doing so deleted my startup params and I had to put them back in.

  • Like 1

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  

×