STAR TREK 2d20
  1. #1

    Apply "Stable" effect as a player in 3.5/PFRPG

    I'm trying to have an extension allow the player to initiate a stabilization check roll in 3.5/PFRPG when dying. It works in so far as the roll occurs, and the results gets sent to the chat, but on success, the character is still left in the dying state despite the code path occurring to apply the stable effect. On a failed check, the negative consequences do correctly occur (one pt of damage).

    I'm assuming this is happening because the processing of the roll is happening on the player side and not on the host. But, I am not sure what I need to do to resolve this. Currently, the player code is creating a roll which eventually ends up calling `onStabilization()` in manager_action_damage.lua, which then calls `ActorManager35E.applyStableEffect(rSource);` on success. I can override `ActorManager35E.applyStableEffect()` to change the behavior if it's not a host running the code, but am not sure what would need to be done. Somehow send the effect to the host for processing?

    Any pointers on what I'm missing? I've been trying to find examples of this, since I suspect it is done elsewhere in either the existing rulesets or some other extensions, but haven't gotten the correct search terms yet.

    Thanks,
    Brian

  2. #2
    Just a quick note that the stabilization code in 3.5E is already in place, using the house rule in Options titled "Combat: Auto stabilization rolls". Since this mechanism is set up to run on end of turn on the GM machine, it's not really set up to be triggered from client right now.

    On a general note, effects can't be applied by players. They have to be forwarded to the GM client to be applied, since the GM "owns" all the data (including the combat tracker data). The PCs only own their PC sheet data.

    So, you can either send a custom OOB message to GM client to trigger the stabilization on the host given the code like CombatManager2.onTurnEnd in the 3.5E ruleset; OR you can build an effect "roll action", and pipe through the ActionsManager.performAction call which will handle the OOB (i.e. this is how spell effects are handled).

    Regards,
    JPG

  3. #3
    Thank you for the clarification. I have been using the option to have the auto-stabilization run on turn end, however want to give the option for players to feel like they were making the roll themselves rather have it auto-trigger, which is what sent me down this path.

    Based on what you mentioned as options I now have some more ideas to try and examples of code to check.

    Thank you, as always, for your amazingly quick and helpful replies.

    Cheers,
    Brian

  4. #4
    I got it all working now, but had a followup question. Is the any danger or reason why one should not call EffectManager.notifyApply() to cause an OOB effect message to be sent to the host? I have overridden the ActorManager35.applyStableEffect() function to look as follows:
    Code:
    function applyStableEffect(rActor)
    	if EffectManager35E.hasEffectCondition(rActor, "Stable") then return; end
    	
    	local nodeCT = ActorManager.getCTNode(rActor);
    	local aEffect = { sName = "Stable", nDuration = 0 };
    	if ActorManager.getFaction(rActor) ~= "friend" then
    		aEffect.nGMOnly = 1;
    	end
    
    	if (Session.IsHost) then
    		EffectManager.addEffect("", "", nodeCT, aEffect, true);
    	else
    		EffectManager.notifyApply(aEffect, ActorManager.getCTNodeName(rActor));
    	end
    end
    The change I made is at the end with the addition of the "Session.IsHost" check and if it is not the host, then call EffectManager.notifyApply() to have the OOB msg built for the effect. (Originally, this function called EffectManager.addEffect(), which would have no effect if the code was running on a player system.)

    It all appears to work, my player stabilization rolls now get applied to the CT when the player does a manual roll for stabilization, but I didn't know if I was doing something inherently "bad" by calling EffectManager.notifyApply() directly and there might be reasons to avoid this approach.

    The reason I didn't want to send a roll (rather than effect) OOB is I am using the extension "Requested Rolls" to catch when the auto-stabilization roll occurs and if the player has enabled the option to prompt for a manual roll, they can then get prompted to perform the roll by hand when their turn ends. Not being very familiar with the internals of how this extension intercepts a roll, I wasn't sure if I'd get into a loop with the Requested Rolls logic catching the roll again if I used the similar approach to how spells apply effects and sent the final roll OOB.

    Cheers,
    Brian

  5. #5
    That seems like it should work fine. In fact, you can probably just let notifyApply be called in general, since it's designed to be called on either host or player.

    Regards,
    JPG

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Starfinder Playlist

Log in

Log in