acr_death_i

Scripted ALFA systems & related tech discussions (ACR)

Moderators: ALFA Administrators, Staff - Technical

User avatar
AcadiusLost
Chosen of Forumamus, God of Forums
Posts: 5061
Joined: Tue Oct 19, 2004 8:38 am
Location: Montara, CA [GMT -8]
Contact:

Post by AcadiusLost »

While delving into custom animations and how to get around some of the looping bugs, I found a block of code that will keep the PC lying down through the bleeding process, at least under most conditions.

To be inserted into ACR_PlayerOnDying():

Code: Select all

PlayCustomAnimation(oPC, "proneb", 1);
DelayCommand(0.1, SetCommandable(FALSE, oPC)); 
I'll continue to test with it, but easier for the change to get rolled in with the NWNx4 retrofitting, I'll add it to the committed code once it appears if it doesn't make the commit.
User avatar
AcadiusLost
Chosen of Forumamus, God of Forums
Posts: 5061
Joined: Tue Oct 19, 2004 8:38 am
Location: Montara, CA [GMT -8]
Contact:

Post by AcadiusLost »

May need some more work, I think- some conditions are still putting the PC back up and doing the "ready for combat dance" currently.
User avatar
ç i p h é r
Retired
Posts: 2904
Joined: Fri Oct 21, 2005 4:12 pm
Location: US Central (GMT - 6)

Post by ç i p h é r »

That definitely works better. I'll add it in.
User avatar
AcadiusLost
Chosen of Forumamus, God of Forums
Posts: 5061
Joined: Tue Oct 19, 2004 8:38 am
Location: Montara, CA [GMT -8]
Contact:

Post by AcadiusLost »

Tested a fix for the gold drop when a PC dies, works well when added to the end of the _dropEquippedItems(object oTarget) function in acr_death_i.nss

Code: Select all

	// transfer all gold over to the corpse.
	int nPCGold = GetGold(oDead);
	CreateItemOnObject("NW_IT_GOLD001", oTarget, nPCGold);
	TakeGoldFromCreature(nPCGold, oDead, TRUE);
User avatar
ç i p h é r
Retired
Posts: 2904
Joined: Fri Oct 21, 2005 4:12 pm
Location: US Central (GMT - 6)

Post by ç i p h é r »

Yeah I got that in for the next (eventual) update.

Sorry for the delays, AL. I know you wanted to look at some SQL code. I didn't have time for ALFA this past week so I never got around to addressing the table issues I've been meaning to. The code compiles though, but I plan to test and optimize the code/SQL further. However, if you're eager to look through any of it, I can commit the changes immediately. Without the tables setup, none of the systems will work properly so don't let that worry you. You will need to have NWNx4 running to login to the server, naturally.

There's a bit more work to do with the death system too. The corpse inventories and locations are stored locally but need to be global since corpses can be moved from one server to the next. This actually deals with the essentials of movable persistent placeables.
User avatar
AcadiusLost
Chosen of Forumamus, God of Forums
Posts: 5061
Joined: Tue Oct 19, 2004 8:38 am
Location: Montara, CA [GMT -8]
Contact:

Post by AcadiusLost »

Another observation: we need a mechanic for other PCs helping to stabilize a bleeding character- right now they'll stop if they're healed back into the positives, but there are two other things we should account for:

-Stabilization by a "first aid" Heal check, DC15- halts bleeding but does not restore hitpoints. How should we implement this? Activatable weightless "First Aid" token? Bonus useable feat given to all PCs? The PnP skill description doesn't state that any special supplies are needed, though some kind of non-OE healers kit could give a circumstance bonus to the roll. Ideally, we should have a mechanic that can work on the hak-less OAS as well, so the feat implementation is nonideal.

-Stabilization by other forms of healing: according to the 3.5E PHB, any healing applied to the dying PC will stabilize them- so a cure minor on a PC at -9, would make them stabilized at -8. This goes for herbs as well as spells/scrolls. Should be implementable with a check between current HP and stored/predicted HP, if it's gone up, switch to "stabilized" mode.
User avatar
ç i p h é r
Retired
Posts: 2904
Joined: Fri Oct 21, 2005 4:12 pm
Location: US Central (GMT - 6)

Post by ç i p h é r »

AcadiusLost wrote:-Stabilization by a "first aid" Heal check, DC15- halts bleeding but does not restore hitpoints. How should we implement this? Activatable weightless "First Aid" token? Bonus useable feat given to all PCs? The PnP skill description doesn't state that any special supplies are needed, though some kind of non-OE healers kit could give a circumstance bonus to the roll. Ideally, we should have a mechanic that can work on the hak-less OAS as well, so the feat implementation is nonideal.
It needs to be triggered by something external but it looks like I did not provide the interface for a script to do this. I'll address that.

However, since there's no "use skill: xxx" mechanic in the game, this will have to be tied to an item (like our emote ball) or some GUI. The former requires a permanent item in the player's inventory and the latter requires the distribution of XML and script files.
-Stabilization by other forms of healing: according to the 3.5E PHB, any healing applied to the dying PC will stabilize them- so a cure minor on a PC at -9, would make them stabilized at -8. This goes for herbs as well as spells/scrolls. Should be implementable with a check between current HP and stored/predicted HP, if it's gone up, switch to "stabilized" mode.
This is already in. Anytime a player is healed, they should stabilize on the next check.
User avatar
AcadiusLost
Chosen of Forumamus, God of Forums
Posts: 5061
Joined: Tue Oct 19, 2004 8:38 am
Location: Montara, CA [GMT -8]
Contact:

Post by AcadiusLost »

For some reason, being stabilized by another PC isn't stopping the loss of health to bleeding. It seems perhaps there is a second interpretation of the term "stabilized" at work in the code, as evidenced here:

Code: Select all

 // check the player's health - if they stabilize, the bleeding slows down
        else if (d100() <= ACR_DTH_PERCENT_CHANCE)
        {
            // set the stabilized flag
            ACR_SetPersistentInt(oPC, ACR_PLAYER_FLAGS, ACR_GetPersistentInt(oPC, ACR_PLAYER_FLAGS) | ACR_PLAYER_FLAG_STABILIZED);

            // schedule another check
            DelayCommand(RoundsToSeconds(1), _playerStabilizeCheck(oPC));
            FloatingTextStringOnCreature("You have stabilized but continue to bleed slowly!", oPC, FALSE);
        }
I thought the whole idea was to make "Stabilization" stop the bleeding, aka make the PC "stable" but fixed at negative HP. Here it seems to be just "slowing" the bleeding, though it still seemed to come about 1/second in the test I performed. (So not much slowed either?)

Am I missing something?
User avatar
AcadiusLost
Chosen of Forumamus, God of Forums
Posts: 5061
Joined: Tue Oct 19, 2004 8:38 am
Location: Montara, CA [GMT -8]
Contact:

Post by AcadiusLost »

Can you clarify what the intent was with the "Stabilized but still bleeding" state was/is, Cipher? It seems paradoxical to me, but I don't want to second-guess things that aren't broken as bugs.

I checked with Spider for advice on the PnP rules, he confirmed that the HP loss should be halted by healing (already in), or by the first aid check (in, but doesn't stop the bleeding as coded).

Where it seems to get confusing is the 10% chance thing- I may have misunderstood his typing since he sent it on IRC in a hurry, but it seems he's saying:

-If a PC has been stabilized: 10% chance per hour to become conscious, but "staggered" (and still in negatives)

-If a PC has stabilized without treatment (10% chance?), they have a further 10% per hour chance of either A) starting to bleed again, or B) becoming conscious but "staggered" in negatives.

Not sure I've interpreted the latter correctly- but if I have, that could explain the dual interpretations of "stabilization"- though the code would still need work in that case. I don't think we have any way to handle being "staggered" currently (think it means you can crawl around with massive penalties to all actions- difficult to code, as I think NWN2 keeps you uncommandable/stuck whenever you're in negatives.

The easiest shorterm fix would be to put a check to see if a dying PC has been stabilized into the "healing check" part of the code, which halts the bleeding. I may do that for time being, but I'd prefer to know what you were going for with the original, so I don't "fix" away any "features". ;)

Your thoughts, Cipher?
User avatar
ç i p h é r
Retired
Posts: 2904
Joined: Fri Oct 21, 2005 4:12 pm
Location: US Central (GMT - 6)

Post by ç i p h é r »

That's what I thought as well, until I actually looked up the definition of "stable".
SRD wrote:Stable: A character who was dying but who has stopped losing hit points and still has negative hit points is stable. The character is no longer dying, but is still unconscious. If the character has become stable because of aid from another character (such as a Heal check or magical healing), then the character no longer loses hit points. He has a 10% chance each hour of becoming conscious and disabled (even though his hit points are still negative).

If the character became stable on his own and hasn’t had help, he is still at risk of losing hit points. Each hour, he has a 10% chance of becoming conscious and disabled. Otherwise he loses 1 hit point.
So using the heal skill, a heal spell, or making a natural healing check will stop bleeding. Otherwise, it still continues either once per round (unstable), once per hour (stable but unconscious), or once per day (stable and conscious but unhealed) depending on what checks the player has succeeded in making.

p.s. I don't think the HEAL skill mechanism is coded quite right yet.
User avatar
AcadiusLost
Chosen of Forumamus, God of Forums
Posts: 5061
Joined: Tue Oct 19, 2004 8:38 am
Location: Montara, CA [GMT -8]
Contact:

Post by AcadiusLost »

I coded the heal mechanism a few days back as an activatable weightless item for now, also accounted for Healers Kits (10 charges, +2 circumstance bonus) and the Self Sufficent feat (another +2 bonus). It doesn't set longterm healing or disease/poison curing yet though.

I still read that description as suggesting that being part-healed (but still in negatives) or receiving a successful First Aid heal check should halt the bleeding, indefinitely.

A player that's made an unassisted partial recovery (10% chance? Or are we talking a Natural Healing roll?), gets an hourly check.
10% chance to recover consciousness (still stable)
Otherwise loses 1 HP for the hour (but not the 1 hp/round or 1hp/sec that we seem to be using).

So the natural healing/unasssisted partial recovery check moves it to a 1/hour check, though it's not clear if additional 10% checks are needed if they make one of the "consciousness" rolls. Let's avoid calling any of these states "stable" for now, to avoid confusion. I'm thinking a successful "consciousness" check should halt all further checks- though I can see some problems with that from a game balance perspective as well.

Also, how did we want to handle folks who log out while they're in the / hour bleeding state? (or in the "true stable" state?)
User avatar
ç i p h é r
Retired
Posts: 2904
Joined: Fri Oct 21, 2005 4:12 pm
Location: US Central (GMT - 6)

Post by ç i p h é r »

AcadiusLost wrote:being part-healed (but still in negatives) or receiving a successful First Aid heal check should halt the bleeding, indefinitely.
That's right. But making a stabilization check isn't the same thing as being healed, which might be where the confusion arises. To stop bleeding, a dying player must be healed by either the skill, a spell, or a successful natural healing check (which they will make once per day).
A player that's made an unassisted partial recovery (10% chance? Or are we talking a Natural Healing roll?), gets an hourly check.
10% chance to recover consciousness (still stable)
Otherwise loses 1 HP for the hour (but not the 1 hp/round or 1hp/sec that we seem to be using).
It starts off with a once per round stabilization check. Failure results in a loss of 1 hit point. Success just slows bleeding by eliminating the once per round stabilization roll.

Once per hour, a consciousness check is performed. Failure results in a loss of 1 hit point. Success slows bleeding further by eliminating the hourly consciousness check.

Once per day, a natural healing check is performed. Failure results in a loss of 1 hit point. Success stops bleeding.

All checks are 10% checks. A HEAL at any point will stop the bleeding.
Also, how did we want to handle folks who log out while they're in the / hour bleeding state? (or in the "true stable" state?)
You mean should we just pick up where they left off or make the rolls for them while they are logged off? The latter will certainly be more difficult to pull off but I can see why you're suggesting it.
User avatar
AcadiusLost
Chosen of Forumamus, God of Forums
Posts: 5061
Joined: Tue Oct 19, 2004 8:38 am
Location: Montara, CA [GMT -8]
Contact:

Post by AcadiusLost »

Allright, I think I've got a pretty clear handle on it, will try to amend the code tonight.
User avatar
ç i p h é r
Retired
Posts: 2904
Joined: Fri Oct 21, 2005 4:12 pm
Location: US Central (GMT - 6)

Post by ç i p h é r »

AcadiusLost wrote:will try to amend the code tonight.
Anything in particular? The checks/timers seemed to be working properly (easy to test by advancing the round counter in the database). Maybe there's a time compression issue if things are progressing too quickly on your end?
User avatar
AcadiusLost
Chosen of Forumamus, God of Forums
Posts: 5061
Joined: Tue Oct 19, 2004 8:38 am
Location: Montara, CA [GMT -8]
Contact:

Post by AcadiusLost »

Let's see, for acr_death_i so far I've:

-Added back some SetFirstName() calls on mutilated corpses

-Added a shape-based handling for redirecting mob attacks on downed PCs, (doesn't work currently, still testing- but they continue to attack dying PCs with ranged weapons even while other alive PCs are in their face pounding on them, so I'd say it is an issue).

-Added handling exception for OOC inventory items, so they aren't dropped on corpses (activatable first aid item)

-Added exception handling for dying with a PC corpse in inventory (still needs work, trying to keep from having to create an undertaker twice or adding another inventory loop)

-Changed the ABR corpse placeable to turn off dynamic collisions, which were trapping PCs inside the unwalkable area of any body they set down.

-Trying to fix RestoreCorpsesOnModuleLoad, which is coming up with all locations invalid currently (even when called from a lever)- they are recovered by StringToLocation, but fail GetIsValidLocation every time.

-Trying to work out what needs to be done to script a rez lever for Beta testing.

Other issues:

The ACR_StabilizePlayer() function informs the player that they are stabilized, but they keep losing health at full pace. If that's supposed to be the external hook used for the Heal skill, it needs to get treated the same as real healing (HP > stored HP) in terms of the decision tree.

The "Natural partial recovery" case described above is explained to slow down the process, but then schedules the next check at RoundsToSeconds(1) anyway. Should change to HoursToSeconds(1).

PCs who log out during the bleeding process should get, at the least, a specific log event- if not actual examination of offline time in term of the dying timetable. This should have some handling for when the PC logs back in as well, to inform the player.
Locked