DICE PACKS BUNDLE
Page 2 of 3 First 123 Last
  1. #11
    Oberoten's Avatar
    Join Date
    May 2006
    Location
    Älvsbyn, Sweden
    Posts
    2,621
    *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."
    For your Ars Magica needs :
    https://fgrepository.com




    Atque in perpetuum frater, Ave atque vale.

  2. #12
    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

  3. #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.

  4. #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 Joe
    God 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.

  5. #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.

  6. #16

    More on Feng Shui dice

    Quote Originally Posted by joshuha
    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.
    I'd LOVE to see the dice actually roll and explode out, but it's not 100% nessesary really.

    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,
    JS
    God 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.

  7. #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,
    JS
    God 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.

  8. #18
    Quote Originally Posted by SirJoe
    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,
    JS
    Thought about this more and there are a couple ways to do this. First off, Fantasy Grounds doesn't let the dice results value be negative, I tried and it has no effect.

    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.

  9. #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,
    JS
    God 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.

  10. #20

    Talking

    Quote Originally Posted by SirJoe
    Option 3 would be fine. Anything that is quick and easy to get a game going. :-)

    Cheers,
    JS
    Ok here's what I whipped together quickly.

    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
    All the above does is toss 2 special Feng Shui dice that are d6s with a custom parameter of "fengshui". This uses the nice 3D dice so you still get the effect. The custom parameter is used later to determine when to process these special dice. It works by typing /test but you said you wanted to tie it into a button or something (I will leave that up to you but all you need to do is have it call the same throwDice() command and you can not bother with the above).

    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
    I commented my code to try to explain things as they happen but essentially the logic breaks down like this:

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
5E Character Create Playlist

Log in

Log in