ID:272742
 
Code:
        grass
icon = 'grass.dmi'
icon_state = "g"
density = 0
Entered(atom/movable/M)
if(!istype(M,/mob/))
if(prob(25))//25% chance
usr << "You run into a pokemon!"
//Pokemon stuff here.

well im making a pokemon game , but i want it like if u run on tehh grass then random pokemon appears but i dont rly have a clue how to code that >.> i would appreciate teh help thanks .
Problem description:

turf
grass
icon = 'grass.dmi'
icon_state = "g"
density = 0
Entered(mob/M)
if(istype(M,/mob/))
if(prob(25))
usr << "You run into a pokemon!"
//Pokemon stuff here.
Argh, no usr in procs! Especially in movement-related procedures!! Change that usr to M!!!

The bad new is... you have to make a battle/catching/etc system and activate it. I suggest using datums and start planning what you need and what will happen (ex: location to another map while storing the old loc somewhere else, how to send a pokemon out, how to select a move, etc).

For example
Battle
New(mob/Trainer/M)
if(!istype(M)) CRASH("Something is wrong with M (type: [M.type])!")

world << "[M.name] started a battle to the death... with himself!"
M.Suicide()
del src

turf/Arena_of_Doom
Entered(mob/M)
if(istype(M, /mob/Trainer))
new/Battle(M)


The above is an example of a datum; this will not be easy though, unless you do something like an alert asking if you want to catch a pokemon without any battle.
In response to GhostAnime
You forgot to actually create the datum on the Entered().
In response to Andre-g1
Ah, you're correct, I forgot the new/ >_> Edited ._.
In response to GhostAnime
i was trying to do something like, if u run on teh turf a pokemon will appear and just walk around so u can catch him . ;/
Check the DM Reference for new(). If you don't know where to find it, there's one up there under developer. Or, you can find another version by pressing F1 while in Dream Maker.
In response to Gizhy
Except that usr should never be used in movement procs.