Jelajahi Sumber

added airborne jumppack script

Namenai 7 tahun lalu
induk
melakukan
3456b6d3e3

+ 22 - 0
Scripts/initPlayerLocal.sqf

@@ -0,0 +1,22 @@
+/*
+(_this select 0) addEventHandler ["InventoryOpened", {
+	
+	namUnit=(_this select 0);
+	_namBackPack=typeof(unitBackpack namUnit);
+	_namIsConfigured=namUnit getVariable ["namJumpPackConfig", false];
+	if(!_namIsConfigured && {_namBackPack isEqualTo "SWOP_B_CloneDV"}) then
+	{
+	
+		[namUnit] execVM "scripts\zeus3denScripts\playerBased\airborne\HJS Protocal\jumpAssinger.sqf";
+		[namUnit] execVM "scripts\zeus3denScripts\playerBased\airborne\HJS Protocal\jumpDecider.sqf";
+		[namUnit] execVM "scripts\zeus3denScripts\playerBased\airborne\HJS Protocal\jumpDeciderUp.sqf";
+		[namUnit] execVM "scripts\zeus3denScripts\playerBased\airborne\HJS Protocal\jumpHandler.sqf";
+		namUnit setVariable ["namJumpPackConfig", true, true];
+		
+		hint parseText  format["<t color='#40e0d0'>Namenai's Horseborne JumpScript Protocal has been initiated.(HJS Protocal)</t> "];
+	};
+	
+}];
+
+
+*/

+ 19 - 0
Scripts/scripts/zeus3denScripts/playerBased/airborne/HJS Protocal/jumpAssinger.sqf

@@ -0,0 +1,19 @@
+
+//params["personToApply"];
+personToApply=_this select 0;
+personToApply removeAllEventHandlers "HandleDamage";
+removeAllActions personToApply;
+
+comment "is Jumping-0
+		last jump time-1
+		jump counter-2
+		cooldown-3
+		max consecutive jumps-4";
+jumpData=[false,0,0,5,2];
+
+personToApply setVariable ["jumpArray", jumpData,true];
+
+
+
+
+

+ 103 - 0
Scripts/scripts/zeus3denScripts/playerBased/airborne/HJS Protocal/jumpDecider.sqf

@@ -0,0 +1,103 @@
+//Params["personToApply"];
+personToApply=_this select 0;
+	personToApply  addAction ["<t color='#886600'>forward jump--------U13</t>",
+	{
+		_namUnit=_this select 0;
+		_namThisJumpData=_namUnit getVariable["jumpArray",[]];
+		
+		if((count _namThisJumpData) ==0) then 
+		{
+			exit;
+		};
+		
+		
+		
+		comment "data from jump array";
+		
+		comment "is Jumping-0
+		last jump time-1
+		jump counter-2
+		cooldown-3
+		max consecutive jumps-4
+		!C or (!A and B)";
+		
+		_namIsJumping=_namThisJumpData select 0;
+		_namLastJumpTime=_namThisJumpData select 1;
+		_namJumpCounter=_namThisJumpData select 2;
+		_namJumpCooldownTime=_namThisJumpData select 3;
+		_namMaxJump=_namThisJumpData select 4;
+		comment "A-is jumping B-is cooled C-is over counter /// karnugh map variables";
+		
+		_namTimeSinceLastJump=time-_namLastJumpTime;
+		
+		_A=_namIsJumping;
+		comment "true if cooled";
+		_B=(_namTimeSinceLastJump)>_namJumpCooldownTime;
+		comment "true if u just 'double jumped'";
+		_C=_namJumpCounter>=_namMaxJump;
+		
+		if((count _namThisJumpData) !=0) then
+		{
+			
+			_namIsOverCounter=_C;
+			_namIsCool=(time-_namLastJumpTime)>=_namJumpCooldownTime;
+			
+			comment "if ur cooled then reset counter";
+			if(_B)then
+			{
+				_namJumpCounter=0;
+				_namUnit setVariable ["jumpArray", [_namIsJumping,_namLastJumpTime,_namJumpCounter,_namJumpCooldownTime,_namMaxJump],true];
+			};
+
+			
+
+			if(!_C || {!_A && {_B}}) then 
+			{
+				_namSpeed=20;
+				_namSpeedUp=5;
+				
+				comment "initiate jump";
+				(_namUnit) setVelocity 
+				[
+				(velocity (_namUnit) select 0)+((vectordir (_namUnit)) select 0)*_namSpeed,
+				(velocity (_namUnit) select 1)+((vectordir (_namUnit)) select 1)*_namSpeed,
+				(velocity (_namUnit) select 2)+_namSpeedUp
+				];
+				
+				comment "update variables";
+				_namIsJumping=true;
+				_namLastJumpTime=time;
+				_namJumpCounter=_namJumpCounter+1;
+				
+				_namUnit setVariable ["jumpArray", [_namIsJumping,_namLastJumpTime,_namJumpCounter,_namJumpCooldownTime,_namMaxJump],true];
+
+			}
+			else
+			{
+
+				hint parseText  format["Can not boost. <t color='#40e0d0'>Cooldown done in</t> <t color='#FF0000'>%1</t>",(_namJumpCooldownTime-(time-_namLastJumpTime))];
+				
+				if(!_C && _B) then 
+				{	
+					_namJumpCounter=0;
+					_namUnit setVariable ["jumpArray", [_namIsJumping,_namLastJumpTime,_namJumpCounter,_namJumpCooldownTime,_namMaxJump],true];
+				};
+			};
+
+
+
+
+
+
+		};
+
+
+
+	}
+	,[1],0,false,true,"User13"," driver  _target == _this"];
+
+
+
+
+
+

+ 103 - 0
Scripts/scripts/zeus3denScripts/playerBased/airborne/HJS Protocal/jumpDeciderUp.sqf

@@ -0,0 +1,103 @@
+//Params["personToApply"];
+personToApply=_this select 0;
+	personToApply  addAction ["<t color='#886600'>forward jump--------U13</t>",
+	{
+		_namUnit=_this select 0;
+		_namThisJumpData=_namUnit getVariable["jumpArray",[]];
+		
+		
+		if((count _namThisJumpData) ==0) then 
+		{
+			exit;
+		};
+		
+		
+		
+		comment "data from jump array";
+		
+		comment "is Jumping-0
+		last jump time-1
+		jump counter-2
+		cooldown-3
+		max consecutive jumps-4
+		!C or (!A and B)";
+		
+		_namIsJumping=_namThisJumpData select 0;
+		_namLastJumpTime=_namThisJumpData select 1;
+		_namJumpCounter=_namThisJumpData select 2;
+		_namJumpCooldownTime=_namThisJumpData select 3;
+		_namMaxJump=_namThisJumpData select 4;
+		comment "A-is jumping B-is cooled C-is over counter /// karnugh map variables";
+		
+		_namTimeSinceLastJump=time-_namLastJumpTime;
+		
+		_A=_namIsJumping;
+		comment "true if cooled";
+		_B=(_namTimeSinceLastJump)>_namJumpCooldownTime;
+		comment "true if u just 'double jumped'";
+		_C=_namJumpCounter>=_namMaxJump;
+		
+		if((count _namThisJumpData) !=0) then
+		{
+			
+			_namIsOverCounter=_C;
+			_namIsCool=(time-_namLastJumpTime)>=_namJumpCooldownTime;
+			
+			comment "if ur cooled then reset counter";
+			if(_B)then
+			{
+				_namJumpCounter=0;
+				_namUnit setVariable ["jumpArray", [_namIsJumping,_namLastJumpTime,_namJumpCounter,_namJumpCooldownTime,_namMaxJump],true];
+			};
+
+			
+
+			if(!_C || {!_A && {_B}}) then 
+			{
+				_namSpeed=20;
+				_namSpeedUp=20;
+				
+				comment "initiate jump";
+				(_namUnit) setVelocity 
+				[
+				(velocity (_namUnit) select 0)+((vectordir (_namUnit)) select 0)*_namSpeed,
+				(velocity (_namUnit) select 1)+((vectordir (_namUnit)) select 1)*_namSpeed,
+				(velocity (_namUnit) select 2)+_namSpeedUp
+				];
+				
+				comment "update variables";
+				_namIsJumping=true;
+				_namLastJumpTime=time;
+				_namJumpCounter=_namJumpCounter+1;
+				
+				_namUnit setVariable ["jumpArray", [_namIsJumping,_namLastJumpTime,_namJumpCounter,_namJumpCooldownTime,_namMaxJump],true];
+
+			}
+			else
+			{
+
+				hint parseText  format["Can not boost. <t color='#40e0d0'>Cooldown done in</t> <t color='#FF0000'>%1</t>",(_namJumpCooldownTime-(time-_namLastJumpTime))];
+				
+				if(!_C && _B) then 
+				{	
+					_namJumpCounter=0;
+					_namUnit setVariable ["jumpArray", [_namIsJumping,_namLastJumpTime,_namJumpCounter,_namJumpCooldownTime,_namMaxJump],true];
+				};
+			};
+
+
+
+
+
+
+		};
+
+
+
+	}
+	,[1],0,false,true,"User14"," driver  _target == _this"];
+
+
+
+
+

+ 73 - 0
Scripts/scripts/zeus3denScripts/playerBased/airborne/HJS Protocal/jumpHandler.sqf

@@ -0,0 +1,73 @@
+//Params["personToApply"];
+personToApply=_this select 0;
+	personToApply addEventHandler ["HandleDamage",
+	{
+		_returnDmg=_this select 2;
+		_namUnit=_this select 0;
+	
+		_namThisJumpData=_namUnit getVariable["jumpArray",[]];
+		
+		comment "is Jumping-0
+		last jump time-1
+		jump counter-2
+		cooldown-3
+		max consecutive jumps-4
+		C || (!A and B)";
+		
+		_namIsJumping=_namThisJumpData select 0;
+		_namLastJumpTime=_namThisJumpData select 1;
+		_namJumpCounter=_namThisJumpData select 2;
+		_namJumpCooldownTime=_namThisJumpData select 3;
+		_namMaxJump=_namThisJumpData select 4;
+
+		
+		if(((count _namThisJumpData)!=0) && {_namIsJumping}) then 
+		{
+			_returnDmg=0;
+
+			if(isTouchingGround _namUnit) then
+			{
+			
+
+				_null = _this spawn
+				{
+
+
+					_namUnitSpawn=(_this select 0);
+
+
+					_namThisJumpDataSpawn= _namUnitSpawn getVariable["jumpArray",[]];
+
+
+
+					for [{_i=0}, {_i<10}, {_i=_i+1}] do
+					{
+						sleep 0.01;
+
+						if((abs speed _namUnitSpawn)<1) then
+						{
+							_namIsJumpingSpawn=false;
+							[west, "HQ"] sideChat format["%1 speed is %2",time,(_namThisJumpDataSpawn select 2)];
+						
+							_namUnitSpawn setVariable ["jumpArray", [_namIsJumpingSpawn,(_namThisJumpDataSpawn select 1),(_namThisJumpDataSpawn select 2),(_namThisJumpDataSpawn select 3),(_namThisJumpDataSpawn select 4)],true];
+
+							
+							_i=11;
+						};
+					};
+
+					
+
+
+				};
+
+
+			};
+
+		};
+
+
+	
+
+		_returnDmg
+	}];

+ 11 - 2
Scripts/scripts/zeus3denScripts/readme.txt

@@ -1,4 +1,4 @@
-last update 3/26/2018 4:40 PM  est by namenai
+last update 4/2/2018 10:23 PM  est by namenai
 
 Here is the file path of various scripts,if its not listed here then its probably 1)scripts being prepped or 2) we forgot :P
 
@@ -129,7 +129,16 @@ Here is the file path of various scripts,if its not listed here then its probabl
 			[] execVM "scripts\zeus3denScripts\playerBased\aviation\wardenBased\wardenAmmoBox.sqf";
 			[this] execVM "scripts\zeus3denScripts\playerBased\aviation\wardenBased\wardenAmmoBox.sqf";//for when you want this on a object in 3den
 			[_this] execVM "scripts\zeus3denScripts\playerBased\aviation\wardenBased\wardenAmmoBox.sqf";//for when you want to apply it during zeus
-
+	//Airborne Based
+		//HJS Protcal(AKA Custom JumpPack Script) (HJS means Horseborne Jump Script) parameter namUnit is the unit that is gona get it
+			//Ran in initPlayerLocal.sqf which is ran client side whenever someone joins. Only adds the script to them once and when they open inventory and if they have the right jetpack ---H
+				[namUnit] execVM "scripts\zeus3denScripts\playerBased\airborne\HJS Protocal\jumpAssinger.sqf";
+			//Called by assinger adds the forward jump and decides if that person can ---X ^
+				[namUnit] execVM "scripts\zeus3denScripts\playerBased\airborne\HJS Protocal\jumpDecider.sqf";
+			//Called by assinger adds the vertica jump and decides if that person can ---X ^^	
+				[namUnit] execVM "scripts\zeus3denScripts\playerBased\airborne\HJS Protocal\jumpDeciderUp.sqf";
+			//Called by assinger adds the logic to prevent dmg on landing ---X ^^^	
+				[namUnit] execVM "scripts\zeus3denScripts\playerBased\airborne\HJS Protocal\jumpHandler.sqf";
 	
 	
 //AI Based---Changes to NPC or things that will mostly not be players