mob
proc
ItemChance(mob/player/P,mob/monsters/M)
var/chance1 = rand(1.10)
var/chance2 = rand(20,20)
var/continues = 1
if(chance2 == 20)
if(istype(M.drop2,/obj/keys/))
if(!(M.drop2 in P.keys))
AddInfo(P,"An item drops from the monster...","It is a [M.drop2]!")
new M.drop2 (P.keys)
continues = 0
else
AddInfo(P,"An item drops from the monster...","It is a [M.drop2]!")
new M.drop2 (P)
continues = 0
else if(chance1 == 5 && continues == 1)
AddInfo(P,"An item drops from the monster...","It is a [M.drop1]!")
new M.drop1 (P)
Problem description:
The problem I'm encountering is that even though an item that is in the /obj/keys tree, it does not go into the first group of item drops. It always goes into the 2nd for the key. (Its 20,20 rand for testing to get it to work, so I dont have a small chance of testing it) It's like the item is not a /obj/keys, but drop 2 for the monster is this:
drop2 = /obj/keys/basickey
I don't understand why it doesn't work. Any help would be great.
Note the decimal, it's suppose to be a comma.
Another simpler way (instead of making variables and checking if it ==20) would be to use
if(prob(5))
For your actual problem, try seeing what M.drops2 actually is:
Of course it would been useful to see a monster's drop2 variable here..