-
January 16th, 2023, 13:18 #61
Yes inside your rsw handler you will need to create another dice roll. The handler in rsw is the script file you send your info to.
https://forge.fantasygrounds.com/shop/items/199/view
Old School Essentials Ruleset
https://www.dmsguild.com/product/352...eon-Builder-5E
5e Random Dungeon Generator!
-
January 19th, 2023, 20:20 #62
- Join Date
- Mar 2018
- Location
- Norway
- Posts
- 104
Okey let's see if I am getting closer to the solution.
I have my attack roll script:
Code:function rollhandler(rSource, rTarget, rRoll) local rMessage = ActionsManager.createActionMessage(rSource, rRoll); local nTotal = ActionsManager.total(rRoll); local nTarget = rRoll.skill local nDMG = rRoll.dmg local mod = rRoll.nMod local adv= DB.getValue(ActorManager.getCreatureNode(rSource), "advantage_field", 0); local target = rTarget.sName if target then local result = math.floor((nTarget)/10) - math.floor((nTotal)/10); local oRoll = {SL = result, target = target} opposedroll.opposedroll(oRoll)
But it is in the next script that I am getting nowhere.
Code:function opposedroll(oRoll, nr) target = oRoll.target DB.addHandler( nodepath, event, callback ) end
If I just use the opposedroll.opposedroll to be run when rolling the dice, then everything is written over by the new info.
You've probably explained it to me, but I'm just not grasping the message.
I've tried reading Trenloe's thread, and tried to understand the developer guide, but it is way to advanced coding-language for me to understand.
-
January 19th, 2023, 21:32 #63
Ok in your top bit of code you need to setup a new roll. I am not sure what die it uses (d100?). That goes in aDice but in a table
local nodeDefender = ActorManager.getCTNode(rTarget)
local sPath = DB.getPath(nodeDefender)
local rRollO = { sType = "opposed", sDesc = "Opposed Roll", aDice = aDice, nMod = nMod, nTotalDamage =nTotal, sDefender = sPath };
ActionsManager.performAction(nil, nil, rRollO );
in the onit on your script add
ActionsManager.registerResultHandler("opposed", opposedroll);
then
Function opposedroll (rSource, Target, rRoll)
Debug.chat(rRoll)
end
Debug that rRoll and I think you will understand what to do next.https://forge.fantasygrounds.com/shop/items/199/view
Old School Essentials Ruleset
https://www.dmsguild.com/product/352...eon-Builder-5E
5e Random Dungeon Generator!
-
February 8th, 2023, 20:00 #64
- Join Date
- Mar 2018
- Location
- Norway
- Posts
- 104
I'm sorry, I've been trying to understand this, but I just can't see the solution.
So far, I've written this in the attackroll that the attacker use.
Code:function rollhandler(rSource, rTarget, rRoll) local rMessage = ActionsManager.createActionMessage(rSource, rRoll); local nTotal = ActionsManager.total(rRoll); local nTarget = rRoll.skill local nDMG = rRoll.dmg local mod = rRoll.nMod local adv= DB.getValue(ActorManager.getCreatureNode(rSource), "advantage_field", 0); local target = rTarget.sName local result = math.floor((nTarget)/10) - math.floor((nTotal)/10); if target then local nodeDefender = ActorManager.getCTNode(rTarget); local sPath = DB.getPath(nodeDefender) local rRollO = {sType ="opposed", sDesc ="Opposed Roll", aDice = d100, nMod = mod, nTotalDamage = nTotal, sDefender = sPath }; ActionsManager.performAction(nil, nil, rRollO);
Then I write this code in the script where I have the defending roll:
Code:function onInit() ActionsManager.registerResultHandler("opposed", opposedroll); end function opposedroll(rSource, Target, rRoll) Debug.chat("rRoll2", rRoll); end
Code:s'rRoll2' | { s'nMod' = #0, s'sDefender' = s'combattracker.list.id-00002', s'sType' = s'opposed', s'nTotalDamage' = #31, s'sDesc' = s'Opposed Roll' }
If I use the function opposedroll when rolling for the defense, the new roll information overwrites the last one.
And I've been thinking while trying to make this work. I'm not sure I can do it this way.
The attack roll, and defend role is basically the same. It's the same script, you just use the weapon to defend.
If I have a separate script to defend, how would I have the player doubleclick the "attack button" and point it either to the defend script or attack script?
All I really need to use for a basic opposed roll in this game is the result value (I've highlighted it in the topmost code), and use that further.
And I need the "right" defender to defend.
Attacker rolls his sword attack and gets the result 7.
Defender rolls his sword attack and gets the result 4.
7>4, attacker wins and gives 3 damage.
I really appreciate you taking time to trying to teach me how to do this, but I'm having such a hard time trying to make this work.
-
February 8th, 2023, 23:05 #65
What is the actual mechanic - ignoring FG - what is the process you are trying to code?
-
February 9th, 2023, 08:00 #66
- Join Date
- Mar 2018
- Location
- Norway
- Posts
- 104
The game mechanic is as follows (very basic).
Player X has a sword skill of 57 and wants to attack the goblin with his sword.
X rolls a d100 and gets a 25. The system only regards 10's when calculating number of success levels (SL).
This gives Player X 5 - 2 = 3 SL (remember only the 10's count at this point).
Now the Goblin will defend with his sword and sword skill at 37.
The Goblin rolls a d100 and gets a 42.
This gives the Goblin 3 - 4 = -1 SL.
Comparing the two rolls gives a success of 4 to Player X. Add 3 base damage from the sword and the Goblin takes 7 damage in total.
There are also elements of absorbing damage, other ways of increasing damage and number of SL's, but for now just getting the basic down would come a long way.
Just rolling the attack and outputting that in the chat, I've managed.
Player X rolls, gets a result.
The Goblin rolls and gets a result.
I as a DM, compare the rolls and tell the player the total damage he did to the goblin. Not that hard, but everything that can be automated would be fantastic.
-
February 25th, 2023, 17:29 #67
- Join Date
- Mar 2018
- Location
- Norway
- Posts
- 104
I figured it out!
I've only tested the very basics of it, and it needs a lot of finetuning, but the basics seems to work just fine.
What I did was add two nodes in the CT for each PC and NPC: attack_ticker and SL (invisible in the CT).
Now, when the PC targets and attacks a NPC, the script finds the NPC and gives attack_ticker the value one. In the SL node, it sets the roll value the PC did.
Then when the NPC rolls his attack, it first checks the attack_ticker. If the value is one there, a defence roll is performed (else it will do a regular attack), and it calculates the NPC SL and compares it with the PC SL, and declares a winner based on that. And ends with setting attack_ticker and SL with value zero.
But for this to work, I had to add the attacks of the NPC in the combat tracker, or else the defence roll couldn't locate the two nodes. I used damned's video here for that: https://www.youtube.com/watch?v=4diiT-sIZE8
Now I just have to add this to the PC script as well, take into account Fumbles and Crits and possible fix a thousand bugs and script errors. But it works
Thanks for the guidance, even though I ended up using a different solution the ONLY reason I thought of it was from these two lines you gave me bayne
local nodeDefender = ActorManager.getCTNode(rTarget)
local sPath = DB.getPath(nodeDefender)
So thanks for that!
-
April 19th, 2023, 14:47 #68
- Join Date
- Jan 2017
- Posts
- 4
I just wanted to check about an issue my players are having. I had one of my friends beg me to run a Warhammer Fantasy game for years. I got this mod and it looks fantastic but everyone minus myself see their character sheets with text not fitting properly. Also is there anyway I can change the font to being black instead of white? Some of my players are having a hard time seeing things they have written.
Last edited by Coots; April 19th, 2023 at 14:50.
-
April 19th, 2023, 20:14 #69
- Join Date
- May 2012
- Posts
- 386
You have a theme that's changing the way it looks. Not sure about the font size cause mine comes out just fine.
-
April 23rd, 2023, 14:32 #70
- Join Date
- Mar 2018
- Location
- Norway
- Posts
- 104
Hope everything worked out for you Coots. I agree with vegaserik that this is caused by a theme or mod. The colour of the font is suppoed to be black everywhere.
On other news, I've finished the oppsoed rolls scripts for both PC's and NPC's! And a bunch of other smaller updates as well. So I am soon going to update the Ruleset in the Forge soon.
Just wondering if there are things I should considering before I upload it? I always worry that I will break peoples games. So any tips would be greatly appreciated.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks