EDIT:How would i make it different chances to get different items?For example 60% to get Fruit 30% to get Mint Leaf and 10% to get Nothing?
mob
Bump(atom/movable/A)
if(isobj(A))
var/obj/O=A
spawn()
O.Bumped(src)
obj
proc
Bumped(atom/movable/A)
Ruins
Tower1
name = "Ruins"
icon ='Ruins.dmi'
icon_state = "Tower1"
density = 1
var/list/Treasure = list(/obj/Items/Food/Mint_Leaf,/obj/Items/Food/Fruit)
Bumped(atom/movable/A)
if(ismob(A))
usr << "You search the tower"
sleep(10)
if(!Treasure.len)
usr << "There is No Items in Tower"
else
var/Z=pick(Treasure)
if(Z == /obj/Items/Food/Mint_Leaf)
usr << "You find Mint Leaf"
new Z(usr)
Treasure -= Z
if(Z == /obj/Items/Food/Fruit)
usr << "You find Fruit"
new Z(usr)
Treasure -= Z
See also:
pick proc
rand proc
rand_seed proc
roll proc
Format:
prob(P)
Returns:
1 with probability P percent; otherwise 0
Args:
P: A number.