ID:175106
 
I have a random battle proc. However, when you step on the grass(BattleGrass1), you don't get moved to the bgrounds. Yes, I have bgrounds on my map.
P.S. I have the "E" var set to 1 so it will make me transfer. Just for testing.
P.S2. I will change usr to something like M later. Unless this is the problem.
turf
BattleGrass1
icon = 'turfs.dmi'
icon_state = "grass"
density = 0
Enter(atom/movable/A)
if(!usr.Bnum)
var
E = 1
if(E == 1)
A.battle1()
return 1
Bgrounds
icon = 'turfs.dmi'
icon_state = "blackness"


atom/proc
battle1(mob/Enemy)
var/turf/Map
var/usrloc = usr.loc
if(usr.inbattle == 0)
for(var/turf/bgrounds in world)
var/Taken=0
for(var/atom/A in bgrounds)
if(A.density==1)Taken=1
if(!Taken)
Map=bgrounds
if(Taken == 1)
Map=usrloc
usr.XLoc=usr.x
usr.YLoc=usr.y
usr.ZLoc=usr.z
usr.battle = 1
usr.Move(Map)

Theres more code below it, but thats battle stuff. This code dosn't work. Anyone know why?


Airjoe
You're using Enter() wrong. Enter() is used to see if the atom that entered the turf is ABLE to enter it...Entered() is AFTER that atom has been allowed access.
And, also...DON'T use "usr" in procs...use src, or define an argument.
In response to Goku72
Ok. Changed enter to entered and usr to src. now what? still dosn't work.
In response to Airjoe
You should have changed usr to A, not src.
In response to Crispy
in entered I did. I mean in the battle proc.
In response to Goku72
Goku72 wrote:
Enter() is used to see if the atom that entered the turf is ABLE to enter it...

Actually, the Enter() procedure is called when an atom TRIES to enter another. =P

~>Volte
In response to Goku72
Goku72 wrote:
And, also...DON'T use "usr" in procs...use src, or define an argument.

Why?
In response to Nave
In response to Nave
It's hard to explain, and even I don't know why, but usr is evil and not ver useful! Use src as much as you can!
In response to Volte
Sorry, I mis-typed it =P
In response to Dragon of Ice
Didn't you notice my link? Read it. =)