#Cancel a FTB Quest Custom reward event still consumes the reward

92 messages · Page 1 of 1 (latest)

thin raft
#

I want to run some logic first and if it fails cancel the reward but cancelling it still consumes the event.
What I'm doing is generating a map item with location to certain biomes, but if it fails to locate (player too far or in incompatible dimension) I want to cancel the event and let the player try again until it succeeds.
I also tried to workaround by completing the task if it fails so player can try again but there is some weird desync going on and needs to restart client to take effect.
Please help angerysad

white glacierBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

dark iron
thin raft
#

and did you manage to work?

dark iron
#

yes

#

let me show you

#

Item.of('quark:pathfinders_quill', "{display:{Name:'{\"text\":\"Desert\"}'},targetBiome:\"minecraft:desert\",targetBiomeColor:12963328}")

#

thats the kjs item

#

you just change the targetBiome to whatever you want

#

the command I used is something like /give @s quark:pathfinders_quill{targetBiome:"minecraft:desert"}

#

you can add the other tags like target biome color which changes the little bottle color

#

This doesn't really concern with KUBEJS, I just did it with giving myself those items and then importing the reward table from chest in FTB quests

thin raft
#

this quark tihng executes the logic when after you get the item and rightclick or something?

dark iron
#

yes

#

once in your inventory, you right click and it generates a map

#

you get a little indicator and animation at the bottom left that says Searching...

#

Then you get a map like this

thin raft
#

i already got a working logic but my problem is when you fail to locate

#

what happens if you go to Nether

#

and try to locate something like river

dark iron
#

let me try

#

so your problem is basically that your locate thing works but when it fails to locate you want it to reset the quest? is that correct?

thin raft
#

yes, currently it will consume the item and you get no "refund"

dark iron
#

when it fails it doesn't give you a map or the quill back

#

so you would have the same issue

#

but is your quest a one time thing?

thin raft
#

no, like a Shop

dark iron
#

yes that's exactly what I have

#

ok so now we have a mutual problem XD

thin raft
#

all the logic is working fine

#

BUT

#

this even.cancel() does nothing

#

event*

dark iron
#

le me see

#

What im thinking is that instead of trying to cancel you can reset the progress of the quest

thin raft
#

that wont give the person their items back

dark iron
#

may i look at le code

thin raft
#

ok

stray hemlockBOT
#

Paste version of test_quest.js from @thin raft

dark iron
#

maybe the quest event is specific to player?

#

is that an attr?

#

It's all that I could think of

#

And that's why the cancel event doesn't fire

#

also, is the quest reward cancellable???

#

like is the event cancellable

thin raft
#

ProbleJS said it is 😐

dark iron
#

hmmm

#

so far those are my two guesses

thin raft
#

can be a FTB Quest problem not checking if it is cancelled too

#

i'm starting to think that all FTB Quest events are not cancellable lol

dark iron
#

bruh

#

they might not be

#

but why is cancel relevant when you just want to give the player their stuff back? result == null works correctly right?

thin raft
#

if cancel worked I wouldn't need to give their stuff back

#

now I need to find a way to programatically give their stuff back

#

like getting the itemstacks of the quest

#

🤦‍♂️

dark iron
#

but like

#

isn't it a shop? shouldn't it be 1 currency or whatever

thin raft
#
    function refund(serverPlayer, quest){
        let tasks = quest.tasks
        let itemStack
        tasks.forEach(task =>{
            if (task.consumesResources() && task.getType() == $TaskTypes.ITEM){
                itemStack = task.item.copy()
                itemStack.setCount(task.count)
                serverPlayer.sendMessage(Component.green("Refunding " + itemStack), $Util.NIL_UUID)
                $ItemStackHooks.giveItem(serverPlayer, itemStack)
            }
        })
    }
dark iron
#

EPIC

thin raft
#

is your modpack public or something? xD

dark iron
#

uh not rn

#

i hope to finish it by the end of this year

#

its ambitious

thin raft
#

what MC version?

dark iron
#

1.19.2

thin raft
#

🙂

dark iron
#

🙂

#

im trying to make a mix between MC eternal and sevtech (not as hardcore as sevtech)

#

and in mind is in-world interaction, so not lots of menus and more interacting with the world, like structures, mob hunting, biome hunting for specific resources, etc.

#

and it's sorta expert, I have epic siege mod to make mobs more difficult and recipes aren't ridiculous but definetely more challenging and encourage you to go out and about

thin raft
#

very nice 👏

dark iron
#

What's yours about?

thin raft
#

i'm just a contributor on All The Mods Gravitas

dark iron
#

ooo

#

I was playing tfc reloaded last week with some friends and then had to double down on uni

#

and so i finished yesterday so I started working on the pack again

#

But I got work this week and i gotta catch up with all the stuff I haven't done since last week

thin raft
#

TFC is going to 1.20 so I am excited for that x)

dark iron
#

yeah

#

I think TFC will stay forever

#

I wish pyrotech would update but the guy is stubborn

#

I was thinking of making a mod that's similar to Lychee but with mechanics and blocks

#

and then have them included in the game via config

#

So for example the pyrotech bloomery and smelting process is so unique, I Would so something similar to that.
Or maybe sifting but add an actual gui or minigame

#

I'm a fan of minigames for crafting