I'm currently working on a TC with a score system, and I'm trying to make it so that when the player is damaged they lose points.
Here's my code so far.
Decorate code
Code: Select all
ACTOR NewMarine : Doomplayer
{
Player.StartItem "Clip", 24 //TODO: Replace clip with other ammo for 3d model support.
Player.StartItem "Revolver"
Player.StartItem "Kick"
States {
Pain:
PLAY G 4 A_GiveInventory("owie") //CULPRIT #1: Maybe this isn't actually giving the owie actor?
PLAY G 4 A_Pain
Goto Spawn
}
}
ACTOR owie : CustomInventory
{
Inventory.PickupMessage "owie" //TODO: remove when this shit works
iNVENTORY.AMOUNT 1
+AUTOACTIVATE
States
{
Spawn:
TNT1 A 1
Loop
PICKUP:
TNT1 A 0
Stop
}
}
Code: Select all
Script "PAINCHECK" (void) //Player loses points when hit by enemies
{
If(CheckInventory("owie")) //CULPRIT #2: Maybe this isn't finding the owie actor?
{
SetActorProperty(0, APROP_Score, (GetActorProperty(0, APROP_Score)-(Random(8,15))));
print(s:"OWIE!");
TakeInventory("owie", 1);
}
}
The issue is that when the player loses health and enters the pain state, they don't actually lose points for some reason.
I've left some comments where I think some issues might be, but I'm not 100% certain on what could be causing this to not work.