View Full Version : tokeninstance making it not targetable
SilentRuin
November 20th, 2023, 20:00
Ok just a basic question (as I'm having trouble with doing what I thought I could do)...
NPC token in map that is also in CT, I want to make totally untargetable when I place it with an extension.
What is the best way to accomplish this so that it is persistent between sessions and for the life of that token? (please don't let it be onAddToken :( )
SilentRuin
November 20th, 2023, 21:59
Updated to a better way of asking this question (as what I'm doing is obviouly got issues - works first time I place - but won't next time map comes up).
Moon Wizard
November 21st, 2023, 02:14
setTargetable isn't a persistent setting. It will need to be set each time the session/token is initialized.
Most settings are set by the standard TokenManager code in the onAdd event, which is triggered at the beginning of each session. You'll probably need something similar.
Regards,
JPG
SilentRuin
November 21st, 2023, 02:40
Nuts. That's what I had to do for Map Parcel tokens that are tied to the parcels and not the CT :(
Was hoping to avoid that onTokenAdd stuff everytime the map loaded if it was an already established FGU supported token link to CT. Ah well - at least I know it can be done already.
SilentRuin
November 21st, 2023, 17:49
setTargetable isn't a persistent setting. It will need to be set each time the session/token is initialized.
Most settings are set by the standard TokenManager code in the onAdd event, which is triggered at the beginning of each session. You'll probably need something similar.
Regards,
JPG
I just can't seem to get that setTargetable(false) to stick - seems something is resetting or just ignoring that I set it on a CT tied token. I found that overriding TokenManager.updateAttributesHelper to call its original code then call mine was the perfect place to catch all reloads of tokens into the map etc. - but again - it would never respect the targetable flag.
I'm persuing simply doing a Token.onTargetUpdate where I simply check if setting source to target is "true", and if an effect of "NOTARGETING" is in target's CT effects, then I simply set it back to false. I "think" it works in all the places I tried (ctrl click on map and CT for targeting).
Still have to test things that generate target lists outside of what I've tested.
Moon Wizard
November 21st, 2023, 18:51
Checking the code in the client; that function does not do anything in FGU (i.e. setTargetable is empty function). All tokens have been targetable in FGU since it was released.
JPG
SilentRuin
November 21st, 2023, 19:33
Well i'm sure I got it from someplace - I did not make it up for sure. I suppose the place I used it before simply is not targetable because it is tied to a different DB table than the CT. I guess this is my one way to accomplish it. Ok thanks for the info.
Powered by vBulletin® Version 4.2.1 Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.