Lets Go Fishing

Merrie
05 Mar 2007, 01:54
Could someone give me an example of how the following could be done.

You have a pond.
The player can equip a fishing pole.
They can cast the line into the pond.
They can get a random fish or come up empty on a percent.
Lets say they have a 40% chance to catch a fish per cast.

Please note I use QDK

Thank you!

witch wyzwurd
06 Mar 2007, 12:39
Hi Merrie. I can help.

1. Make a room.
2. Make an object called "Trout".
2a. Make the object "Trout" inaccessible.
3. Write a description of the pond.
4. Write a player command like "equip pole" or "put bait on pole."
5a. If player has "bait" then set flag "bait1" on and msg "bait attached to hook now"
5b. If player doesn't have bait then msg "No bait to use."
6. Write a player command like "cast line" or equivalent.
6a. If no flag "bait1" then msg "You cast line then sit there for a long time and no fishes bite. It might have something to do with the fact that there's no bait on the hook."
6b. If flag "bait1" on then run "Fish_Percent" procedure.
7. Create a Procedure named "Fish_Percent".
7a. Set a numeric variable
7a1. Name the variable "Fish_Variable".
7a2. Set parameter to $rand(1; 10)$
7b. If "%Fish_Variable%" is greater than or equal to 1 and "%Fish_Variable%" is less than or equal to 4 then
7b1. msg "You caught a fish!"
7b2. Make object "Trout" accessible.
7b2. Give object "Trout" to player.
7c. If "%Fish_Variable%" is greater than or equal to 5 and "%Fish_Variable%" is less than or equal to 10 then
7c1. Print msg "No bites. Darn! Try casting again."

To go further, you'll need to know if the player can catch more fishes... are they all trout... etc...