#TW reload discussion

1 messages · Page 1 of 1 (latest)

ruby fiber
#

Where I am running into issues is trying to impact the PPE pool of the wielder, and that TW items take different ppe costs to reload.

glossy bronze
#

You want to automate PPE deduction?

ruby fiber
#

I have a dragon juicer who has a TW sub machine gun. His item takes 3 ppe to reload the 40 shots of the gun. Its not one to one. I am not sure the system could do this with out a script. Maybe a reload macro?

glossy bronze
#

And just manually deducting the 3 PPE is too difficult?

ruby fiber
#

I dont think it is but it doesn't line up with the rest of the range weapons reload setup. I think it's more of an expectation.

glossy bronze
#

Fair.

#

So is there two issues? One is reload should be a single item that adds back 40 shots

#

And two, that action should cost 3 PPE?

ruby fiber
#

That is the basics, some TW items cost less and a couple cost more so any kind of solution would need to be adjustable. I think Ill reach out to see if I can get some help in Macro Polo.

glossy bronze
#

Yeah let me know what you find out

glossy bronze
#

it's a little too hard coded at the moment but it works

ruby fiber
#

Holy... you are awesome! is that a Macro?

glossy bronze
ruby fiber
#

I didnt even get a chance to ask 😉

#

for help I mean.

glossy bronze
#

the biggest one being the powerpoints type

#
//
// Updated and expanded from Recharge Item Macro by Stendarpaval Foundry v0.7.9
// 
//

// Configure target actor and item.
const actorPC = game.actors.getName("Burster");
const targetItem = actorPC.items.getName("TK Submachine Gun");
const rechargeCost = 3
const arcane = "Psionics"
const ppName = "ISP"

// Get Other Needed Variables
const itemCurrent = targetItem.system.currentShots;
const itemMax = targetItem.system.shots;
const ppType = actorPC.system.powerPoints.Psionics.value
const reducePP = ppType - rechargeCost

//
//
//

if (itemCurrent == itemMax) {
    ui.notifications.warn("Your " + targetItem.name + " already has all of its " + itemMax + " charges!");
    return;
};

new Dialog({
    title: "Recharge Item",
    content: '<form id="recharge-item" class="dialog-content"><p>Your ' + targetItem.name + ' currently has ' + itemCurrent + ' out of ' + itemMax + ' charges.</p><p>Do you want to recharge it?</p></form>',
    buttons: {
        one: {
            label: "Recharge",
            callback: () => {
                let update = {"_id": targetItem._id, "system.currentShots": itemMax};
                let updatePP = { "_id": actorPC._id, [`system.powerPoints.${arcane}.value`]: reducePP };
                targetItem.update(update);
                actorPC.update(updatePP)
                sendChatMessage(actorPC.name + " has recharged " + targetItem.name + " and spent " + rechargeCost + " " + ppName);
            }
        },
        two: {
            label: "Cancel",
        }
    }
}).render(true);

function sendChatMessage(text) {
    let chatData = {
        // user:  game.user.id,
        // speaker: game.user,
        content:  text,
        //whisper: game.users.entities.filter(u => u.isGM).map(u => u._id)
        };
    ChatMessage.create(chatData,{});
}
#

you need to change the variables under // Configure target actor and item.

ruby fiber
#

kick ass John! this will totally work. In my game its a pretty single use case but I can set this up for anyone who is using a TW range weapon.

#

Thank you very much!

#

one other thing, where do I change labels for PP to PPE and ISP in the system? everything still comes out as PP.

glossy bronze
ruby fiber
#

ah, I see it is just a label change in the macro, not within the character sheets. I am gtg.

glossy bronze
ruby fiber
#

Also need to change "const ppType = actorPC.system.powerPoints.Psionics.value" to .Magic.value if PPE is involved.

#

You can also put macro links in the note section of an Item. very cool

glossy bronze
glossy bronze
#

but have to work out the kinks

glossy bronze
#

this should work

//
// Updated and expanded by Venatus Vinco for Rifts for Savage Worlds on Foundry v10x
// from Recharge Item Macro by Stendarpaval Foundry v0.7.9
//

// Configure target actor and item. Edit these as needed.
const actorPC = game.actors.getName("Burster");
const targetItem = actorPC.items.getName("TK Submachine Gun");
const rechargeCost = 3;
const arcane = "Psionics";
const ppName = "ISP";

// Get Other Needed Variables. Do not edit.
const itemCurrent = targetItem.system.currentShots;
const itemMax = targetItem.system.shots;
const ppType = actorPC.system.powerPoints[arcane].value;
const reducePP = ppType - rechargeCost;

//
//
//

if (itemCurrent == itemMax) {
    ui.notifications.warn("Your " + targetItem.name + " already has all of its " + itemMax + " charges!");
    return;
};

new Dialog({
    title: "Recharge Item",
    content: '<form id="recharge-item" class="dialog-content"><p>Your ' + targetItem.name + ' currently has ' + itemCurrent + ' out of ' + itemMax + ' charges.</p><p>Do you want to recharge it?</p></form>',
    buttons: {
        one: {
            label: "Recharge",
            callback: () => {
                let update = {"_id": targetItem._id, "system.currentShots": itemMax};
                let updatePP = { "_id": actorPC._id, [`system.powerPoints.${arcane}.value`]: reducePP };
                targetItem.update(update);
                actorPC.update(updatePP)
                sendChatMessage(actorPC.name + " has recharged " + targetItem.name + " and spent " + rechargeCost + " " + ppName);
            }
        },
        two: {
            label: "Cancel",
        }
    }
}).render(true);

function sendChatMessage(text) {
    let chatData = {
        // user:  game.user.id,
        // speaker: game.user,
        content:  text,
        //whisper: game.users.entities.filter(u => u.isGM).map(u => u._id)
        };
    ChatMessage.create(chatData,{});
}
glossy bronze
#

Nothing major here but tweaked some of the notifications and stuff for cleaner language. Same functionality.