if (StrICmp(weapon, "KickWeapon") && CheckInventory("StaminaActor") >= 5) //If more than 5 stamina, continue. Replace 5 with any amount
{
SetPlayerProperty(0, 1, PROP_INSTANTWEAPONSWITCH);
GiveInventory("KickWeapon", 1);
GiveInventory("Kicking", 1);
SetWeapon("KickWeapon");
TakeInventory("StaminaActor",5); //Replace 5 with the amount to take
While (CheckInventory("Kicking"))
Delay(1);
SetWeapon(weapon);
TakeInventory("KickWeapon", 1);
Delay(3);
SetPlayerProperty(0, 0, PROP_INSTANTWEAPONSWITCH);
}
You will also need a script to restore stamina to the player. (Unless it's supposed to be restored another way) This script does that:
Script "StaminaRestore" ENTER
{
While(true)
{
GiveInventory("StaminaActor",1);
Delay(35); //Loop this script every second. (35 tics) Modify to will
}
}
Script "Kick" (void)
{
str weapon = GetWeapon();
if (StrICmp(weapon, "KickWeapon") && CheckInventory("StaminaActor") >= 20) //If more than 5 stamina, continue. Replace 5 with any amount
{
SetPlayerProperty(0, 1, PROP_INSTANTWEAPONSWITCH);
GiveInventory("KickWeapon", 1);
GiveInventory("Kicking", 1);
SetWeapon("KickWeapon");
TakeInventory("StaminaActor",20);
While (CheckInventory("Kicking"))
Delay(1);
SetWeapon(weapon);
TakeInventory("KickWeapon", 1);
Delay(3);
SetPlayerProperty(0, 0, PROP_INSTANTWEAPONSWITCH);
}
}
Script "StaminaRestore" ENTER
{
While(true)
{
If(!CheckInventory("StaminaActor")){Delay(140); GiveInventory("StaminaActor",20);}
Delay(1);
}
}
Also this kind of stamina restore script might work better here.
Also don't forget to compile the script, you will have to press this blue arrow in upper right corner of the editor in SLADE:
You will also need to specify a path to ACC to compile it properly.