5E Character Create Playlist
Page 8 of 9 First ... 6789 Last
  1. #71
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    23,235
    Blog Entries
    1
    See in that video here:

    https://youtu.be/RiBkE32tgv8?list=PL...lcerBvW3&t=260

    Change
    Code:
    <totalchar name="ts" source="abilities.ts">
    		<anchored to="as" position="insidetopleft" offset="0,28" width="18" />
    		<tooltip text="Strength Skill" />
    		<target>ts</target>
    		<statname>Strength Skill</statname>
    		<stat>ts</stat>
    		<script>
    			function onInit()
    				local nodeWin =window.getDatabaseNode();
    				CharacterUpdate.updateS(nodeWin);
    			end
    		</script>
    	</totalchar>
    to

    Code:
    <totalchar name="ts" source="abilities.ts">
    		<anchored to="as" position="insidetopleft" offset="0,28" width="18" />
    		<tooltip text="Strength Skill" />
    		<target>ts</target>
    		<statname>Strength Skill</statname>
    		<stat>ts</stat>
    		<script>
    			function onInit()
    				local nodeWin =window.getDatabaseNode();
    				Debug.chat("nodeWin1: ", nodeWin);
    				CharacterUpdate.updateS(nodeWin);
    			end
    		</script>
    	</totalchar>
    and

    Code:
    function updateS(nodeWin)
    	local nIS = nodeWin.getChild("is").getValue();
    	local nAS = nodeWin.getChild("as").getValue();
    		
    	local nTS = (nIS+nAS);
    	Debug.console("nTS: ", nTS);
    	nodeWin.getChild("abilities.ts").setValue(nTS);
    	
    end
    to

    Code:
    function updateS(nodeWin)
            Debug.chat("nodeWin2: ", nodeWin);
    	local nIS = nodeWin.getChild("is").getValue();
    	local nAS = nodeWin.getChild("as").getValue();
    		
    	local nTS = (nIS+nAS);
    	Debug.console("nTS: ", nTS);
    	nodeWin.getChild("abilities.ts").setValue(nTS);
    	
    end
    and see what nodeWin1 and nodeWin2 do.


    and see if it outputs
    then in

    MoreCore - Generic Ruleset
    --- Projects ---
    Extensions | Tutorials | MoreCore | MoreCore Themes | Call of Cthulhu | Maelstrom | FG Con

  2. #72
    Yep, that did something:


    Code:
    s'nodeWin1:' | databasenode = { charsheet.id-00002 }
    s'nodeWin2: ' | databasenode = { charsheet.id-00002 }

  3. #73
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    23,235
    Blog Entries
    1
    But the error persists?

    What is Line 106 in this file?
    scripts/wh4_damagedr.lua

    actually post the whole script/function containing that line and mark which line is 106

    MoreCore - Generic Ruleset
    --- Projects ---
    Extensions | Tutorials | MoreCore | MoreCore Themes | Call of Cthulhu | Maelstrom | FG Con

  4. #74
    Here it is.
    I've marked the line with "Line 106" and made it bold.

    Code:
    -- 
    -- Please see the license.html file included with this distribution for 
    -- attribution and copyright information.
    --
    
    function onInit()
      -- Register the new action we're creating.  We'll allow use of the modifier stack for this action type.
      --GameSystem.actions["abilities"] = { bUseModStack = true };
      ActionsManager.registerModHandler("attack", modRoll);
    
      -- Register the result handler - called after the dice have stopped rolling
      ActionsManager.registerResultHandler("attack", onRoll);
    
      -- Used for testing - register a chat window slash handler to start the action
      Comm.registerSlashHandler("test", processRoll);
    end
    
    --function processRoll(draginfo, rActor, sAbilitiesStat, bSecretRoll)
    --	-- Start the action!
    --	performRoll(draginfo, rActor, bSecretRoll);
    --end
    
    function getRoll(rActor, sAbilitiesStat, bSecretRoll, nodeWin)
      -- Initialise a blank rRoll record
      local rRoll = {};
    
      -- Add the 4 minimum parameters needed:
      -- the action type.
      rRoll.sType = "attack";
      -- the dice to roll.
      rRoll.aDice = { "d100"};
      -- A modifier to apply to the roll.
      rRoll.nMod = 0;
      -- The description to show in the chat window
      rRoll.sAbilities = sAbilitiesStat;
      rRoll.bSecret = bSecretRoll;
      --rRoll.nStrength = nodeWin.getChild("abilities.ts").getValue();
      rRoll.nTarget = DB.getValue(ActorManager.getCreatureNode(rActor), "abilities." .. sAbilitiesStat, 0);
      local sAbilitiesEffect = DataCommon.skills_ltos[sAbilitiesStat];
      if sAbilitiesEffect then
        rRoll.sDesc = sAbilitiesEffect;
        --Debug.console("sAbilitiesEffect:" , sAbilitiesEffect)
      end
    
      return rRoll;
    end
    
    --function getStrength(nodeWin)
    --  local nS = nodeWin.getChild("abilities.nSTR").getValue();
    --  local value = math.floor(nS/10);
    --
    --  return value;
    --end
    
    function onRoll(rSource, rTarget, rRoll)
      -- Create the base message based off the source and the final rRoll record (includes dice results).
      local rMessage = ActionsManager.createActionMessage(rSource, rRoll);
      local nTotal = ActionsManager.total(rRoll);
    
      rMessage.text = rMessage.text .. "Attack: " .. "[".. rRoll.nTarget .."]" .. "\n"..
              "Result: " .. rollOutcome(nTotal, rRoll.nTarget) .. "\n" .. rollDamage(nTotal, rRoll.nTarget)
              .. rollHitlocation(nTotal, rRoll.nTarget).."\n"..rollCritical(nTotal, rRoll.nTarget);
      -- Display the message in chat.
      Comm.deliverChatMessage(rMessage);
      Debug.console("rRoll:" , rRoll)
    end
    
    function modRoll(rSource, rTarget, rRoll)
      local aAddDesc = {};
      local aAddDice = {};
      local nAddMod = 0;
    
    
      if rSource then
    
        local nBonusStat, nBonusEffects = ActorManager2.getAbilitiesEffectsBonus(rSource, sAbilities);
        if nBonusEffects > 0 then
          bEffects = true;
          nAddMod = nAddMod + nBonusStat;
        end
      end
    
    end
    
    
    function rollOutcome(rollValue, successValue)
      local desc = "";
      local value = 0;
      local lSuccessValue = tonumber(successValue);
      local lRollValue = rollValue;
    
      if lRollValue <= lSuccessValue then
        value = math.floor(lSuccessValue/10)-math.floor(lRollValue/10);
        desc = string.format("HIT!" .." [SL %d]", value);
      else
        value = math.floor(lRollValue/10)-math.floor(lSuccessValue/10)
        desc = string.format("MISS!" .. " [SL -%d]", value);
      end
      return desc;
    end
    
    function rollDamage(rollValue,successValue, nodeWin)
      local desc = "";
      local value = 0;
      local lSuccessValue = tonumber(successValue);
      Line 106 local nStrength = nodeWin.getChild("abilities.ts").getValue();
      Debug.console("nStrength:" , nStrength)
      --local nS = 5;
      --local nS = nodeWin.getChild("abilities.ts").getValue();
    
      local lRollValue = rollValue;
    
    
      if lRollValue <= lSuccessValue then
        value = math.floor(lSuccessValue/10)-math.floor(lRollValue/10)+nStrength;
        desc = string.format("Dmg: %d", value)
      else
        desc = "";
      end
      return desc;
    end
    
    function rollHitlocation(rollValue,successValue)
    local desc = "";
    local value = 0;
    local lSuccessValue = tonumber(successValue);
    local lRollValue = rollValue;
    
    if lRollValue <= lSuccessValue then
      local nX = math.floor(lRollValue/10);
      local nY = (lRollValue-(nX*10))*10;
      value = (nX+nY)
      if value >0 and value < 10 then
        desc = string.format(" Head", value)
      elseif value >=10 and value <25 then
        desc = string.format(" Left Arm", value)
      elseif value >=25 and value <45 then
        desc = string.format(" Right Arm", value)
      elseif value >=45 and value <80 then
        desc = string.format(" Body", value)
      elseif value >=80 and value <90 then
        desc = string.format(" Left Leg", value)
      elseif value >=90 then
        desc = string.format(" Right Leg", value)
      end
    else
      desc = "";
    end
    return desc;
    end
    
    function rollCritical(rollValue,successValue)
      local desc = "";
      local value = 0;
      local lSuccessValue = tonumber(successValue);
      local lRollValue = rollValue;
    
      if lRollValue <= lSuccessValue then
        local nX = (math.floor(lRollValue/10))*10;
        local nY = math.floor(lRollValue/10);
        value = (lRollValue-nX)
        if value == nY then
          desc = string.format("CRITICAL!!!",value)
        else
          desc = "";
        end
      end
      return desc;
    end
    
    -- Start the action process
    function performRoll(draginfo, rActor, sAbilitiesStat, bSecretRoll)
      local rRoll = getRoll(rActor, sAbilitiesStat, bSecretRoll);
    
      ActionsManager.performAction(draginfo, rActor, rRoll);
      --	Debug.console("rActor:", rActor)
    end

  5. #75
    Quote Originally Posted by Zisse View Post
    WFRP4 is the reason, why I bought foundry as well. Publisher support with ready made modules is key. That and the pricing model was the original reason for me to choose FG for DnD. Since I am originally coming from WFRP, I will run foundry a lot more in the future. Will keep using FG for DnD.
    I also bought Foundry for WFRP. It sucks but its usable and has official content.....

  6. #76
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    23,235
    Blog Entries
    1
    Put the Debug.chat("nodeWin3: ", nodeWin); before line 106
    If it doesnt report the same as the others then whatever is calling/passing to rollDamage isnt passing nodeWin.

    MoreCore - Generic Ruleset
    --- Projects ---
    Extensions | Tutorials | MoreCore | MoreCore Themes | Call of Cthulhu | Maelstrom | FG Con

  7. #77
    Yeah, there is something wrong there.

    Code:
    s'nodeWin3: ' | nil
    I'll try to recap, and put all the code in a logical order.
    This is the order of things in this roll.

    First the template:

    Code:
    <template name="weapondmg">
    		<simplenumber>
    			<frame mergerule="replace" name="bwframe" offset="3,3,3,4" />
    			<script file="common/scripts/attackroll.lua" />
    		</simplenumber>
    	</template>
    The template calls the LUA.file attackroll.lua shown below.

    Code:
    function action(draginfo)
        local rActor = ActorManager.getActor("pc", window.getDatabaseNode());
        AttackRoll.performRoll(draginfo, rActor, stat[1]);
        return true;
        --Debug.console("rActor:" , rActor);
    end
    
    function onDragStart(button, x, y, draginfo)
        return action(draginfo);
    end
    
    function onDoubleClick(x,y)
        return action();
    end
    And that goes to the AttackRoll.performRoll shown below:
    Code:
    function onInit()
      -- Register the new action we're creating.  We'll allow use of the modifier stack for this action type.
      --GameSystem.actions["abilities"] = { bUseModStack = true };
      ActionsManager.registerModHandler("attack", modRoll);
    
      -- Register the result handler - called after the dice have stopped rolling
      ActionsManager.registerResultHandler("attack", onRoll);
    
      -- Used for testing - register a chat window slash handler to start the action
      Comm.registerSlashHandler("test", processRoll);
    end
    
    --function processRoll(draginfo, rActor, sAbilitiesStat, bSecretRoll)
    --	-- Start the action!
    --	performRoll(draginfo, rActor, bSecretRoll);
    --end
    
    function getRoll(rActor, sAbilitiesStat, bSecretRoll, nodeWin)
      -- Initialise a blank rRoll record
      local rRoll = {};
    
      -- Add the 4 minimum parameters needed:
      -- the action type.
      rRoll.sType = "attack";
      -- the dice to roll.
      rRoll.aDice = { "d100"};
      -- A modifier to apply to the roll.
      rRoll.nMod = 0;
      -- The description to show in the chat window
      rRoll.sAbilities = sAbilitiesStat;
      rRoll.bSecret = bSecretRoll;
      --rRoll.nStrength = nodeWin.getChild("abilities.ts").getValue();
      rRoll.nTarget = DB.getValue(ActorManager.getCreatureNode(rActor), "abilities." .. sAbilitiesStat, 0);
      local sAbilitiesEffect = DataCommon.skills_ltos[sAbilitiesStat];
      if sAbilitiesEffect then
        rRoll.sDesc = sAbilitiesEffect;
        --Debug.console("sAbilitiesEffect:" , sAbilitiesEffect)
      end
    
      return rRoll;
    end
    
    --function getStrength(nodeWin)
    --  local nS = nodeWin.getChild("abilities.nSTR").getValue();
    --  local value = math.floor(nS/10);
    --
    --  return value;
    --end
    
    function onRoll(rSource, rTarget, rRoll)
      -- Create the base message based off the source and the final rRoll record (includes dice results).
      local rMessage = ActionsManager.createActionMessage(rSource, rRoll);
      local nTotal = ActionsManager.total(rRoll);
    
      rMessage.text = rMessage.text .. "Attack: " .. "[".. rRoll.nTarget .."]" .. "\n"..
              "Result: " .. rollOutcome(nTotal, rRoll.nTarget) .. "\n" .. rollDamage(nTotal, rRoll.nTarget)
              .. rollHitlocation(nTotal, rRoll.nTarget).."\n"..rollCritical(nTotal, rRoll.nTarget);
      -- Display the message in chat.
      Comm.deliverChatMessage(rMessage);
      Debug.console("rRoll:" , rRoll)
    end
    
    function modRoll(rSource, rTarget, rRoll)
      local aAddDesc = {};
      local aAddDice = {};
      local nAddMod = 0;
    
    
      if rSource then
    
        local nBonusStat, nBonusEffects = ActorManager2.getAbilitiesEffectsBonus(rSource, sAbilities);
        if nBonusEffects > 0 then
          bEffects = true;
          nAddMod = nAddMod + nBonusStat;
        end
      end
    
    end
    
    
    function rollOutcome(rollValue, successValue)
      local desc = "";
      local value = 0;
      local lSuccessValue = tonumber(successValue);
      local lRollValue = rollValue;
    
      if lRollValue <= lSuccessValue then
        value = math.floor(lSuccessValue/10)-math.floor(lRollValue/10);
        desc = string.format("HIT!" .." [SL %d]", value);
      else
        value = math.floor(lRollValue/10)-math.floor(lSuccessValue/10)
        desc = string.format("MISS!" .. " [SL -%d]", value);
      end
      return desc;
    end
    
    function rollDamage(rollValue,successValue, nodeWin)
      local desc = "";
      local value = 0;
      local lSuccessValue = tonumber(successValue);
      Debug.chat("nodeWin3: " , nodeWin)
      local nStrength = nodeWin.getChild("abilities.ts").getValue();
      --Debug.chat("nStrength: ". nStrength)
      --Debug.console("nStrength:" , nStrength)
      --local nS = 5;
      --local nS = nodeWin.getChild("abilities.ts").getValue();
    
      local lRollValue = rollValue;
    
    
      if lRollValue <= lSuccessValue then
        value = math.floor(lSuccessValue/10)-math.floor(lRollValue/10)+nStrength;
        desc = string.format("Dmg: %d", value)
      else
        desc = "";
      end
      return desc;
    end
    
    function rollHitlocation(rollValue,successValue)
    local desc = "";
    local value = 0;
    local lSuccessValue = tonumber(successValue);
    local lRollValue = rollValue;
    
    if lRollValue <= lSuccessValue then
      local nX = math.floor(lRollValue/10);
      local nY = (lRollValue-(nX*10))*10;
      value = (nX+nY)
      if value >0 and value < 10 then
        desc = string.format(" Head", value)
      elseif value >=10 and value <25 then
        desc = string.format(" Left Arm", value)
      elseif value >=25 and value <45 then
        desc = string.format(" Right Arm", value)
      elseif value >=45 and value <80 then
        desc = string.format(" Body", value)
      elseif value >=80 and value <90 then
        desc = string.format(" Left Leg", value)
      elseif value >=90 then
        desc = string.format(" Right Leg", value)
      end
    else
      desc = "";
    end
    return desc;
    end
    
    function rollCritical(rollValue,successValue)
      local desc = "";
      local value = 0;
      local lSuccessValue = tonumber(successValue);
      local lRollValue = rollValue;
    
      if lRollValue <= lSuccessValue then
        local nX = (math.floor(lRollValue/10))*10;
        local nY = math.floor(lRollValue/10);
        value = (lRollValue-nX)
        if value == nY then
          desc = string.format("CRITICAL!!!",value)
        else
          desc = "";
        end
      end
      return desc;
    end
    
    -- Start the action process
    function performRoll(draginfo, rActor, sAbilitiesStat, bSecretRoll)
      local rRoll = getRoll(rActor, sAbilitiesStat, bSecretRoll);
    
      ActionsManager.performAction(draginfo, rActor, rRoll);
      --	Debug.console("rActor:", rActor)
    end
    And I want to add the value in this source to the damageroll.

    Code:
    <totalchar name="ts" source="abilities.ts">
    		<anchored to="as" position="insidetopleft" offset="0,28" width="18" />
    		<tooltip text="Strength Skill" />
    		<target>ts</target>
    		<statname>Strength Skill</statname>
    		<stat>ts</stat>
    		<script>
    			function onInit()
    				local nodeWin =window.getDatabaseNode();
    				CharacterUpdate.updateS(nodeWin);
    			end
    		</script>
    	</totalchar>
    I really appreciate you taking the time to help me, and I understand this might be a needle in a haystack search.
    I just can't seem to find the way to add this one little variable. It may be I have to find a completely different way to do this.

  8. #78
    Thanks for all the help. It made me think how things worked, and I finally figured out a way to fix the roll.

    So now we have an attack roll which:
    - Calculates HIT/Miss
    - Number of SL
    - Total dmg with str and SL
    - Hit location
    - CRITICAL hit message

    Even though I found a way to do it, it's not nearly as refined as other rolls I've seen. But brute force has it charm (I hope).

    I need to change a lot of things to make it functional in a way I would like, but I am putting out a rough version here.
    At least you can have one place to put in the equipped weapon and roll for attack (no CT functions)
    You manually have to put in the total WS, and dmg of the weapon, but doubleclicking the left square will roll an attack with the str modifier.

    Example.png

    Warhammer_4.ext

  9. #79
    Hi ShakyLuigi

    Thank you for this great Warhammer extension. Apperently I have a few little problems. The first affects the attack rolls. The rolls with a weapon always fail. The first field I use WS score and the second Field for the Damage score. The attack shows [0] and the # of SL is always negative. Am I missing something?

    The other issue I have is with the advanced skills. When I try to roll a skill test, a script execution error shows up and tells me something about a nil value...

    I use the latest version of MoreCore and the lastest update of FGU.

    Thanx in advance for help
    Attached Images Attached Images

  10. #80
    Quote Originally Posted by TomtheBu View Post
    Hi ShakyLuigi

    Thank you for this great Warhammer extension. Apperently I have a few little problems. The first affects the attack rolls. The rolls with a weapon always fail. The first field I use WS score and the second Field for the Damage score. The attack shows [0] and the # of SL is always negative. Am I missing something?

    The other issue I have is with the advanced skills. When I try to roll a skill test, a script execution error shows up and tells me something about a nil value...

    I use the latest version of MoreCore and the lastest update of FGU.

    Thanx in advance for help
    Hi Tom.

    Thank you for the feedback!

    I am aware that the current version has a few (many) errors and bugs, and is in need of an update. It didn't really work as I thought it would.
    Currently I am playtesting the extenstion with my friends, and have heavily changed the attack rolls (among other things).
    I am trying to test as many things, and try to get rid of as many of the game-breaking functions as I can before updating.

    Hopefully it won't take to much time, and I hope the version that is out now can hold you over until I come with a proper update.

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
  •  
SWADE Playlist

Log in

Log in