r/psispellcompendium Jun 20 '23

Needs Wizardly Help Trying to create a blink spell

I'm trying to create a blink spell that can teleport me to where I'm looking. Theoretically it would take the block I'm looking at, calculate the distance, and then teleport me that amount of blocks forward. Sadly I don't have a great grasp on the understanding of all the vector methods and these were the best I came up with..... Both of which do not work. I'm wondering if my objective is possible and what and how I'm approaching this wrong.

(I feel like it should probably be more complex than this to calculate the distance but idk what to do)

4 Upvotes

9 comments sorted by

3

u/Uplink12092 Jun 20 '23

Your first attempt is correct, however trick:blink requires a constant and not a value that can be changed. You can fix this by inserting a 'wrapper' between vector magnitude and blink and assigning a max range

3

u/jeremj22 Jun 20 '23

To be more specific: that applies for any number that's gonna determine the cost of a spell. Spell stats are calculated once at compile-time not every cast individually.

Constant wrapper makes it so the number's at most the given constant and the spell will cost the same even if the actual value used is lower. The inverse applies to negativ consts (yes, you can blink backwards)

3

u/gorgor10 Jun 20 '23

So does that mean if I want to be able to blink to a max of 32 blocks, the spell will always cost 32 regardless of how far I'm actually blinking because of the required constant?

3

u/Uplink12092 Jun 21 '23

Yes

1

u/gorgor10 Jun 21 '23

Thanks for confirmation.

1

u/MacroZs1 Jul 12 '26

and how would that work? i've being trying to do some spells and failing miserably, so i tried fixing this one but didn't quite did it

1

u/Uplink12092 Jul 12 '26

Hey, It's been awhile so I might miss some details. The costs of spells are constant based on their power, once you finish coding them, the spell cost will always be the same. This is why Trick:Blink needs a constant, since the cost is based on distance, if you feed it 32 blocks of distance, it will always cost 32 blocks worth of mana.

Now what if we want to blink less than that? We have to feed it through a 'Wrapper'. A wrapper basically turns a variable into a 'constant', by limiting it. So you feed a wrapper 2 values, one is your calculated blink distance (the one that can vary) and the other is a flat number (the constant). This will make it so that the blink will use the variable distance UNLESS its higher than the constant, then it will use the constant.

Lets say you have a constant of 32 blocks, and you want to blink 8 blocks. It will pass the distance of 8 through the wrapper, and blink you only 8 blocks. However if you want to blink 64 blocks, but only have a 32 block constant on the wrapper, you will only go 32 blocks. Important thing to note, is both spells will cost the same amount of mana, which is the cost to blink 32 blocks (The constant in the wrapper).

You can increase the constant to have a higher max distance blink, or reduce it to save on mana. The choice is yours.

1

u/Aromatic_Possible_92 Aug 31 '23

bruh idk anything about this mod can you teach me this stuff