Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Is it possible to make a token visible to only one player?

I want to control which players can see particular tokens. Is there a variable / method to control this in the API? Does anyone know of a script which already does this?

Thanks!!
June 13 (11 years ago)
Alex L.
Pro
Sheet Author
It is possible, it basically involves having a page for each player then replicating actions across them all, it was discussed in detail but to my knowledge no one sat down and made a ready for use script.
That sounds incredibly complicated.

Does anyone know if there is a way to show one player the GM layer?
June 14 (11 years ago)

Edited June 14 (11 years ago)

Doug H. said:

That sounds incredibly complicated.

Does anyone know if there is a way to show one player the GM layer?


Yea, in the way Alex mentioned, only slightly different. Duplicate your entire map the party is on. Then on the dupe map, add the tokens that are "invisible." When a player gains "sight" just drag his/her token out of your journal onto the dupe map.

The only complication here is you will have to move all the tokens on both maps to sync up.
June 14 (11 years ago)
The Aaron
Roll20 Production Team
API Scripter
Yeah, I think Alex is suggesting a script that would automatically duplicate anything on one page onto another, moving something on one page would move it on the other. But objects added on one of the invisible pages could somehow be flagged to not copy over to the clones.
Yea, that would be a major undertaking.

Michael P. said:

When a player gains "sight" just drag his/her token out of your journal onto the dupe map.


I didn't realize it was possible to split the party like that. Is that something that is done with the API or something that can be done normally?

Ah, nevermind. I see that the party can be split normally. Practically, though, I don't think that would run well unless there were a script that automatically synced the token positions.
It is possible, albeit with a metric shit tonne of coding.
June 15 (11 years ago)

Edited June 15 (11 years ago)
Would it?

After obtaining a method to input the page you desired to duplicate, I'd imagine it would be a relatively simple matter to do a findObjs utilizing that page as one of the search criteria, using a CreateObj command, and then to perform particular actions based upon the object _type.

After making the duplicate pages, couldn't you just make an on graphic event that finds all objects of the same field (I.E. same imgsrc) and then have then adapt the same position as the just-moved graphic?

on("change:graphic", function(obj, prev) {
if (MimicOn) {
var SameObjList = findObjs({imgsrc:obj.get("imgsrc")})

for (var i = 0 ; i < SameObjList.length ; i++) {SameObjList[i].set("top",obj.get("top")).set("left",obj.get("left"))}
}
})
June 15 (11 years ago)
The Aaron
Roll20 Production Team
API Scripter
Same image source wouldn't be sufficient. if you had more than one token with the same graphic it would be a problem (think bunch of orcs). However, you're not far off. You could look on the duplicate page for a token with the same location, name, etc as the prev object and update it to be like the obj object.

You would also need to deal with add and destroy (however you want to do that since you can't destroy tokens from the API yet), not to mention other types of things, like drawings and text. You'd also need to be able to denote objects that aren't to be duplicated (the invisible objects) in some fashion. If you have more than one character experiencing different invisible objects, you would need that many more duplicated and synchronized objects.

Also, I don't think the API can create pages yet.
June 15 (11 years ago)
Well, the method of selection would depend upon the criteria the player put forth, wouldn't it? Could be by represents. Could be imgsrc. Could be name -- take your pick, or a combination thereof.

Furthermore, all that was noted in the first post was tokens. While I get this wouldn't encompass everything, I also don't imagine it would need to either. I haven't fiddled with drawings too much so I wouldn't know how to manipulate them very well, but I think a fair chunk of people would be pretty happy just having the pogs wrap around everywhere.

To me it feels like the need to designate invisible objects is a bit of a 'niche' (as you can simply place them after or edit them out on each particular map as is desired) but ultimately wouldn't be that hard to put in, would it? Simply have a list you can push onto or purge at any so desired time.

As for the page creation issue, I don't imagine it would be that hard to manually duplicate the page and have it copy over the background in the process as well.
June 15 (11 years ago)
The Aaron
Roll20 Production Team
API Scripter
Yeah, I concur. This would be far easier to handle by having a "can see" permission similar to the fields that provide view and edit in the journal. Would be great if the object and gm layers automatically populated the "can see" layer to either be "all players" or "empty". Then the GM could specify certain players to see them if necessary.