True Invisibility for tokens.

Show off your RPG maps, campaigns, and tokens. Share your gaming experiences and stories under General Discussion and save this forum for things you've created that may help others run their own games. Use the subforums when appropriate.

Moderators: dorpond, trevor, Azhrei, Gamerdude

Post Reply
User avatar
Sereptus
Giant
Posts: 123
Joined: Tue Jun 07, 2011 12:08 pm
Location: Canada

True Invisibility for tokens.

Post by Sereptus »

I wrote some simple code that can be placed on a macro on the token itself or in the campaign macros and it will render the token completely invisible to all but the owner and GM, it doesn't even show up in an initiative order (although it is there, just others cant see it)either which is handy for when a PC/NPC that's invisible hasn't yet attacked. I'm putting this in this section because it can used in ANY framework as far as I've tested as long as you have/create a state called "Invisible".

Code: Select all

[H: "<!-- get a list of selected tokens -->"]
[H: ids = getSelected()]

[H: "<!-- if we have more than one token selected, output error and exit -->"]
[h: doAbort = if(listCount(ids)==0,0,1)]
[h: abort(doAbort)]
[h: assert(listCount(ids) == 1,"<font color=red><b>" + getMacroName() + "</b> may only be run on one token at at time.</font>",0)]

[H: "<!-- at this point we should only have one token id in our list so grab the first and only token id -->"]
[h: token=listGet(ids, 0)]

[H: "<!-- getOwnerOnlyVisible state -->"]
[h: Vis=getOwnerOnlyVisible(token)]

[H: "<!-- if we are set to OwnerOnlyVisible then we need to toggle -->"]
[h: Vis=if(Vis==1, 0, 1)]

[H: "<!-- set the Invisible state to correspond with our toggled OwnerOnlyVisible state -->"]
[h: setState("Invisible", Vis,token)]

[H: "<!-- setOwnerOnlyVisible to our toggle OwnerOnlyVisible state -->"]
[h: setOwnerOnlyVisible(Vis,token)]

[H: "<!-- create Disappear/Appear message -->"]
[h: msg=if(Vis==1,"Disappears!!","Appears!!")]
[h: msg=getName(token) + " " + msg]

[H: "<!-- send Disappear/Appear message to everyone only if we are a player.  GM toggles should be silent. -->"]
[h, if(isGM()==0), Code: {
  [h: outputTo("all",msg)]
}]
I REALLY hope this hasn't been already addressed and solved somewhere else on the forums and I missed it, otherwise enjoy!
Last edited by Sereptus on Thu Sep 18, 2014 4:39 pm, edited 2 times in total.
OOOHH RegEx....YOU BITTER-SWEET BEAST!!!

User avatar
lmarkus001
Great Wyrm
Posts: 1867
Joined: Sat Mar 29, 2008 12:30 am
Location: Layfayette Hill, PA

Re: True Invisibility for tokens.

Post by lmarkus001 »

Did you use the Invisible mod-set in the framework? That should give true invisibility plus allow for those that have See Invisible running (this requires the GM modifying the ownership of the object layer copy of the token to include the person with see invis).

The way the mod-set works is it sets the current token to Owner visible only, then creates a token on the object layer that has no image but has the state icon that is visible to owners only. When the player moves their token, the object layer copy gets moved to the same location. This way you can set ownership to the copy and grant only basic location information to the person with see invis running.

I have used this extensively without issue, so am curious what is going awry for you. (I had a pixie character that was invisible 99.9% of the time, so the testing has been robust.)

User avatar
Sereptus
Giant
Posts: 123
Joined: Tue Jun 07, 2011 12:08 pm
Location: Canada

Re: True Invisibility for tokens.

Post by Sereptus »

lmarkus001 wrote: I have used this extensively without issue, so am curious what is going awry for you. (I had a pixie character that was invisible 99.9% of the time, so the testing has been robust.)
Years ago when I started playing Pathfinder online using your framework this option wasn't working or available ( I cant remember the scenario) but I came up with that code and we've been using it ever since. We may have been using ?Linsays?, in any case since I was playing with two or three other programmers we just continued making our own improvements and adjustments to suit our play and house rules until now. Long story short, sort of, I see that it is indeed working and is quite a bit more robust than I remember.I will edit my original post immediately, my profuse apologies! Looking back at my original post I cant believe I even mentioned your framework!! I'll be more vigilant of any future posts I make (maybe with some thought to what I'm saying!) Your incredible contribution to this gaming community and my personal enjoyment cant be measured or described with words!! :oops:
OOOHH RegEx....YOU BITTER-SWEET BEAST!!!

User avatar
lmarkus001
Great Wyrm
Posts: 1867
Joined: Sat Mar 29, 2008 12:30 am
Location: Layfayette Hill, PA

Re: True Invisibility for tokens.

Post by lmarkus001 »

Ah no worries, I wanted to find any issues folks might have had.

Your code is nice and framework generic which makes it a nice tool!

Post Reply

Return to “User Creations”