瀏覽代碼

updated how jumpack handle dmg works,calculates velo when given distance and how the jumpdecider works

Namenai 7 年之前
父節點
當前提交
033a783aea

+ 5 - 6
Scripts/initPlayerLocal.sqf

@@ -1,4 +1,4 @@
-/*
+
 (_this select 0) addEventHandler ["InventoryOpened", {
 	
 	namUnit=(_this select 0);
@@ -8,12 +8,12 @@
 	{
 	
 		[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\jumpShort.sqf";
+		[namUnit] execVM "scripts\zeus3denScripts\playerBased\airborne\HJS Protocal\jumpLong.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> "];
+
+		hint parseText  format["<t color='#40e0d0'>Namenai's Horseborne JumpScript Protocal has been initiated.(HJS Protocal)</t> <img image='scripts\zeus3denScripts\playerBased\airborne\HJS Protocal\horseborneImage.jpg' <img size='20' />"];
 	};
 	
 }];
@@ -23,4 +23,3 @@
 namUnit=(_this select 0);
 namUnit setVariable ["namJumpPackConfig", false, true];
 }];
-*/

二進制
Scripts/scripts/zeus3denScripts/playerBased/airborne/HJS Protocal/horseborneImage.jpg


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

@@ -13,7 +13,33 @@ jumpData=[false,0,0,5,2];
 
 personToApply setVariable ["jumpArray", jumpData,true];
 
+_namShortJumpDistY=5;//in meters
+_namShortJumpDistX=10;//in meters
 
+_namShortJumpVeloY;//meters/second
+_namShortJumpVeloX;//meters/second
 
 
+_namLongJumpDistY=20;//in meters
+_namLongJumpDistX=40;//in meters
 
+_namLongJumpVeloY;//meters/second
+_namLongJumpVeloX;//meters/second
+
+
+
+
+//Short calculations
+_namShortJumpVeloY=sqrt(_2*-9.8*_namShortJumpDistY);
+_tShort=(-_namShortJumpDistY)/(-9.8);
+_namShortJumpVeloX=_namShortJumpDistX/(2*_tShort);
+
+//Long calculations
+_namLongJumpVeloY=sqrt(_2*-9.8*_namLongJumpDistY);
+_tLong=(-_namLongJumpDistY)/(-9.8);
+_namLongJumpVeloX=_namLongJumpDistX/(2*_tLong);
+
+
+jumpPhysicsData=[[_namShortJumpVeloX,_namShortJumpVeloY],[_namLongJumpVeloX,_namLongJumpVeloY]];
+
+personToApply setVariable ["jumpPhysicsArray", jumpPhysicsData,true];

+ 12 - 27
Scripts/scripts/zeus3denScripts/playerBased/airborne/HJS Protocal/jumpDecider.sqf

@@ -1,13 +1,13 @@
-//Params["personToApply"];
-personToApply=_this select 0;
-	personToApply  addAction ["<t color='#886600'>forward jump--------U13</t>",
-	{
+Params["namUnit"];
+
+	
 		_namUnit=_this select 0;
 		_namThisJumpData=_namUnit getVariable["jumpArray",[]];
+		_result=false;
 		
 		if((count _namThisJumpData) ==0) then 
 		{
-			exit;
+			_namThisJumpData=[false,0,0,5,2];
 		};
 		
 		
@@ -51,25 +51,10 @@ personToApply=_this select 0;
 
 			
 
-			if(!_C || {!_A && {_B}}) then 
+			if(!_C || {!_A && {_B}}) then //true if u can jump
 			{
-				_namSpeed=20;
-				_namSpeedUp=5;
-				
-				comment "initiate jump";
-				(_namUnit) setVelocity 
-				[
-				((vectordir (_namUnit)) select 0)*_namSpeed,
-				((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];
+				_result=true;
+				_result
 
 			}
 			else
@@ -77,15 +62,16 @@ personToApply=_this select 0;
 
 				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 
+				if(_B || {(_namJumpCooldownTime-(time-_namLastJumpTime))<0}) then 
 				{	
 					_namJumpCounter=0;
 					_namUnit setVariable ["jumpArray", [_namIsJumping,_namLastJumpTime,_namJumpCounter,_namJumpCooldownTime,_namMaxJump],true];
 				};
+				_result=false;
 			};
 
 
-
+		_result//return value
 
 
 
@@ -93,8 +79,7 @@ personToApply=_this select 0;
 
 
 
-	}
-	,[1],0,false,true,"User13"," driver  _target == _this"];
+
 
 
 

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

@@ -1,103 +0,0 @@
-//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 
-				[
-				((vectordir (_namUnit)) select 0)*_namSpeed,
-				((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"];
-
-
-
-
-

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

@@ -69,5 +69,5 @@ personToApply=_this select 0;
 
 	
 
-		_returnDmg
+		
 	}];

+ 39 - 0
Scripts/scripts/zeus3denScripts/playerBased/airborne/HJS Protocal/jumpLong.sqf

@@ -0,0 +1,39 @@
+//Params["personToApply"];
+personToApply=_this select 0;
+	personToApply  addAction ["<t color='#886600'>forward jump--------U13</t>",
+	{
+		_namUnit=_this select 0;
+		_resultIfJump=[_this select 0] execVM "scripts\zeus3denScripts\playerBased\airborne\HJS Protocal\jumpDecider.sqf";
+		
+		if(_resultIfJump) then
+		{
+			_namJumpPhysicsArray=_namUnit getVariable["jumpPhysicsArray",[[5,5],[20,40]]];
+		
+			_namSpeed=(_namJumpPhysicsArray select 1) select 0;
+			_namSpeedUp=(_namJumpPhysicsArray select 1) select 1;
+			
+			comment "initiate jump";
+			(_namUnit) setVelocity 
+			[
+			((vectordir (_namUnit)) select 0)*_namSpeed,
+			((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];
+		};
+
+
+
+	}
+	,[1],0,false,true,"User14"," driver  _target == _this"];
+
+
+
+
+

+ 41 - 0
Scripts/scripts/zeus3denScripts/playerBased/airborne/HJS Protocal/jumpShort.sqf

@@ -0,0 +1,41 @@
+//Params["personToApply"];
+personToApply=_this select 0;
+	personToApply  addAction ["<t color='#886600'>forward jump--------U13</t>",
+	{	
+		_namUnit=_this select 0;
+		_resultIfJump=[_this select 0] execVM "scripts\zeus3denScripts\playerBased\airborne\HJS Protocal\jumpDecider.sqf";
+		
+		if(_resultIfJump) then
+		{
+			_namJumpPhysicsArray=_namUnit getVariable["jumpPhysicsArray",[[5,5],[20,40]]];
+		
+			_namSpeed=(_namJumpPhysicsArray select 0) select 0;
+			_namSpeedUp=(_namJumpPhysicsArray select 0) select 1;
+			
+			comment "initiate jump";
+			(_namUnit) setVelocity 
+			[
+			((vectordir (_namUnit)) select 0)*_namSpeed,
+			((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];
+		};
+		
+
+
+
+	}
+	,[1],0,false,true,"User13"," driver  _target == _this"];
+
+
+
+
+
+

+ 7 - 5
Scripts/scripts/zeus3denScripts/readme.txt

@@ -1,4 +1,4 @@
-last update 3/29/2018 4:40 PM  est by Rexi
+last update 4/3/2018 5:45 PM  est by Rexi
 
 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
 
@@ -160,11 +160,13 @@ Here is the file path of various scripts,if its not listed here then its probabl
 		//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 ^
+			//Called by assinger adds the short jump  ---X ^
+				[namUnit] execVM "scripts\zeus3denScripts\playerBased\airborne\HJS Protocal\jumpShort.sqf";
+			//Called by assinger adds the long jump  ---X ^^	
+				[namUnit] execVM "scripts\zeus3denScripts\playerBased\airborne\HJS Protocal\jumpLong.sqf";
+			//Called by the jumps, decides if the person can jump ---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 ^^^	
+			//Called by assinger adds the logic to prevent dmg on landing ---X ^^^^	
 				[namUnit] execVM "scripts\zeus3denScripts\playerBased\airborne\HJS Protocal\jumpHandler.sqf";