Hi guys, got two possibly stupid questions for yous:
1) How do I get a health metre going for a player pawn. I read the tutorials, but I can't really determine the exact process.
2) I would like to add an experience attribute to my player pawn, but so far I've had no luck. I've tried to use the AddAttribute command, but it seems to have no effect what so ever.
Thanks
Attributes
Attributes
A good warrior knows his limits, but a great warrior finds his way around them.
You can use the built-in player's attributes for a scripted player too.
1.) Give your scripted player a health attribute and add an attribute to the built-in player's attributes. Then just synchronize the two attributes within your script with SetAttribute(ATTRIBUTENAME, VALUE, "Player"). Then you can use the HUD normally to display a health meter.
2.) I think you should make the experience attribute a built-in player attribute only. That way you can modify it from any script with ModifyAttribute(ATTRIBUTENAME, VALUE, "Player") and read it with GetAttribute(ATTRIBUTENAME,"Player").
1.) Give your scripted player a health attribute and add an attribute to the built-in player's attributes. Then just synchronize the two attributes within your script with SetAttribute(ATTRIBUTENAME, VALUE, "Player"). Then you can use the HUD normally to display a health meter.
2.) I think you should make the experience attribute a built-in player attribute only. That way you can modify it from any script with ModifyAttribute(ATTRIBUTENAME, VALUE, "Player") and read it with GetAttribute(ATTRIBUTENAME,"Player").
Pain is only psychological.
Got both to work, but when I synchronise the health attribute of my player pawn and the built in player's, the health bar decreases to 0 on my first hit. My pawn is still alive though. Here's my script:
Code: Select all
HEALTHATTRIB [healthgood]
PAWNHEALTH [self.health]
if(self.in_pain)
{
self.think="Pain";
}
}]
Pain[()
{
SetAttribute(HEALTHATTRIB,PAWNHEALTH,"Player");
self.think="Fight";
}
}]
A good warrior knows his limits, but a great warrior finds his way around them.