WatchNon-threaded

Forums » Advanced Editor Forum » Read Message

Talk about it. Ask for help on it. Compliment it.

Randomly lose an item?

one month ago

Looking for how to lose a random item on a certain page. I'm making it for a random event kind of thing. There is a small chance to be taken to a page. Once on the page, it says a thief has stolen an item of yours. I'm not sure how to lose a random carried item without knowing what items the user is carrying

Randomly lose an item?

one month ago
Since there's no arrays available here, this can get super complex really fast. It depends how you want to do this.

If there are a lot of items, this would quickly get insane. If there are a few items, you could just use a stack of IF statements to find out if a user has an item, then if they do, remove it. I can't think of a simple way to do this because there's no variable variables that really work here, either.

Maybe you flip through the list of items, and when you find one, then you randomly decide if that is the item that is lost? Say, a 10% chance each time an item is found and once you lose one item, you stop looking for more would work.

Randomly lose an item?

one month ago

That works, thanks!

Randomly lose an item?

one month ago
In order to truly be random you'd have to make a ton of if statements

I think it's important to note that the "randomness" doesn't necessarily have to be random. You can simply make a list of if statements checking what items the player has, and dropping the first one it finds.

Randomly lose an item?

one month ago
So do you have a lot of items not vital to the game? Because I'm not sure being unable to complete it over a random event is something anyone is going to enjoy.

Randomly lose an item?

one month ago

The game has a variety of items, so they're easily replaceable. At least, in this rough plan.