ID:150294
 
Ok I got the you bumped into (obsticle) working
from Your 1st World code. Now I'm trying to get it when a player bumps into a MOB on the map, it changes the var. of one of their stats. This is to be a visual seletion for building a character, instead of the common scroll down menu.

Bump(atom/obstacle)
usr << "You bump into [obstacle]."
obstacle.Block() //do obstacle's special actions, if any
if(obstacle == "hoc_ra")
usr << "You have choosen the sun god, Ra as your religion."
religion = "Ra"

This is the part of my code I'm unsure of. Also hoc_ra
has been declared as /mob with a opec&density of 1.
I'd like to set the stat when the mob is bump'ed!

LJR
LordJR wrote:
Ok I got the you bumped into (obsticle) working
from Your 1st World code. Now I'm trying to get it when a player bumps into a MOB on the map, it changes the var. of one of their stats. This is to be a visual seletion for building a character, instead of the common scroll down menu.

Bump(atom/obstacle)
usr << "You bump into [obstacle]."
obstacle.Block() //do obstacle's special actions, if any
if(obstacle == "hoc_ra")
usr << "You have choosen the sun god, Ra as your religion."
religion = "Ra"

This is the part of my code I'm unsure of. Also hoc_ra
has been declared as /mob with a opec&density of 1.
I'd like to set the stat when the mob is bump'ed!

LJR


Where you have religion = ra put, usr.religion = ra
That should work
I would use somthing like this:

mob/Bump(atom/A)
A:Block()
if(istype(A,/mob/Ra_Person))
Convert_To_Ra()
In response to Lord of Water
Lord of Water wrote:
I would use somthing like this:

mob/Bump(atom/A)
A:Block()
if(istype(A,/mob/Ra_Person))
Convert_To_Ra()

Why not just have A's Block() do the conversion?

Alathon
In response to Alathon
That's an even better way!
In response to Richter
hmm tried everything recommended here, still nothing. Also when I bump into the mob it seems its not even seeing the and hitting the a dense=1 default turf instead.

Could someone pesudo code how to get a simple bump this mob to set a stat change?

LJR
In response to Richter
Ah!!!!! I finally got it to compile right. But nothing is happening!!

mob
var/mob/A
Bump(atom/A)
A.Block()
if(istype(A,/turf/hoc_ra))

For some reason its not picking up the /turf/hoc_ra condition when its bumped.
In response to Alathon

mob/Bump(atom/A)
A:Block()
if(istype(A,/mob/Ra_Person))
Convert_To_Ra()

Why not just have A's Block() do the conversion?

Ok I'm giving this a go again, and this is what I'm left with when I compile.

error:A:bad var
error:hoc_ra:bad var
LordJR wrote:
Ok I got the you bumped into (obsticle) working
from Your 1st World code. Now I'm trying to get it when a player bumps into a MOB on the map, it changes the var. of one of their stats. This is to be a visual seletion for building a character, instead of the common scroll down menu.

Bump(atom/obstacle)
usr << "You bump into [obstacle]."
obstacle.Block() //do obstacle's special actions, if any
if(obstacle == "hoc_ra")
usr << "You have choosen the sun god, Ra as your religion."
religion = "Ra"

This is the part of my code I'm unsure of. Also hoc_ra
has been declared as /mob with a opec&density of 1.
I'd like to set the stat when the mob is bump'ed!

LJR

The error is in your if statement. Obstacle would have to be the text string "hoc_ra". You need to test for the object's type.
if(obstacle == "hoc_ra")
should be
if(istype(obstacle,/(whatever atom type hoc_ra is)/hoc_ra)

I'm more inclined to do it how Alathon suggested. Just put it in hoc_ra's Block() proc. That's how the class trainers in Darke Dungeon work:

Bump(atom/obstacle)
usr << "You bump into [obstacle]."
obstacle.Block() //do obstacle's special actions, if any


(whatever path here)/hoc_ra/Block()
usr << "You have choosen the sun god, Ra as your religion."
religion = "Ra"

Also, you mentioned that it was bumping a turf instead of hoc_ra. If hoc_ra is a mob or obj sitting on a dense turf, it won't be bumped. The Move() routines won't check a turf's contents if it is dense and the moving mob is dense. BYOND already knows you can't enter and stops checking, Bump()ing you against the turf.