Author Topic: Misc TF Techniques  (Read 3175 times)

Zakyrus

  • Entity
  • Magical Dreamer (+1250)
  • *
  • Posts: 1363
  • "Bouncy, bouncy, bouncy... --!!"
    • View Profile
Misc TF Techniques
« on: April 10, 2007, 09:44:36 pm »
Here's some TF techniques for coding some "intermediate" level events.

How to make a random treasure chest:
First you must make a chest like the one in "Castle Magus: Hall of Deceit", the chest here uses event code to make a treasure chest instead of using defualt game style.

Then just add a random number generator, certain values would give you multiple random items.

Here is an example:

Random Number
If RandomNumber < 75 (item drop chance)
Random Number (new random number from item type)
If RandomNumber < 30
~Give items 5 Tonics
~Goto 1000
If RandomNumber < 70
~Give item Mid Tonic
~Goto 1000
If RandomNumber < 90 (rarer items have smaller chances)
~Give item Full Tonic
~Goto 1000
If RandomNumber < D0
~Give item Elixir
~Goto 1000
If RandomNumber < FF
~Give item Mega-Elixir
~Goto 1000

[1000] ...
(here's where you could end the script or add another random item possibility.

To make an enemy "drop" a random item after battle:
One of my visions was to see CT be able to drop random items after battle, this is the easist way to pull this off without hacking the machinics of the game. Simply make a Object Function that has a random item list like the above treasure chest example. After battle, call this function. Simple.


How to make an item such as an herb randomly "grow" when you enter an area:
First create the desired item with an item editor.

Code:
Hide Sprite
Random number
if random number > X
Draw Sprite ( sapling )

use another random number generator to choose the sprites position if you want (example)
if random number > X; setObjCoords (10,F)
if random number < X; setObjCoords (1A,23)
 
when you activate the object, it display a textbox that tells you "you got ..."
give the item to the player
remove the object

I use this code for finding random gems that appear in cave walls too.