ID:262613
 
Code:
mob/var/fg = 0
mob/proc/fghap()
spawn(180)
usr.fg = 0

atom/var/g = 0
area/
goldrespawn
luminosity = 0
g = 35
Entered(mob/M)
..()
if(M.fg == 0)
usr << "You Find Some Gold!"
var/a = new/obj/items/gold(M.loc)
a:g = src.g
M.fg = 1
M.fghap()
goldrespawn
luminosity = 0
g = 65
Entered(mob/M)
..()
if(M.fg == 0)
usr << "You Find Some Gold!"
var/a = new/obj/items/gold(M.loc)
a:g = src.g
M.fg = 1
M.fghap()
sprespawn
luminosity = 0
Entered(mob/M)
..()
if(M.fg == 0)
M << "You Find A Strange Potion!"
new/obj/items/strange_potion(M.loc)
M.fg = 1
M.fghap()


Problem description:
this is to give a player treasure when they step on a certain square, but it doesnt work, it doesnt say anything or give anything
plz help

can anyone help?
First, you should remove the usr. if you are already use the variable M. And you can use if(!M.fg) instead of if(M.fg==0). I would also like to know as to you have two areas with same path. But, in the Entered proc, remove the "..()".
In response to Kija
..() is the "Parent" proc, removing that in some cases may disrupt the actual desired effect. And as far as I know it's safe to use it in all procs. :/
The call to the parent proc should only be neccesary in the enter proc since that is when the actual movement takes place. By having it, it should not cause any problems, but nor is it actually doing anything unless he has a parent Entered proc, which from what he is trying to do, he probably does not.
In response to Kija
What you just said was one crock of poo. Like I believe you said "I like being safe", maybe he wants to be safe too?
stil dont work
updated code:
mob/var/fg = 0
mob/proc/fghap()
spawn(180)
usr.fg = 0

atom/var/g = 0
area/
goldrespawn
luminosity = 0
g = 35
Entered(mob/M)
if(M.fg == 0)
usr << "You find some gold!"
var/a = new/obj/items/gold(M.loc)
a:g = src.g
M.fg = 1
M.fghap()
goldrespawn2
luminosity = 0
g = 65
Entered(mob/M)
if(M.fg == 0)
usr << "You find some gold!"
var/a = new/obj/items/gold(M.loc)
a:g = src.g
M.fg = 1
M.fghap()
sprespawn
luminosity = 0
Entered(mob/M)
if(M.fg == 0)
M << "You find a strange potion!"
new/obj/items/strange_potion(M.loc)
M.fg = 1
M.fghap()
Alright, maybe it does then. But, when I do see it, it is usually at the very end, like "return ..()" though so the begining checks can be done first.
In response to Rky_nick
I surely hoped you placed the points on the map.
I do not see anything wrong with it, so that is the only cause that I could see. Since it should work.
In response to Kija
well it doesnt. and yes i did place spots around the map to test
In response to Rky_nick
Have you possibly set fg=1 somewhere by accident?
In response to Kija
o...m...g...


I dont know whether to yell or to relax.
Somehow my testing characters fg got to 1. i tried a diff one and it worked. I needa fix that bug.
In response to Rky_nick
Well, that is good to hear. Good luck in the future for your game; I hope it works out.
In response to Kija
ty
In response to Rky_nick
If you want to see it, im hosting it.(its dungeon crawl)
In response to Rky_nick
When you want to determine TRUE if(var==1) or FALSE if(var==0), and there isn't like...">=1", use a more robust form by using "if(!var)" (FALSE) and "if(var)" (TRUE).

As your abuse using the ":" colon operator, you can just fix it up by doing something like this
var/obj/gold/a = new/obj/gold
a.amt=10