PDA

View Full Version : Placing object tokens not linked to NPC in an encounter



Korav
January 2nd, 2018, 18:03
So I am working on a module that I want to use later in the campaign. As part of the module preparation I created an encounter that includes two stages. In the first stage the characters need to interact with some objects and place them in the correct location on the map. This then triggers the second stage (combat encounter).

Preparing the second stage is clear because in the encounter the tokens are associated with NPC and can be placed on the map as part of the encounter, so no problem here.

However, my question is around placing tokens that are not linked with NPC. In the module preparation, I can drag the tokens to the map to the starting location. But once I export this module and load it into my live campaign, that pre-placement isn't retained.

It seems like my only option would be to create NPC sheets for the my objects, then create a separate encounter with these object if I want to retain starting position. Is this the only option or am I missing something? The thing is, it's not a combat encounter, so adding them to the combat tracker is really unnecessary, not to mention the objects aren't NPCs.

Thanks for the help and guidance.

Trenloe
January 2nd, 2018, 18:05
Welcome to the forums Korav

The only way to have token pre-placement on a map in a module is to use the encounter NPC token placement that you mention.

Korav
January 2nd, 2018, 18:08
Thank you for confirming, I did search around but couldn't find a definitive answer. I figured that was likely the case, but being new I wanted to be sure I wasn't missing something.

Ken L
January 4th, 2018, 08:33
FG is encounter based unfortunately. So you can't seamlessly have NPC tokens on the map, then add them to the CT when combat starts.

I've been looking to add a functionality like this, but it's a messy affair that'll have 0 compatibility with a future version of FG.

Ken L
January 16th, 2018, 03:34
Fiddled a bit tonight and it's actually easier than I thought it was.

Just need to hook into image_record's image.lua along with a databasenode to store token_id -> npc tuples to track their destruction and other housekeeping (ie link breaking etc...). This is an option smite should look into to ease Roll20 users who are used to a map-centric system. There's also a bunch of group things that would be neat if added such as select + group visibility toggle or delete to make some use out of the selection tool. I'm currently tinkering on adding them myself which is a good option to have, but I really feel that these should have been base features.

https://i.imgur.com/2UCn1eC.gif

JohnD
January 16th, 2018, 04:43
Nice! :)

celestian
January 16th, 2018, 05:45
FG is encounter based unfortunately. So you can't seamlessly have NPC tokens on the map, then add them to the CT when combat starts.

I've been looking to add a functionality like this, but it's a messy affair that'll have 0 compatibility with a future version of FG.

I've been poking at this as well. The biggest blocker I ran across was the export issue. I had it setup and working where I could double click and the NPC would load up in the combat tracker but if the map won't export with the tokens/values it doesn't help much ;(

Nickademus
January 16th, 2018, 14:44
I've posted directions for doing this a couple times over the years, though they probably are hard for the Search to find. Let me put up my text file where I keep them....

EDIT: Here you go. Export the module as normal. Then open the campaign's db.xml and copy the entire <image> section. Open the main module file and delete the <image> section, replacing it with the copied one from the campaign. Select the <image> section (this is important) and hit Ctrl+H or whatever the Find and Replace hotkey is for your program. Make sure the 'In Selection' checkbox is checked so you don't modify anything outside of the <image> section. The do a series of find-and-replaces as follows, where 'Module' is the name of your module:


replace: campaign/tokens
with: tokens/campaign


replace: png</prototype>
with: png@Module</prototype>


replace: jpg</prototype>
with: jpg@Module</prototype>


replace: >images/
with: >


Save the module of course. Now everything for the image except masking is stored in the module.

celestian
January 16th, 2018, 14:54
I've posted directions for doing this a couple times over the years, though they probably are hard for the Search to find. Let me put up my text file where I keep them....

EDIT: Here you go. Export the module as normal. Then open the campaign's db.xml and copy the entire <image> section. Open the main module file and delete the <image> section, replacing it with the copied one from the campaign. Select the <image> section (this is important) and hit Ctrl+H or whatever the Find and Replace hotkey is for your program. Make sure the 'In Selection' checkbox is checked so you don't modify anything outside of the <image> section. The do a series of find-and-replaces as follows, where 'Module' is the name of your module:


replace: campaign/tokens
with: tokens/campaign


replace: png</prototype>
with: png@Module</prototype>


replace: jpg</prototype>
with: jpg@Module</prototype>


replace: >images/
with: >


Save the module of course. Now everything for the image except masking is stored in the module.

Thanks for the work around information! I'll have to revisit this someday now that I can at least get the data "exported" I needed.

Ken L
January 16th, 2018, 21:02
Ah, Celestian you perform a reverse lookup based on token prototype? Wouldn't that produce a ton of false positives (letter tokens)? I needed a small dictionary datastructure in addition to the map tokens which can't be exported as far as I know, but at least it's O(1).

celestian
January 16th, 2018, 21:49
Ah, Celestian you perform a reverse lookup based on token prototype? Wouldn't that produce a ton of false positives (letter tokens)? I needed a small dictionary datastructure in addition to the map tokens which can't be exported as far as I know, but at least it's O(1).

I can't recall the specifics exactly but I am pretty sure I just used the object path for the name (npc.id-00012). I would have much rather had a secondary field (custom?) that I could use and leave name alone. On the load request it would see if it was a valid id, load it and if it was an npc load it in the combat tracker like any other npc add.

I mostly wanted to be able to put npcs in as tokens instead of creating encounters (habit I got from maptools)... I much prefer being able to see (as DM) the npc tokens so if something would come based on noise/etc it's much easier to deal with (instead of looking at every nearby rooms story pin).

It wasn't very pretty at the time but I was just doing a proof of concept to see if it would work... when I ran into the export issue I gave up for the time being.

Ken L
January 16th, 2018, 23:36
My method is kosher, I just added a map_npc_list top level node which had token IDs as keys to the the npc node path in string form. In image.lua I just added a menu item that then used this list to tell if the token or selected tokens (for group add) was linked. There's other book-keeping but it's actually quite trivial.

LordEntrails
January 16th, 2018, 23:39
Question, how to handle token images that are used for multiple different NPCs? Do you have a duplicate image with a new name?

Ken L
January 17th, 2018, 00:34
It's not based on the images. I bind the token IDs to the npc node names in a table. Celestian puts the npc node name in the token name fields. The rest is just standard plumbing.

LordEntrails
January 17th, 2018, 00:43
But if I have one token "goblin.png" but I want to use that token (image) for five different NPCs (goblin soldier, goblin archer, goblin shaman, goblin acolyte, goblin chief) would you need 5 different tokens? One image? Five images?

celestian
January 17th, 2018, 01:21
Question, how to handle token images that are used for multiple different NPCs? Do you have a duplicate image with a new name?

Mine was just based on the npc ID. It would just load another npc using that ID from the npc list. Just like dragging and dropping another orc onto the combat tracker. Each token's name was the npc.id-XXXX.

You would just drag/drop the npc from the NPC records onto the map and it would use that token and set the name to the ID for you.

(not sure if that was directed to the discussion in general or Ken).

LordEntrails
January 17th, 2018, 02:56
A general question, mostly due to my lack of understanding of the implications of what you two have been talking about :)

Ken L
January 17th, 2018, 04:46
It's kinda the cookie cutter reason that while 'possible' it is not an extension someone would want to support as there's 0 forward compatibility for it. It does however have immediate utility, but woe to the person who has to support it once FG updates.

Just a prod for getting official FG support for map tokens.

Bidmaron
January 17th, 2018, 09:33
Ken, this is probably just me not understanding fully what you two have been batting back and forth, but I don't see what makes the extension such a maintenance nightmare. I doubt anyone is going to change token file names from one version to the next. What I would be concerned about is that the export would only work (most likely) on one campaign because if people didn't load tokens and token modules in exactly the same order in the next campaign, their token path would be different from one campaign to the next. And that problem would exist even if FG never got updated again at all.