Saibot393 / perceptive

A small Foundry VTT module to handle a few vision based enhancements
MIT License
8 stars 4 forks source link

[[Feature Request]] Add Toggle for VCs / Add variable distance calculations #51

Closed RinVindor closed 9 months ago

RinVindor commented 10 months ago

With the new VCs a great feature would be an option for players to have a toggle on and off method for any VC they have.

The second and best feature would be having a way to derive the distance a VC can work. For example in Chronicles of Darkness 2e, Vampire players can hear heartbeats at 3 yards/meters per point of Blood Potency. They can smell at 10 yards/meters per point of Blood Potency. So being able to reference traits on a character sheet to derive the distance a VC is active would be amazing.

Saibot393 commented 10 months ago

1: From a software point of view, toggeling them on and off should not be a problem. I am not quite sure though, how to put that into a ui. I can not add it to into character sheets since they are extremely system dependent. The only thing i can think of would be through macros, i.e. having a toggle macro per available vision channel. I am open for suggestions though. 2: I could basically abuse the code for rolls to do that. So every VC would have an additional text field in which a formula looking something like this @actor.system.BloodPotentcyAttribute*3. In this case i will also add a field for tokens to set their VC specific vision range and field to see the calculated VC range (if set)

RinVindor commented 10 months ago

1: I was thinking yeah either a macro or an option included with the token when right clicking it but that'd probably only work for 1 or 2 VCs. The macro would probably be the most effective method.

2: Yeah that is exactly what I was thinking

RinVindor commented 10 months ago

I didn't wanna make another ticket for this but side question, I noticed I cannot access the VC options from the Prototype tokens, only the tokens on a map at that moment which can be a bit tedious when trying to setup VCs especially in case scenarios where in Vampire the Requiem/Chronicles of Darkness all living creatures have a heartbeat and blood. Is there a way to set this up on the prototype tokens, not necessarily in bulk (though that'd be wild).

Saibot393 commented 10 months ago

That is a bug, i will fix it with the release that includes the other features (may take a day or so, the macro toggle filter is already working). You can bulk define tokens a emitting a specific channel via macros. An example can be found in perceptive>examples>vision channels>Add Channels to Selected Objects, the example adds the specified channels to all selected objects. Something similar will also work for prototype tokens. I can write a specific meacro for that if you want, assuming that all the tokens that emit the channel have some kind of identifiable property

RinVindor commented 10 months ago

Yeah having a macro for that would be great! Only other thing I could think of was additional effects filters like a pulsating option (similar to a heartbeat?) that sort of thing.

Saibot393 commented 10 months ago

I would love to add more effect filters but that requires shader prgramming and that is... not my strong suit. I will look into it though.

Saibot393 commented 10 months ago

The bug with the pototype tokens is fixed with 3.1.0. I have also added a macro to toggle receiving of VCs (Toggle VC receiver filter of selected Token) (or rather a toggle for an extra VC filter) and a formula setting for the range

RinVindor commented 10 months ago

As always it's wild how fast you work 😂

On Mon, Nov 27, 2023, 3:31 PM Saibot393 @.***> wrote:

The bug with the pototype tokens is fixed with 3.1.0. I have also added a macro to toggle receiving of VCs (or rather a toggle for an extra VC filter) and a formula setting for the range

— Reply to this email directly, view it on GitHub https://github.com/Saibot393/perceptive/issues/51#issuecomment-1828550620, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADAPYLMXMUIL6EBFUX6I2ODYGT2CHAVCNFSM6AAAAAA74EGKESVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRYGU2TANRSGA . You are receiving this because you authored the thread.Message ID: @.***>

RinVindor commented 10 months ago

Hey any chance you might be able to provide examples on how to get the formula for the range to work? I've tried a handful of variations but can't seem to get it to not throw up errors. image

image

Saibot393 commented 10 months ago

Thy syntax for the first formula in your attached screenshots should be @actor.system.vampire_traits.bloodPotency.final * 10

Saibot393 commented 10 months ago

I just had a closer look at the system. You probably want Blood sense VCs to be emitted by tokens which actors belong to a certain subset of the attached set, right? In this case writing an macro is easy. Just tell me to which of these you want to apply the VC and i can send you the macro code. image

RinVindor commented 10 months ago

Rules wise anything with blood counts so Mortals, Sleepwalkers, Mage, Scelesti, Proximi, Vampires, Changelings, Werewolves, Demons and Hunters qualify 😂

On the topic of the effects, do you think there is a way to adjust their thickness so that one can also be visible at the same time as others? Or general editing of their appearance?

Saibot393 commented 10 months ago

Here is the code to update all prototype tokens (you will need perceptive v3.1.1 for this to work, there was a small problem with prototype tokens in the last version):

let vChannelNames = ["Blood Scent", "Blood Hearing"];

let vTypes = ["Emits"]; //possible types: "Emits", "Receives", "Sight", "Movement"

let vChannelIDs = game.modules.get("perceptive").api.VisionChannelsUtils.VCIDsfromNames(vChannelNames);

let vObjects = game.actors.filter(vactor => vactor.type == "character");

vObjects = vObjects.map(vObject => vObject.prototypeToken);
console.log(vChannelIDs);

console.log(vObjects);

game.modules.get("perceptive").api.VisionChannelsUtils.AddChannelstoObject(vObjects, vChannelIDs, vTypes);

This macro will add the channels named "Blood Scent" and "Blood Hearing" as emitters to all character type actors prototypes.

Regarding effects, i use the standard foundry effect shader system for the effects. This system only allows for one shader at a time, so mixing is not possible without reqriting the whole system. As far as i can tell, the only setting of these filters i haven't used yet is the outline width of the outline filter (whic didn't seem to work the last time is tried it). I think the only way to add more meaningfull options to filters would be writing custom shaders (i am not sure if i am good enough at shader writing to write anything interesting or useable or performant).

RinVindor commented 10 months ago

Can confirm the macro works amazingly. I'll be saving this one, Saibot you're amazing haha, these updates are wildly useful.

Regarding effects using shaders I'm not sure how useful this might be but I previous have used this module don't know if it'd be of any use to you. https://foundryvtt.com/packages/tokenmagic/

Saibot393 commented 10 months ago

Thank you, thats a good idea. I didn't event thinkg of using another module for filters. I will see if i can include this modules effects.

Saibot393 commented 10 months ago

Update on the Token Magic effects: I have got the work but there is a bug that causes the animations to reset everytime the vision channels are recalculated (basically everytime a token moves). I was able to fix that bug for some effects (e.g. fog) but not for others. It will probably take a bit until i find a suitable fix, but i am working on it.

RinVindor commented 10 months ago

I'm confident you'll figure it out 😁 there's no rush the rest of this has made some stuff way more accessible.

On Fri, Dec 1, 2023, 4:58 AM Saibot393 @.***> wrote:

Update on the Token Magic shaders: I have got the work but there is a bug that causes the animations to reset everytime the vision channels are recalculated (basically everytime a token moves). I was able to fix that bug for some effects (e.g. fog) but not for others. It will probably take a bit until i find a suitable fix, but i am working on it.

— Reply to this email directly, view it on GitHub https://github.com/Saibot393/perceptive/issues/51#issuecomment-1835802678, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADAPYLL6LNQU3VZRN4DW5STYHGS33AVCNFSM6AAAAAA74EGKESVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZVHAYDENRXHA . You are receiving this because you authored the thread.Message ID: @.***>

Saibot393 commented 10 months ago

I have added a few Token Magic FX filters with v3.1.3. I have not yet included all filters since they take a bit of time, if you have need for a specific one, let me know. Not all filters are compatible however.

RinVindor commented 10 months ago

Yeah I wouldn't assume all would work. If I spot any though I'll let you know. Awesome job as always 🎉

On Sat, Dec 2, 2023, 7:33 AM Saibot393 @.***> wrote:

I have added a few Token Magic FX filters with v3.1.3. I have not yet included all filters since they take a bit of time, if you have need for a specific one, let me know. Not all filters are compatible however.

— Reply to this email directly, view it on GitHub https://github.com/Saibot393/perceptive/issues/51#issuecomment-1837138054, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADAPYLLWE4IOIBXI3MKVVB3YHMNZPAVCNFSM6AAAAAA74EGKESVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZXGEZTQMBVGQ . You are receiving this because you authored the thread.Message ID: @.***>

Saibot393 commented 9 months ago

I think all features/bugs in this issue should be resolved , right? If so i will be closing this issue.

RinVindor commented 9 months ago

Yeah you've definitely solved this and beyond 😂

On Tue, Dec 12, 2023, 7:47 AM Saibot393 @.***> wrote:

I think all features/bugs in this issue should be resolved , right? If so i will be closing this issue.

— Reply to this email directly, view it on GitHub https://github.com/Saibot393/perceptive/issues/51#issuecomment-1851970105, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADAPYLJVFUNVVFYDJGFTXRLYJBG4JAVCNFSM6AAAAAA74EGKESVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJRHE3TAMJQGU . You are receiving this because you authored the thread.Message ID: @.***>