#Midi stuff

1 messages · Page 1 of 1 (latest)

near bane
#

Midi stuff

#

@hollow zodiac @teal scaffold

paper moon
#
async function wait(ms) {return new Promise(resolve => {setTimeout(resolve, ms);});}
if(args[0].hitTargets.length === 0) return {};
let tokenD = canvas.tokens.get(args[0].tokenId);
let actorD = tokenD.actor;
let target  = canvas.tokens.get(args[0].hitTargets[0].id);
let itemD = args[0].item;
let gameRound = game.combat ? game.combat.round : 0;

const diceMult = args[0].isCritical ? 2: 1;
const numDice = 3 * diceMult;
let damageRoll = await new Roll(‘${numDice}d6’).evaluate();
await new MidiQOL.DamageOnlyWorkflow(actorD, tokenD, damageRoll.total, "necrotic", [target], damageRoll, {flavor: "Necrotic Bite - Damage Roll (Necrotic)", damageList: args[0].damageList, itemCardId: args[0].itemCardId });
await MidiQOL.applyTokenDamage([{damage: damageRoll.total, type: "healing"}], damageRoll.total, new Set([tokenD]), itemD.name, new Set());
const effectData = {
 label : "Drain",
 icon : "icons/skills/wounds/blood-drip-droplet-red.webp",
 origin: args[0].uuid,
 changes: [{
   "key": "data.attributes.hp.max",        
   "value": `-${damageRoll.total}`,
   "mode": 2,
  "priority": 20
   }],
  disabled: false,
  duration: {seconds: 86400,startRound: gameRound, startTime: game.time.worldTime},
}
await MidiQOL.socket().executeAsGM("createEffects", {actorUuid: target.actor.uuid, effects: [effectData]});
let hpNow = target.actor.data.data.attributes.hp.max;
let updateHP = hpNow - damageRoll.total;
let the_message = `<p>${tokenD.name} drains ${target.name} of ${damageRoll.total} pts from their maximum Hit Point value!</p><p>${target.name} now has Maximum Hit Point maximum of ${updateHP}.</p><br><p><b>If it reaches O, they die!!</b></p><br><p> ${tokenD.name} regains ${damageRoll.total} Hit Points back!</p>`;
await wait(600);
ChatMessage.create({
      user: game.user._id,
      speaker: ChatMessage.getSpeaker({actorD: actorD}),
      content: the_message,
      type: CONST.CHAT_MESSAGE_TYPES.EMOTE
    });
teal scaffold
#

Needs ` not ‘ where you changed the formula

paper moon
#

in the "let actorD = tokenD.actor;" part right?

hollow zodiac
#

Could probably shorten up a lot of this

teal scaffold
#
let damageRoll = await new Roll(`${numDice}d6`).evaluate()
hollow zodiac
#

I made a vampire kit a couple of months ago

teal scaffold
#

2 minutes to type this on the iPad… arghhhh

hollow zodiac
#

Should use dns5e roll instead

#

Can set critical true/false

#

I'm on cellphone heh

teal scaffold
#

Hahaha

paper moon
#

there's no longer an error but idk if its working

#

the vampire isnt getting healed and the max hp isnt getting lowered

teal scaffold
paper moon
#

same issue

teal scaffold
#

How do you execute the macro? Midi onUse ?

paper moon
#

yes

teal scaffold
#

Yeah I cannot see anything else right now as it is difficult to go through it on the tablet. Paste it once more and if nothing else pops in mind, ping me Friday when I am back on my pc

paper moon
#

aight

#
async function wait(ms) {return new Promise(resolve => {setTimeout(resolve, ms);});}
if(args[0].hitTargets.length === 0) return {};
let tokenD = canvas.tokens.get(args[0].tokenId);
let actorD = tokenD.actor;
let target  = canvas.tokens.get(args[0].hitTargets[0].id);
let itemD = args[0].item;
let gameRound = game.combat ? game.combat.round : 0;

const diceMult = args[0].isCritical ? 2: 1;
const numDice = 3 * diceMult;
let damageRoll = await new Roll(`${numDice}d6`).evaluate()
await new MidiQOL.DamageOnlyWorkflow(actorD, tokenD, damageRoll.total, "necrotic", [target], damageRoll, {flavor: "Necrotic Bite - Damage Roll (Necrotic)", damageList: args[0].damageList, itemCardId: args[0].itemCardId });
await MidiQOL.applyTokenDamage([{damage: damageRoll.total, type: "healing"}], damageRoll.total, new Set([tokenD]), itemD.name, new Set());
const effectData = {
 label : "Drain",
 icon : "icons/skills/wounds/blood-drip-droplet-red.webp",
 origin: args[0].uuid,
 changes: [{
   "key": "data.attributes.hp.max",        
   "value": `-${damageRoll.total}`,
   "mode": 2,
  "priority": 20
   }],
  disabled: false,
  duration: {seconds: 86400,startRound: gameRound, startTime: game.time.worldTime},
}
await MidiQOL.socket().executeAsGM("createEffects", {actorUuid: target.actor.uuid, effects: [effectData]});
let hpNow = target.actor.data.data.attributes.hp.max;
let updateHP = hpNow - damageRoll.total;
let the_message = `<p>${tokenD.name} drains ${target.name} of ${damageRoll.total} pts from their maximum Hit Point value!</p><p>${target.name} now has Maximum Hit Point maximum of ${updateHP}.</p><br><p><b>If it reaches O, they die!!</b></p><br><p> ${tokenD.name} regains ${damageRoll.total} Hit Points back!</p>`;
await wait(600);
ChatMessage.create({
      user: game.user.id,
      speaker: ChatMessage.getSpeaker({actorD: actorD}),
      content: the_message,
      type: CONST.CHAT_MESSAGE_TYPES.EMOTE
    });
teal scaffold
#

In the applyTokenDamage use just itemD instead of itemD.name

hollow zodiac
#

patreon version

teal scaffold
#

Nice!

#

Need to start playing with chat cards styling a bit more but I get bored 😐