Here is the script, activate it by pressing ALT and D, if you keep testing you will notice the counter will still monitoring the script, but sometimes the jump isn't applied.
Code: Select all
Events.UpdateCallback m_updateEvent = null;
bool Activated=true;
Dictionary<int, Player> Plist = new Dictionary<int, Player>();
public void OnStartup(){
m_updateEvent = Events.UpdateCallback.Start(OnUpdate);
}
class Player{
public bool toggle=true;
public int count=2;
public void Activate(int x){
IObjectTimerTrigger timer= (IObjectTimerTrigger) Game.CreateObject("TimerTrigger");
timer.CustomID=x.ToString();
timer.SetIntervalTime(500);
timer.SetScriptMethod("Reset");
timer.Trigger();
}
}
public void Reset(TriggerArgs arg){
IObjectTimerTrigger timer= (IObjectTimerTrigger) arg.Caller;
Plist[Int32.Parse(timer.CustomID)].toggle=true;
timer.Remove();
}
public void OnUpdate(float elapsed)
{
foreach(IPlayer temp in Game.GetPlayers())
{
if(!temp.IsBot)
{
if(!Plist.ContainsKey(temp.UniqueID))
{
Player x=new Player();
Plist.Add(temp.UniqueID,x);
}
Game.ShowPopupMessage(""+Plist[temp.UniqueID].count);
if (temp.IsWalking && temp.IsBlocking && Plist[temp.UniqueID].toggle && Plist[temp.UniqueID].count>0 )
{
Plist[temp.UniqueID].toggle=false;
temp.SetLinearVelocity(new Vector2(0f,10f));
Plist[temp.UniqueID].count--;
Plist[temp.UniqueID].Activate(temp.UniqueID);
}
if (temp.IsOnGround && Plist[temp.UniqueID].toggle)
Plist[temp.UniqueID].count=2;
if (!temp.IsOnGround && Plist[temp.UniqueID].count==2)
Plist[temp.UniqueID].count=1;
}
}
}
