Superglass Make

Various development-related discussions
Post Reply
User avatar
bushtail
Tech Support
Posts: 40
Joined: Thu Aug 11, 2022 11:43 pm
Location: Snow Mexico
Been thanked: 4 times
Contact:

Superglass Make

Post by bushtail »

So I know the issue I'm facing - there's no cool-down so a player can keep spamming the spell, removing their runes but adding experience. I know I somehow have to make sure that the game knows two things before it even does anything:

1. Ensure the player has enough valid materials in their inventory
2. Ensure the player has enough runes

However both of these checks must happen either at the same time or both have to return true in order for the spell to do anything.

The way I'm thinking of doing it is by having a count variable that keeps track of whether or not everything's taken care of, and putting it in the for(item in inv) block. Something like IF count of valid removes EQUALS size (the result of determining which is the lower of the two variables, one for sand and one for the amount of weed in the player's inventory), removeRunes and add XP.

The result of this I'm not sure the impact of - an edge case where it takes all the items without removing any runes or adding any xp (or heaven forbid it takes the runes too), so I'm hoping on some insight as to whether or not there's a "smarter" way of doing things efficiency-wise.
Image
Resident chad Winblows user
User avatar
Ceikry
Site Admin
Posts: 577
Joined: Wed Aug 10, 2022 11:48 pm
Location: Draynor Village
Has thanked: 81 times
Been thanked: 93 times

Re: Superglass Make

Post by Ceikry »

bushtail wrote: Sun Aug 28, 2022 12:21 am So I know the issue I'm facing - there's no cool-down so a player can keep spamming the spell, removing their runes but adding experience. I know I somehow have to make sure that the game knows two things before it even does anything:

1. Ensure the player has enough valid materials in their inventory
2. Ensure the player has enough runes

However both of these checks must happen either at the same time or both have to return true in order for the spell to do anything.

The way I'm thinking of doing it is by having a count variable that keeps track of whether or not everything's taken care of, and putting it in the for(item in inv) block. Something like IF count of valid removes EQUALS size (the result of determining which is the lower of the two variables, one for sand and one for the amount of weed in the player's inventory), removeRunes and add XP.

The result of this I'm not sure the impact of - an edge case where it takes all the items without removing any runes or adding any xp (or heaven forbid it takes the runes too), so I'm hoping on some insight as to whether or not there's a "smarter" way of doing things efficiency-wise.
you could post your code
Nerds
User avatar
ryannathans
Staff
Posts: 486
Joined: Thu Aug 11, 2022 12:25 am
Location: ɐᴉlɐɹʇsn∀
Has thanked: 37 times
Been thanked: 94 times

Re: Superglass Make

Post by ryannathans »

User avatar
bushtail
Tech Support
Posts: 40
Joined: Thu Aug 11, 2022 11:43 pm
Location: Snow Mexico
Been thanked: 4 times
Contact:

Re: Superglass Make

Post by bushtail »

thank you ryan
Image
Resident chad Winblows user
Post Reply