Ero sivun ”Hiekkalaatikko” versioiden välillä
Siirry navigaatioon
Siirry hakuun
pEi muokkausyhteenvetoa |
pEi muokkausyhteenvetoa |
||
(52 välissä olevaa versiota 3 käyttäjän tekeminä ei näytetä) | |||
Rivi 1: | Rivi 1: | ||
Tämän makron avulla voit käyttää ''Enlarge Person''-loitsua, sitten että se huomioi kaikki koon muutoksesta tulevat vaikutukset. | |||
:Luo ensin makron vaatima ''Buff'' ja nimeä se ''Enlarge Person''. | |||
[[Tiedosto:Enlarge person1.PNG|500px]] | |||
:Lisää luomasi buffin ''Changes''-välilehdelle loitsun aiheuttamat muutokset attribuutteihin. | |||
[[Tiedosto:Enlarge person2.PNG|500px]] | |||
:Hae ''Compendium packs'' valikosta kohdasta ''Sample macros'' esimerkki makro ''Toggle Buff'' ja raahaa se alas ''Macros Directory''n vapaaseen paikkaan. | |||
[[Tiedosto:Enlarge person3.PNG|500px]] | |||
:Tämän jälkeen kopioi alla oleva koodi ja korvaa sillä ''Toggle Buff''in sisältö. Nimeä uusi makro esim. nimellä Enlarge Person. | |||
<pre> | |||
// CONFIGURATION | |||
// If one or more tokens are selected, those will be used instead of the listed actors | |||
// Leave the actorNames array empty to guess the players | |||
// Example actorNames: `actorNames: ["Bob", "John"],` | |||
const c = { | |||
actorNames: [], | |||
buffName: "Enlarge Person" | |||
}; | |||
// END CONFIGURATION | |||
const transform = (caster, size) => { | |||
caster.update({'data.traits.size': size}); | |||
} | }; | ||
const sizes = ["fine", "dim", "tiny", "sm", "med", "lg", "huge", "grg", "col"]; | |||
var sizeToBe = 0 | |||
const tokens = canvas.tokens.controlled; | |||
let actors = tokens.map(o => o.actor); | |||
if (!actors.length && c.actorNames.length) actors = game.actors.entities.filter(o => c.actorNames.includes(o.name)); | |||
if (!actors.length) actors = game.actors.entities.filter(o => o.isPC); | |||
actors = actors.filter(o => o.hasPerm(game.user, "OWNER")); | |||
if (!actors.length) ui.notifications.warn("No applicable actor(s) found"); | |||
else { | |||
for (let actor of actors) { | |||
const buff = actor.items.find(o => o.name === c.buffName && o.type === "buff"); | |||
if (buff != null) { | |||
let active = getProperty(buff.data, "data.active"); | |||
if (active == null) active = false; | |||
for (let tester in sizes) { | |||
if (actor.data.data.traits.size == sizes[tester]) { | |||
var currentSize = parseInt(tester); | |||
break; | |||
} | |||
} | |||
if (active == false) sizeToBe = currentSize + 1; | |||
else sizeToBe = currentSize - 1; | |||
transform(actor, sizes[sizeToBe]); | |||
buff.update({ "data.active": !active }); | |||
} | |||
} | |||
} | |||
</pre> | |||
:Muistakaa käyttää sizeRoll-funktiota (ks. alla) lähitaisteluaseissan niin muuttuu myös vaurionopat automaattisesti oikeiksi. | |||
<code>sizeRoll(1, 6, @size)</code> | |||
:ensimmäinen parametri määrittelee noppien määrän ja toinen nopan eli esimerkin tapauksessa 1d6. Jos koko muuttuu suuremmaksi niin noppa muuttuu automaattisesti 1d8:ksi jne. | |||
Nykyinen versio 14. tammikuuta 2021 kello 00.27
Tämän makron avulla voit käyttää Enlarge Person-loitsua, sitten että se huomioi kaikki koon muutoksesta tulevat vaikutukset.
- Luo ensin makron vaatima Buff ja nimeä se Enlarge Person.
- Lisää luomasi buffin Changes-välilehdelle loitsun aiheuttamat muutokset attribuutteihin.
- Hae Compendium packs valikosta kohdasta Sample macros esimerkki makro Toggle Buff ja raahaa se alas Macros Directoryn vapaaseen paikkaan.
- Tämän jälkeen kopioi alla oleva koodi ja korvaa sillä Toggle Buffin sisältö. Nimeä uusi makro esim. nimellä Enlarge Person.
// CONFIGURATION // If one or more tokens are selected, those will be used instead of the listed actors // Leave the actorNames array empty to guess the players // Example actorNames: `actorNames: ["Bob", "John"],` const c = { actorNames: [], buffName: "Enlarge Person" }; // END CONFIGURATION const transform = (caster, size) => { caster.update({'data.traits.size': size}); }; const sizes = ["fine", "dim", "tiny", "sm", "med", "lg", "huge", "grg", "col"]; var sizeToBe = 0 const tokens = canvas.tokens.controlled; let actors = tokens.map(o => o.actor); if (!actors.length && c.actorNames.length) actors = game.actors.entities.filter(o => c.actorNames.includes(o.name)); if (!actors.length) actors = game.actors.entities.filter(o => o.isPC); actors = actors.filter(o => o.hasPerm(game.user, "OWNER")); if (!actors.length) ui.notifications.warn("No applicable actor(s) found"); else { for (let actor of actors) { const buff = actor.items.find(o => o.name === c.buffName && o.type === "buff"); if (buff != null) { let active = getProperty(buff.data, "data.active"); if (active == null) active = false; for (let tester in sizes) { if (actor.data.data.traits.size == sizes[tester]) { var currentSize = parseInt(tester); break; } } if (active == false) sizeToBe = currentSize + 1; else sizeToBe = currentSize - 1; transform(actor, sizes[sizeToBe]); buff.update({ "data.active": !active }); } } }
- Muistakaa käyttää sizeRoll-funktiota (ks. alla) lähitaisteluaseissan niin muuttuu myös vaurionopat automaattisesti oikeiksi.
sizeRoll(1, 6, @size)
- ensimmäinen parametri määrittelee noppien määrän ja toinen nopan eli esimerkin tapauksessa 1d6. Jos koko muuttuu suuremmaksi niin noppa muuttuu automaattisesti 1d8:ksi jne.