Starfinder Playlist
Page 2 of 2 First 12
  1. #11
    Great to hear.
    JPG

  2. #12
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,685
    Blog Entries
    1
    Quote Originally Posted by lokiare1 View Post
    Just a follow up, it works flawlessly now.
    @lokiare1 could you please post your complete solution? I would like to see what you did here

  3. #13

    Join Date
    Apr 2007
    Location
    Mississippi, USA
    Posts
    1,093
    Quote Originally Posted by damned View Post
    @lokiare1 could you please post your complete solution? I would like to see what you did here
    If you had asked that shortly after I did it, I would be able to show my work, but it might take me awhile to round up the code.

  4. #14

  5. #15

    Join Date
    Apr 2007
    Location
    Mississippi, USA
    Posts
    1,093
    The Lua code in manger_char.lua:
    Code:
    function useHealingSurge(nodeChar)
    	local rActor = ActorManager.getActor("pc", nodeChar);
    	local level = DB.getValue(nodeChar, "level", 0);
    	local recoveryDie = DB.getValue(nodeChar, "hp.surge", 0);
    	local conMod = DB.getValue(nodeChar, "abilities.constitution.bonus", 0);
    	
    	
    	-- Get the character's current wounds value
    	local nWounds = DB.getValue(nodeChar, "hp.wounds", 0);
    	
    	-- If the character is not wounded, then let the user know and exit
    	if nWounds <= 0 then
    		ChatManager.Message(Interface.getString("message_charhsnotwounded"), false, rActor);
    		return;
    	end
    	
    	-- Determine whether the character has any healing surges remaining
    	local nSurgesUsed = DB.getValue(nodeChar, "hp.surgesused", 0);
    	local nSurgesMax = DB.getValue(nodeChar, "hp.surgesmax", 0);
    	if nSurgesUsed >= nSurgesMax then
    		ChatManager.Message(Interface.getString("message_charhsempty"), false, ActorManager.getActor("pc", nodeChar));
    		return;
    	end
    	
    	local rAction = {};
    	rAction.name = "Healing Surge";
    	rAction.sTargeting = "self";
    	rAction.clauses = {};
    	
    	local rActionClause = {};
    	rActionClause.dicestr = "" .. level .. recoveryDie[1] .. "+" .. conMod;--"2d6+5";
    	rActionClause.stat = {};
    	rActionClause.cost = 1;
    	rActionClause.basemult = 0;
    	table.insert(rAction.clauses, rActionClause);
    	
    	ActionHeal.performRoll(nil, rActor, rAction);
    end
    In the record_char_main.xml I removed the number box for the healing surge and replaced it with:
    Code:
    <dice_charheal name="healsurge" source="hp.surge">
    	<anchored to="healsurgesused" position="right" offset="82,0" width="46" />
    	<modifiersize>mini</modifiersize>
    	<modifierfield>hp.surgemodifier</modifierfield>
    	<script file="campaign/scripts/char_recoveryroll.lua" />
    </dice_charheal>
    In template_char.xml I added:
    Code:
    <template name="dice_charheal">
    	<basicdice>
    		<script file="campaign/scripts/char_recoveryroll.lua" />
    	</basicdice>
    </template>
    Then I created "campaign/scripts/char_recoveryroll.lua":

    Code:
    function action(draginfo)
    	local rActor, rAction, rFocus, nodeAbility
    	rActor, rAction, rFocus = CharManager.getAdvancedRollStructures("heal", window.getDatabaseNode());
    	
    	ActionHeal.performRoll(draginfo, rActor, rAction, rFocus);
    	return true;
    end
    
    function onDragStart(button, x, y, draginfo)
    	return action(draginfo);
    end
    
    function onDoubleClick(x,y)
    	return action();
    end


    I had to change quite a few things that were expecting a flat number in various other parts of the rule set.
    Last edited by lokiare; August 26th, 2014 at 10:42. Reason: Forgot some stuff

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
  •  
FG Spreadshirt Swag

Log in

Log in