5E Character Create Playlist
Page 1 of 3 123 Last
  1. #1

    Tokens, custom data in them?

    So I am trying to make it so I can drag/drop an npc from the npc records and then when im running the game can right click and "load" the npc into the CT. I've done some preliminary work and have been able to get it to show a token instead of a pin but having issues figuring out where I can store the npc node path.

    Here is what it looks like in the xml. The first one (shortcuts) is the current style... when you drag/drop a npc on the map it' pins and type is "shortcut". The second is tokens, that one I created drag/dropping and manipulating it so it has a token prototype. But as you can see I'm not sure where I can put the npc.ID-XXXX somewhere so I can later grab it from the doubleclick and/or right click/load.


    Code:
    					<shortcuts>
    						<shortcut>
    							<x>221</x>
    							<y>213</y>
    							<class>npc</class>
    							<recordname>npc.id-00002</recordname>
    						</shortcut>
    					</shortcuts>
    
    					<tokens>
    						<idcounter>1</idcounter>
    						<token>
    							<prototype>tokens/Medium/a.png@Letter Tokens</prototype>
    							<id>1</id>
    							<x>125</x>
    							<y>238</y>
    						</token>
    					</tokens>
    Is there a custom field we can use in token data somewhere/somehow?

    Suggestions?

    The reason I want to do this is so the pins are room details/etc but the npcs are showing to the DM as tokens. I prefer to see all the NPCs/encounters on the map so if I want another room to react to a situation it's easier to catch it. Also makes sure that I remember which NPCs have been encountered and which haven't. You can do this now but must have ALL the npcs in the CT... and that's just not feasible. This might not make sense to some folks I guess but it's something from Maptools I was a big fan of.
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset FGU Reference Module, or Web.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  2. #2
    There is no place to store the NPC path unless you make it. The tokens do not allow any metadata to be attached to them, only names, underlays and widgets.

    You would have to craft a custom solution that adds the NPC "link tokens" to some sort of internal database structure that stores the image, the token ID and the NPC link. Then, when a GM selects the option to add to the CT, you would replace the "link token" with the "CT token".

    Cheers,
    JPG

  3. #3
    Quote Originally Posted by Moon Wizard View Post
    There is no place to store the NPC path unless you make it. The tokens do not allow any metadata to be attached to them, only names, underlays and widgets.

    You would have to craft a custom solution that adds the NPC "link tokens" to some sort of internal database structure that stores the image, the token ID and the NPC link. Then, when a GM selects the option to add to the CT, you would replace the "link token" with the "CT token".

    Cheers,
    JPG
    Perhaps someday we'll have custom data we can populate in tokens but for now I'll see if I can't figure out a ID/node reference system. The problem is I don't see a function to deal with setting the ID so I could then reference it back to a node I maintain... there is a ".getId()" but I don't think that exists until the "node/token" is on the map.

    Is there a reason we can't manipulate nodes for things like this? I noticed it was the same for draginfo. setMetaData really was the only reason I could do what I did previously.
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset FGU Reference Module, or Web.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  4. #4
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,672
    I built up a database of label data to apply to widgets attached to tokens in the Image label extension (note - not currently updated to v3.3.3 compatibility). I used the token name to match data.

    It may give you some ideas. Extension here: https://www.fantasygrounds.com/forum...abel-Extension
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  5. #5
    Quote Originally Posted by Trenloe View Post
    I built up a database of label data to apply to widgets attached to tokens in the Image label extension (note - not currently updated to v3.3.3 compatibility). I used the token name to match data.

    It may give you some ideas. Extension here: https://www.fantasygrounds.com/forum...abel-Extension
    Very good tips, thanks!

    I'm still having issues tracking down the actual point where the token data is written. Best I can locate is image.lua, the "onDrop()" but that's not all of it. What I want to do is tweak the bit where it creates the token to run some experiments ... but right now I'm not sure where that is. If I change the type and set a token prototype is places it as a token but that's not enough. It's just at the point I can find there is no "token" to tweak yet.

    I suspected parts of it were in manager_token.lua "OnTokenAdd" but by then the draginfo is gone and doesn't really help me.

    There is also manager_image.lua and onTokenAdd() but there as well draginfo is not present so I won't have the ability to fiddle with (or map ID's/etc).

    What I've had to do so far is detect the type of draginfo (shortcut with node path ^npc.id) and then manipulate it and add it manually with Token.addToken() and return false so it's not added twice. Doing that I can set the names of the tokens to the node ID of the npc which for now is a start but it's not placing the tokens right using the onDrop x, y data. I'm guessing it's scaling.

    Would be nice to just inject data into the draginfo node that is applied to token and avoid my kludgie mess ;(.

    I'll tinker with it some more after work tomorrow and see if I can come up with a better attack vector.
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset FGU Reference Module, or Web.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  6. #6
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,822
    Blog Entries
    1
    Hi celestian - what are you actually trying to achieve?
    Are you re-inventing the wheel? I know its a different approach but pinning an encounter to the map pretty much does the same thing with the same number of clicks.
    You also dont run the risk of having an unassociated token on the map (because the GM missed one right click - add to CT) and having players wonder why their attacks arent working.

  7. #7
    Quote Originally Posted by damned View Post
    Hi celestian - what are you actually trying to achieve?
    Are you re-inventing the wheel? I know its a different approach but pinning an encounter to the map pretty much does the same thing with the same number of clicks.
    You also dont run the risk of having an unassociated token on the map (because the GM missed one right click - add to CT) and having players wonder why their attacks arent working.
    I mentioned it at the end of the first post but my plan is to have the tokens on the map, not visible to anyone but GM. Then when I want to use them I'd "add" them to the CT.

    The problem with the pins is they aren't very descriptive unless I click on them and read it. Having the tokens pre-placed on the map so I can see where each creature is makes my life as a DM much less stressful

    My plan is to ... (once/if I get this working) is to be able to use the select tool and bulk add npcs to the CT. The placeholders will be nuked and replaced with actual tokens that the PCs can see (assuming I make them visible).

    Believe me, I get what you're saying and I've been using the "encounters" option for a while. I just can't seem to get comfortable with it. The style I'm describing is what I've used in Maptools for years. Used the same method in roll20 when I used it for a time... I did the same thing with Klooge (yeah, look it up also.

    Helps me keep track of npcs easier, visually and also makes it more intuitive for "activating" npcs nearby that might "hear" the noise without having to memorize every single room's contents (or having to click on all of them).
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset FGU Reference Module, or Web.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  8. #8
    Ran through several ideas I had to make this not so messy, most of them failed... I eventually was able to have the name of the token be the path/node of the object to load. If the NPC dropped had a token image it would use that if not use the first letter thing. When the placeholder token was double clicked it would spawn the NPC (place it in the combat tracker and remove and replace the placeholder token).

    It works and it is pretty easy to load them just double clicking the ones I want added.

    For this mode I don't need a reference ID and local DB containing links to what I really would like to add. Node ID, foe status, count to spawn? visibility?

    I'll add a request to the "list of stuff that would be nice to have" in FG, i.e. token.get/setMetadata[""]="" like is used in draginfo.

    In the meantime I gotta figure out why the drop location is off when using drop() x/y cords for the placeholder.
    Last edited by celestian; October 24th, 2017 at 22:59.
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset FGU Reference Module, or Web.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  9. #9
    You might want to add a widget to the "linked, but not to the combat tracker" tokens to be able to identify the difference between free range tokens and CT tokens.

    Regards,
    JPG

  10. #10

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    Very nice work, Celestian. This will work for corerpg right, not just 5e?

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
  •  
Fantasy Grounds Merchandise

Log in

Log in