PDA

View Full Version : Hero Chips



S Ferguson
April 17th, 2014, 02:15
Does anyone know off-hand how to begin coding for a chip system for games that require tokens to be spent or given? This is similar to the "benny system" in SW, but more general. It would require the ability to drop a token on the chat box, respond in kind, be graphical not numeric, and the icons representing them would also have to appear on the character sheet as a count (and obviously draggable to the chat window and the character sheet - picture of character from the GM's side). Basically, it's just a graphic representation of "Hero Points" that are required in a lot of games, to be given or taken as the need arises.

I seem to have an aversion to numerical interfaces, preferring pretty pictures and, on the side, a much more spiffy looking character sheet.:p Additionally it would make a good extension to the CoreRPG.

Thanks in advance,
SF

Trenloe
April 17th, 2014, 02:47
Have a look at the destiny chits in the Star Wars: Edge of the Empire ruleset: http://www.fantasygrounds.com/forums/showthread.php?20055-Star-Wars-Edge-of-the-Empire-FG-3-0

These are the white and black chits in the bottom right of the "Dice Box" screenshot. The number is set by the GM double-clicking on them (right-click to reset) and then they can be dragged to the dice box to trigger certain functionality, which will decrease one pile of chits and increase the other. Of course, all of this is just coding - make it do what you want.

S Ferguson
April 17th, 2014, 02:54
Thanks Tren. Will do.

Cheers,
SF

Trenloe
April 17th, 2014, 02:59
The way the token graphic is implemented is that there is a different graphic for 1, 2, 3, 4, 5, 6 and 7 tokens - then the 7 token graphic with "8+" superimposed over the top for higher values. You can see the graphics used by the ruleset in the graphics\chits folder.

S Ferguson
April 17th, 2014, 21:48
I'm not that familiar with the rules to this system. I figured out that the strain and wound chits (as well as the dark side and light side chits, I think) are not the droids I'm looking for, and cannot, for the life of me, figure out where to drop the tokens that the graphics, lua and the XML refer to (and you kindly pointed out to me Trenloe). Are there any users of this game that could guide me in using the dark side and light side chits? And are there any developers that know how to isolate the "chit dispenser" as a GM tool only? Help us Obi-Wan. You're our only hope....

Regards,
SF

Trenloe
April 18th, 2014, 03:24
You can do a couple of things:

Open a PC or an NPC (they can be pretty much blank) and drag/drop a wound or strain token onto the sheet. You'll see the current wounds or strain on the "Combat" tab increase and a message appear in the chat window.
Destiny chits are initialised by double-clicking a few times on the "Lightside token" and "Darkside token" panel at the bottom of the screen. Once you have a few of each, you can drag one or the other to the chat window and a message will be displayed saying a chit has been played - the chit pile will be reduced by 1 and the other pile will be increased by 1. Once set at the beginning of the game the total chits across both panels doesn't change but the force does swing one way or the other based on how many of a particular chit pile are being used. If you're interested in the game mechanic for Destiny points, download the Free RPG Day scenario and look at the section on pages 11-12: http://fantasyflightgames.com/ffg_content/StarWarsRPG/edge-of-the-empire/adventures/Under%20a%20Black%20Sun%20LoRes.pdf

You can also drag destiny tokens to the dice pool window under the chat window and the dice will be modified accordingly.

So, as far as coding goes there are 2 main sections - the initiation of the drag and the drop of the drag. See classes\desktop\chit.lua for the code for the destiny chits - there is code in onDragStart, onDrag and onDragEnd. The onDrag code should probably be moved into the onDragStart, but this is inheriting older code. the onDragEnd code just removes the chit from one pile and adds it to the other. There is also code in onDoubleClick to set the initial number of chits.

The main code is where the dragdata object is dropped - the onDrop event will be triggered. See the classes\desktop\diebox.lua script for a complex onDrop event handler - there are many types of dragdata objects that could be dropped on the dice panel - for more info on dragdata see here: https://www.fantasygrounds.com/refdoc/dragdata.xcp

Perhaps an easier one to look at would be the wound or strain tokens. Again chit.lua is used but the only code used is the onDrag event handler to set the dragdata for the chit. then in classes\characters\charsheet.lua there is the onDrop even handler for the character sheet that points to CharacterManager.onDrop with the dragdata info. In managers\charactermanager.lua is a big onDrop event handler that basically steps through each "type" of dragdata - in the section that details with type = chit, additional custom data identifies the chit as a wound chit and calls the addWound code.

This may sounds complex - but just step back to the basics:

Have a graphical object somewhere that represents your token/s, when the user initiates a drag create the draginfo data appropriately - usually with draginfo.setType, draginfo.setDescription, draginfo.setIcon etc..
Then have an onDrop event handler on the GUI object/s where this token/chit may be dropped. Write code to extract the data from the dragdata object and act on it appropriately.

If you want to restrict functionality to the GM only, User.isHost() is your friend - this will return true only on the GM instance, so use this to activate certain functionality only on the GM side, or to hide "stuff" on the player side.

S Ferguson
April 18th, 2014, 18:01
Thanks again. BTW is this similar to the way SW hands out "bennies?"

SF