Page 2 of 2 First 12
  1. #11
    Ok, here's what is happening.

    StrainInjury script onInit -> 3.5E script onInit -> CoreRPG script onInit

    Both StrainInjury and 3.5E scripts are calling onHealthChanged. However, when a function is defined that calls other functions, the functions are bound at load time. So, both the StrainInjury and 3.5E extensions are each calling their own onHealthChanged function.

    Try these changes to the StrainInjury extension:
    Code:
    function onInit()
    	super.super.onInit();
    	onHealthChanged();
    end
    
    function onFactionChanged()
    	super.super.onFactionChanged();
    	updateHealthDisplay();
    end
    Regards,
    JPG

  2. #12
    darrenan's Avatar
    Join Date
    Jul 2011
    Location
    Sammamish, WA
    Posts
    972
    I'll give that a whirl when I get home, thanks.

  3. #13
    darrenan's Avatar
    Join Date
    Jul 2011
    Location
    Sammamish, WA
    Posts
    972
    That fixed the scripting errors, thanks again. I think the wound-coloring inconsistency I'm seeing between the host and client sides of the CT is a bug that exists in the 3.5 ruleset which is easy to reproduce:

    1. Open up a host, connect a localhost client, using a 3.5 campaign with no extensions loaded.
    2. Open up the CT on the host, add any NPC. Open up the CT on the client.
    3. Set the nonlethal/subdual damage field of the NPC you added to the same value as its total HP. On the host side it is colored red, on the client it is grey. Clear the nonlethal/subdual damage field.
    4. Set the nonlethal/subdual damage field of the NPC you added to its total HP + 1. On the host side it is colored purple, on the client grey.

    I tracked this down to the fact that on the client side the coloration is entirely based on the contents of the status control (ActorManager2.getPercentWounded) rather than duplicating the calculations performed by the host (which I think it could easily do and would return the same results as the host):

    Code:
    	local sStatus;
    	if sNodeType == "ct" and not User.isHost() then
    		sStatus = DB.getValue(node, "status", "");
    	else
            ... host calculates sStatus in the else block ...
    sStatus is returned back to ActorManager2.getWoundColor and is used to determine the correct color. The host doesn't set the new status in the node until after ActorManager2.getWoundColor returns.

    It seems like the new status isn't set by the host (in ct_entry.lua, onHealthChanged) before the client side calls ActorManager2.getWoundColors in response to its onValueChanged event, so it uses the previous status to set the current color.

  4. #14

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,029
    Great detective work, darrenan!

Thread Information

Users Browsing this Thread

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

Posting Permissions

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

Log in

Log in