PDA

View Full Version : Mod question - drop HP on map tokens



JMnITup
June 24th, 2008, 18:20
Any idea if it's possible to do this? I've been looking through available code and can't really find a way to do it, but it 'seems' like it should be possible in theory. I'm just not seeing it.

I want to be able to drag a damage roll over a token on a map (Which is tied to an entry in the CombatTracker) and have it applied as damage. Possible?

Also, is there any way, from the combat tracker, to influence linked tokens on a map? I know you can change the scale on the map from the combat tracker, so it again SEEMS like it should be possible, but I'm coming up empty when actually trying. I.e. could it be rotated, could an 'overlay' token be put on top of it, can the underlay be updated, etc?

richvalle
June 24th, 2008, 18:44
You can also change the size and reach of a creature on the CT and it will change on the map so there are links there.


I've also had that 'drop damage onto a token' idea and thought about asking for it but never got around to it. So... I 2nd this idea!!!

:)

rv

Griogre
June 24th, 2008, 21:37
Yeah it can be a pain to find a specific monster on the tracker so being able to drop damage on the map token would be awesome.

Oberoten
June 24th, 2008, 22:47
Yeah, any hint on this and how to do it would be thoroughly awesome.

joshuha
June 25th, 2008, 01:14
Well since tokens aren't windowcontrols they really don't support an onDrop type of interface. However, something like this may be able to be hacked using the following logic:


An imagecontrol contains a list of all tokens on it using the getTokens() function. It also knows when a token is added via an event onTokenAdded().
A token can return its position using getPosition().
Whenever a token is added from the combat tracker you would need to create your own registry table to track the position of the token and combat tracker entry it was tied to.
You can retreive the scale of the token using getScale().
Using the above and assuming a standard pixel size of 50x50 or some other base you calculate the size of the token and which grid coordinates on the image it takes up.
An imagecontrol is a windowcontrol and does support onDrop events. onDrop returns the x,y coordinates of where the drop ended.
Process the onDrop, verify the type is number, check it against valid coordinates that would match a token, and then apply that number value to your registry table linked combat tracker entry.


Now all of the above should be possible but could be some issues. Its possible the onDrop on the imagecontrol won't trigger when you drop the number onto a token but I would need to test to verify that.

Sigurd
June 25th, 2008, 09:32
This seems sort of short sighted. Dragging a number across to the map and finding the right token seems at least as difficult as the combat tracker.

It would be ideal if the combat tracker had a big wide icon for enemies and a radial dialogue based on the enemies position in the tracker.

Sigurd

joshuha
June 25th, 2008, 12:41
This seems sort of short sighted. Dragging a number across to the map and finding the right token seems at least as difficult as the combat tracker.

It would be ideal if the combat tracker had a big wide icon for enemies and a radial dialogue based on the enemies position in the tracker.

Sigurd

I think it would be easier on the map. Players tend to want to just say, I attack the goblin in front of me, or I shoot at the guard on the left (in a line of 5 of them). Being able to just drag the damage on the linked token in the map would make things easier from a DM point of view than having to locate that entry in the tracker manually.

richvalle
June 25th, 2008, 14:09
The problem comes up when there are a lot of bad guys. I've had fights with 20 or more lesser demons vs the party. The CT gets filled up and scrolls off the bottom. So trying to find the right one becomes problematic. It also becomes an issue when I try to drag the damage over and then see that the bad guy is off the CT and then have to drop the damage, scroll the CT and then drag and drop it again.

rv

JMnITup
June 25th, 2008, 19:16
Yes, what they said... One, it's far easier in large battles to look for the characters targetting mark than try to find it in the combat tracker... window management in FG2 leaves something to be desired... and every time I try to scroll through the combat tracker, often I accidentally scroll an important field like init, HP, etc just because I STILL make that mistake (not finding the 1 little magic area of the box you can safely scroll without risking updating something)

Typically the map is somewhere visible, the relevant attack is in the field of view, and it's obvious what is being attacked, even in a massive battle, based on proximity and the aforementioned character target underlay. Yeah, you could try finding the targetted by icon in the CT, but that still might involve a lot of (for me, risky) scrolling, and if you have lots of things targetted or expanded, even more difficult.

So yes, for me, it would be VERY beneficial for that to work

Oberoten
June 25th, 2008, 21:29
Also if the tokens would be exposed to more scripting one might have more status in their popup than merely a name.

... damage-level perchance? Lightly wounded, Hurt, Heavily wounded.

unimatrixzero
June 25th, 2008, 21:47
Would a double click function work on a token? perhaps it could bring up a mini sheet full of stats?

Uni

Dachannien
June 25th, 2008, 22:29
Also if the tokens would be exposed to more scripting one might have more status in their popup than merely a name.

... damage-level perchance? Lightly wounded, Hurt, Heavily wounded.

I ended up replacing the friend/foe background with a color-shade indication of percent hit points remaining. I don't recall if I ever posted that one here, though.

JMnITup
June 26th, 2008, 00:15
Or better, something I do manually but it's a pain, have stacking 'overlay' tokens automatically grouped and updated... like a little symbol for bloodied, marked, etc, that right now I manually put down, and if I move the token I have to move all 3, and then fiddle with everything until the small overlay tokens are actually ABOVE the main token instead of hidden below it... building a base framework of routines to help script these tokens could be used in a ton of ways by creative modders.

Still can't fathom how they missed implementing this directly, though... or at least giving the most basic hooks.

DNH
June 26th, 2008, 11:48
Can I just ask why it is in fact necessary to drag-and-drop wounds values at all, either to the map or the CT? If the players are already targetting their foes, the CT is aware of this, so why is it not possible to auto-apply the damage rolled (based on player-id and what have you)? Or better still, get a yes/no confirmation from the GM.

I can think of a couple of issues (players not targetting, targetting themselves, targetting too many foes; players rolling damage dice out of turn) but these should not be insurmountable (... he said!).

Any thoughts?

Goblin-King
June 26th, 2008, 17:41
For what it's worth, I think the ideas for mouse/drop events for tokens in this thread are worthy of consideration. Also, being able to link tokens together would be nice and that would help with status indicators and such.

Sigurd
June 26th, 2008, 18:41
Welcome Tero

Your thoughts are always worth reading for FG

JMnITup
July 27th, 2008, 09:49
Ok, I had forgotten about this for a while, but found a sort of similiar tact that 'mostly' works for this... it works completely for the host, in fact, with a couple little caveats...

Unfortunately, if a token is non-modifiable and you are not the host, all events over that section of screen are blocked... it won't accept drops, hover updates, clicks, or anything.. in fact, if you drag a token you have modify access to over one you don't, you usually can't drop it there at all and the token just goes away... if you happen to get it to snap to a grid underneath a non-modifiable token, you are just out of luck.

I sort of hack-fixed this by allowing clients to modify tokens, but that isn't a good solution.

Also, I found that, as far as I can tell, there is no way to access the image 'scalelock' node.. I can see it in the db.xml under the image type.tokens nodes, but I can't access that databasenode path via script, and there are no exposed functions to get global token scaling values... so if you lock token scale, my bounding boxes get all out of whack. :( Also, given that there is no way to figure out token image dimensions, I just have to assume all tokens have a standard size, which is SORT of true, but... again, not ideal.

Anyway, yeah, there it is.

Sooooo... any idea when some token and image exposure might be added to FG2 scripting? :)