BoneTown:スクリプトでキーボードキーを使用してプレーヤーの速度を変更する方法

これは、キーボードキーを使用してプレーヤーの速度を変更する方法に関する簡単なチュートリアルです。

 

スクリプトでキーボードキーを使用してプレーヤーの速度を変更する方法

したがって、このコードをコピーして、bonetown / game / mods/myfirstscript.csに配置します。

//declare our global variable to store the speed, it will increase each time you press  the keys
$myplayerspeed = "3";

// then our function to be called :
function changeplayerspeed()
{
	%tChar = ServerConnection.GameCharacter; //get the player object from engine
		if(%tChar !$= "" && %tChar !$= "0") //ensure the mission and player object are loaded !!!
		{  
			%tChar.modifySpeed($myplayerspeed, 1);  // set to speed to 4 or more ,change the value to test XD

                       $myplayerspeed++;  // this allow to auto increase the value each time the function is called by pressing the keys
		}
}



// this will call the function when you press CTRL + J  keys ingame
GlobalActionMap.bind(keyboard, "ctrl j", "changeplayerspeed", "Description: change the player speed to 4");

ゲームをロードしてミッションに参加したら、CTRL + Jキーを押すと、以前よりも速くプレイできるようになります。

By コードマン02Fr

コメント

ArabicEnglishFrenchGermanItalianJapaneseKoreanPortugueseSpanish