[SOLVED] Problem with taking all armor from a player
Posted: Tue Aug 28, 2018 7:09 am
So I'm trying to make an armor which, on pickup, "calibrates" the armor and health values, setting them both to 999 and after a few seconds it returns health to 100, clears the 999 armor and replaces it with another armor class. Then it sets the player speed to 1.25, everything while blending from black to green.
Everything works, except for the "clear and replace armor" part.
Here are the codes:
DECORATE
ACS
How can I fix this?
Everything works, except for the "clear and replace armor" part.
Here are the codes:
DECORATE
Code: Select all
ACTOR UACEAI_NonCalibratedArmor : BasicArmorPickup //999 Armor
{
Armor.SaveAmount 999
Inventory.MaxAmount 1
Inventory.Amount 1
}
ACTOR UACEAI_NonCalibratedHealth : Health //999 health
{
Inventory.MaxAmount 999
Inventory.Amount 999
}
ACTOR UACEAI_ECArmorPickup : CustomInventory 31998 //The pickup
{
Inventory.PickupMessage ""
Inventory.Amount 1
Inventory.MaxAmount 1
+AUTOACTIVATE
States
{
Spawn:
ECAR A 10
ECAR A 5 Bright
Loop
Pickup:
TNT1 A 0 A_GiveInventory("UACEAI_ECArmorStartup") //Gives a "fake weapon" which displays the animation and executes the stuff.
TNT1 A 0 ACS_NamedExecuteAlways("UACEAI_ArmorStartup") //Sets weapon to the animation.
Stop
}
}
ACTOR UACEAI_ECArmor : BasicArmorPickup //The armor that should replace the 999 one, but for some reason doesn't.
{
Armor.SaveAmount 150
Armor.SavePercent 40
Inventory.Amount 1
Inventory.MaxAmount 200
}
ACTOR UACEAI_ECArmorStartup : Weapon //The "fake weapon" which executes the code and blends the screen.
{
Inventory.PickupMessage ""
+WEAPON.NOALERT
Tag "ARMOR STARTING UP..."
States
{
Select:
TNT1 A 0
Goto Ready
Deselect:
Ready:
TNT1 A 0 A_GunFlash
TNT1 A 0 SetPlayerProperty(0,1,PROP_TOTALLYFROZEN) //Prevents the player from moving, looking and shooting
TNT1 A 0 A_GiveInventory("UACEAI_NoncalibratedArmor") //Gives 999 armor
TNT1 A 0 A_GiveInventory("UACEAI_NoncalibratedHealth") //Gives 999 health
TNT1 A 0 A_Print("\cpShield and health values calibration...")
TNT1 A 175 //Long Delay
TNT1 A 0 A_TakeInventory("UACEAI_NoncalibratedArmor") //Here's the broken part. The function doesn't take the armor.
TNT1 A 0 ACS_NamedExecuteAlways("UACEAI_ResetHealth") //Resets health
TNT1 A 10 //Short Delay
TNT1 A 0 A_GiveInventory("UACEAI_ECArmor") //This should give the final armor, but doesn't, as the 999 armor value's higher than the other armor's
TNT1 A 0 A_Print("\cpCalibration complete. Activating movement functions...")
TNT1 A 105 //Yet another delay
TNT1 A 0 ACS_NamedExecuteAlways("UACEAI_Speed125") //Increases speed
TNT1 A 0 SetPlayerProperty(0,0,PROP_TOTALLYFROZEN) //Player is allowed to move, shoot, look
TNT1 A 0
TNT1 A 1 A_TakeInventory("UACEAI_ECArmorStartup") //Takes the animation weapon
Goto Deselect
Fire:
TNT1 A 0
Goto Ready
Flash:
TNT1 A 291 A_SetBlend("Black", 0.9, 290, "Green", 0.9) //Blends
Goto LightDone
}
}
Code: Select all
#library "uaceai_functions"
#include "zcommon.acs"
script "UACEAI_ResetHealth" (void)
{
SetActorProperty(0, APROP_HEALTH, 100);
}
script "UACEAI_Speed125" (void)
{
SetActorProperty(0, APROP_SPEED, 1.25);
}
script "UACEAI_ArmorStartup" (void) //Sets weapon to the animation
{
SetWeapon("UACEAI_ECArmorStartup");
}