-
July 19th, 2007, 22:26 #11
*scratches head thoughtfully*
... and somehow I feel totally stupid here?
How would one use this to create a script like that?
I am afraid that I have so far had very little luck in wrapping my head around the LUA functions...
(I managed to make a crit-dice in the Beta using the random functions... but I'd much prefer to be able to use the "normal" dice instead."
-
July 19th, 2007, 23:03 #12
- Join Date
- Jan 2007
- Posts
- 22
I was able to add the code to throw an extra d20 on attack if the value of the first is >= x.
I need to replace x with the crit value of the weapon they are using. I'm not sure how to identify the weapon the player is using and the crit field therin.
bonzai
-
July 20th, 2007, 01:23 #13
There are 2 ways to do this depeding on the approach you take. Any attack rolled from the default d20 sheet on the combat tab is flagged as a custom type called fullattack. So thats the first thing that clues us in where we want to put our code.
In the chat_chat.lua file in the onDiceLanded function you'll see an event that processes that type of dragdata.
Checking the result of the roll is the easy part the harder part is getting the crit number from the sheet and this is where there are two approaches.
One is to have the charsheet_fullattack.lua script pass as a custom slot in the dragdata the critical value needed. This is a bit tricky as the default processing in the onDiceLanded assumes each slot is a seperate die roll but not too hard to modify.
The second way is since the name of the weapon is sent as part of the description string to parse that out and look at the weaponlist of the character and loop through until you find it.
Either way isn't too bad and I can throw up some code for it eventually but busy working on Savage Worlds stuff. The first way is cleaner though and most likely will end up being less lines of code.
-
July 22nd, 2007, 11:22 #14
Help with dice script
Hey guys,
I was wondering if someone could help me by creating a script that does dice rolling for my favorite game, Feng Shui.
In Feng Shui, you roll two six-sided dice and minus the second (negative die) from the first (positive die). Each die explode on a 6.
Ideally, I'd like to have button or widget on the FG2 desktop than can be clicked and it will make the rolls and calculate the total.
Any help would be muchly appreciated.
Cheers,
Sir JoeGod doesn't play dice with the universe... I do.
Bag O' Bones: The worlds best free dice set for the Pocket PC
MookMasher Delux II: Free Pocket PC game manager for For Feng Shui fanatics.
Learn how to make beautiful dungeon maps with Joe's Video Tutorials at RPG Virtual Tabletop and ProFantasy.
NUGs Gaming Group. Don't play with yourself, play with your NUGS.
-
July 23rd, 2007, 00:55 #15
I can probably provide some help for this but it will be a bit before I can devote some time for this. Graphically do you want 2d6 to be thrown still for effect? We can use those as the base results and then remove the original results message, process exploded internally, and report the final results.
-
July 23rd, 2007, 01:32 #16
More on Feng Shui dice
Originally Posted by joshuha
Thanks a million for any help you can give me on this. I've already worked out how to implement the combat tracking in FS in a very simple way (just using tokens and a specially-created graphic), so now all I need is the dice and I'll use the 'generic' ruleset for the rest.
Cheers,
JSGod doesn't play dice with the universe... I do.
Bag O' Bones: The worlds best free dice set for the Pocket PC
MookMasher Delux II: Free Pocket PC game manager for For Feng Shui fanatics.
Learn how to make beautiful dungeon maps with Joe's Video Tutorials at RPG Virtual Tabletop and ProFantasy.
NUGs Gaming Group. Don't play with yourself, play with your NUGS.
-
September 11th, 2007, 22:40 #17
Hey Joshua,
Any chance to take a look at this Feng Shui dice idea? I'm working on some new adventures and would love to put them into an online gaming environment.
Cheers,
JSGod doesn't play dice with the universe... I do.
Bag O' Bones: The worlds best free dice set for the Pocket PC
MookMasher Delux II: Free Pocket PC game manager for For Feng Shui fanatics.
Learn how to make beautiful dungeon maps with Joe's Video Tutorials at RPG Virtual Tabletop and ProFantasy.
NUGs Gaming Group. Don't play with yourself, play with your NUGS.
-
September 12th, 2007, 00:57 #18Originally Posted by SirJoe
So for example, through scripting I pass 2d6 to be rolled, and a 3 and a 4 land, I change the dice result value to -4 before it spits it out but the screen still shows 3,4 and hitting the equal icon still shows 7. So here are my proposals on ways around this:
1) Make each one a separate line. So you would see on one line the positive number (and all exploding dice), the next one the negative number (and all exploding dice), and finally an all text third line that shows the total. This is alright but might be a lot of chat spam if every roll works like this.
2) Make them all one line and just display all the aced diced together and inline the totals. Something like Melee {Total 7} [dice icons here]. The dice icons would all get jumbled together though in low/high order so it would be hard to tell which ones exploded for the positive bonus and negative bonus.
3) Make the entire line a text line that spits out (you still get the graphic die rolls though). Something like Melee [6,2] - [4] = 4. This probably is the best solution although not as "pretty" as the others since you don't get the little dice icons with the number but it will fit the best I think.
Let me know, number 3 is the easiest way though and I can probably whip out something for you in a day or so.
-
September 12th, 2007, 01:06 #19
Option 3 is more than good enough
Option 3 would be fine. Anything that is quick and easy to get a game going. :-)
Cheers,
JSGod doesn't play dice with the universe... I do.
Bag O' Bones: The worlds best free dice set for the Pocket PC
MookMasher Delux II: Free Pocket PC game manager for For Feng Shui fanatics.
Learn how to make beautiful dungeon maps with Joe's Video Tutorials at RPG Virtual Tabletop and ProFantasy.
NUGs Gaming Group. Don't play with yourself, play with your NUGS.
-
September 12th, 2007, 02:14 #20Originally Posted by SirJoe
First, you will obviously need to create your own custom ruleset for this.
The first thing I modified is the chatmanager.lua file like so (towards the end of the file):
Code:function test() -- throws 2d6, labels it Feng Shui and passes a custom paramter called fengshui ChatManager.control.throwDice("dice", {"d6","d6"}, 0, "Feng Shui", "fengshui"); end -- Initialization function onInit() registerSlashHandler("/whisper", processWhisper); registerSlashHandler("/die", processDie); registerSlashHandler("/test",test); end
The meat of the code is going to be in the chat_chat.lua file. This file contains a function called onDiceLanded() that processes dice that hit the chat box. Find the, elseif draginfo.isType("dice") then, and replace it with the following:
Code:elseif draginfo.isType("dice") then applyModifierStackToRoll(draginfo); --look at flag to see if feng shui dice were thrown local flag = draginfo.getCustomData(); if flag == "fengshui" then --get die list dice = draginfo.getDieList(); die1results, die2results = {},{}; die1results[1] = dice[1].result; die2results[1] = dice[2].result; ---explode first die if die1results[1] == 6 then repeat die1 = math.random(1,6); table.insert(die1results, die1); until die1 ~= 6 end --explode second die if die2results[1] == 6 then repeat die2 = math.random(1,6); table.insert(die2results, die2); until die2 ~= 6 end ---build message string msg = {}; msg.font = "systemfont"; --icon to make sure players can't make up rolls msg.icon = "indicator_casterspontaneous"; msg.text = draginfo.getDescription(); msg.text = msg.text .. " ["; --build inline results for first die, also get total totaldie1 = 0; for i=1,table.maxn(die1results) do if i < table.maxn(die1results) then msg.text = msg.text .. die1results[i] .. ","; else msg.text = msg.text .. die1results[i] .. "]"; end totaldie1 = totaldie1 + die1results[i]; end msg.text = msg.text .. " - ["; --build inline results for first die, also get total totaldie2 = 0; for i=1,table.maxn(die2results) do if i < table.maxn(die2results) then msg.text = msg.text .. die2results[i] .. ","; else msg.text = msg.text .. die2results[i] .. "]"; end totaldie2 = totaldie2 + die2results[i]; end total = totaldie1 - totaldie2; msg.text = msg.text .. " = " .. total; --check who sent the message if User.isHost() then msg.sender = GmIdentityManager.getCurrent(); -- if host, check if die reveals are on if ChatManager.getDieRevealFlag() then deliverMessage(msg); else msg.icon = "dmdieicon"; addMessage(msg); end --get user identity else msg.sender = User.getIdentityLabel(); deliverMessage(msg); end --dont process normal die results for this flag return true; end end end
1) Check if dice is flagged with "fengshui" custom parameter.
2) Get dice results from original rolls.
3) Process exploding die from both dice.
4) Build the message string. This part looks long but is just a bunch of string manipulation.
The final results should look like this:
https://www.ptolus-fg.com/images/fengshui.png
Note that I added a message icon in there so you can be sure the players rolled the die via the command. And I put some logic in there if the GM rolls it only adds the message locally if the /die reveal flag is not on (the default is /die hide).
Feel free to modify font, message description, etc. and if you have any questions just let me know.Last edited by joshuha; September 12th, 2007 at 02:18.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks