ID:146224
 
Code:


Problem description:

ive got some problem with this:
Bump(mob/M)
if(M.player == 1)
Fight(M)
and i got this error
runtime error: undefined variable /turf/icewall5/var/player
proc name: Bump (/mob/Hobgoblin/Bump)
source file: TheDemo.dm,233
usr: Hobgoblin (/mob/Hobgoblin)
src: Hobgoblin (/mob/Hobgoblin)
call stack:
Hobgoblin (/mob/Hobgoblin): Bump(the icewall (11,62,1) (/turf/icewall5))
Hobgoblin (/mob/Hobgoblin): Wander(the gonzalo (/mob/You/Warrior))
how can i fix it?
just going on what i see it may be how u displayed the bump here are the ways i have the bumps in my game lemme show u:


Code:
mob
Bump(atom/O,mob/M in world)
if(istype(O,/obj/Door))
O:tryit(usr)
if(istype(O,/obj/Door2))
O:tryit(usr)
if(istype(O,/obj/Door3))
O:tryit(usr)
if(istype(O,/obj/Door4))
O:tryit(usr)
if(istype(O,/obj/Door5))
O:tryit(usr)
if(istype(O,/obj/Sign))
usr << "<center>[O:msg]"
usr << "<center>~[O:owner]~"



hope it helps!
In response to Robertg0123
Code:
mob
Bump(atom/O,mob/M in world)
if(istype(O,/obj/Door))
O:tryit(M)
if(istype(O,/obj/Door2))
O:tryit(M)
if(istype(O,/obj/Door3))
O:tryit(M)
if(istype(O,/obj/Door4))
O:tryit(M)
if(istype(O,/obj/Door5))
O:tryit(M)
if(istype(O,/obj/Sign))
M << "<center>[O:msg]"
M << "<center>~[O:owner]~"


------------------------------------------------------------
1. To Robert, no put usr <font color=blue>in</font> <font color=blue>proc</font>.
2. <font color=blue>If</font> indeed there <font color=blue>is</font> a mob type called mob/M, then by all means keep that <font color=blue>in</font> the <font color=blue>proc</font> parenthesis, otherwise just make it mob or replace usr with M. I have now fixed said problem above.
------------------------------------------------------------
1. To the owner of the post. For the Gods' sakes, it doesn't take a fool to figure out that the code goes <font color=blue>in</font> the tags under:
"Code:"
2. It would be nice to see the code relevant to the runtime error.

<font size=4>Thirdly and most importantly</font>:
From what I see of the runtime error, it seems you need to make 2 different bumpfight <font color=blue>proc</font>s(one <font color=blue>for</font> enemy and one for player), and make the enemy type mob/enemies/enemyname or something to that manner.

<font color=blue>If</font> you took my advice, it should look like this or something relevant.
mob/You
Bump(mob/Enemies/M) // Declares a new variable.
if (istype(M,/mob/Enemies)) // Checking to see if the thing the person is bumping is an enemy.
Fight(M) // Initiate attacking proc.
else
sleep(8) // Delay for if it isn't an enemy.
mob/Enemies
Bump(mob/You/M) // This is basically the reverse of above proc.
if (istype(M,/mob/You))
Fight(M)
else
sleep(8)

------------------------------------------------------------
Also,
<font color=red face=system>runtime error: undefined variable /turf/icewall5/var/player</font>
It should be <font color=blue>var</font>/turf/icewall5/player

Here's a fix:
mob
Bump(o)
if(istype(o,/player))
var/player/p=o
if(!o.client)return
procname(o)


Try that.