ID:173390
 
hello i have
obj
Bomb
icon = 'objs.dmi'
icon_state = "bomb"
density = 1
Bump(mob/M)
usr.icon_state = "bomb"
usr.bomb = 1
usr.verbs += /mob/tank/verb/Bomb
var/R_x = rand(1,23)
var/R_y = rand(1,29)
var/R_z = rand(1,1)
var/Random_loc = locate(R_x,R_y,R_z)
if(src.Move(Random_loc))
src << "you have respawend."

how can i make it so that if a usr walks into the bomb they get it?
CrazyFighter wrote:
how can i make it so that if a usr walks into the bomb they get it?

No put usr in Bump(). Ungh.

No conflate usr with player. Ungh!

Lummox JR
I personally don't like using density and the Bump() proc, as it creates stupid stuff when you use things like walk_to(). What I'd use is the Entered() proc for turfs:
turf/Entered(atom/movable/O)
if(ismob(O)) // if the atom/movable entering this turf is a mob
for(var/obj/bomb/B in src) // for every obj/bomb in this turf
B.loc = O // set the obj/bomb's location to the atom/movable that entered the turf
return ..() // exit the proc by performing whatever the Entered() proc does normally


Hopefully that's a bit more helpful to you than the typical "no usr in proc" response, which might as well be included in the description of Newbie Central and Coding Help or something at this point.
In response to Lummox JR
Lummox JR wrote:
CrazyFighter wrote:
how can i make it so that if a usr walks into the bomb they get it?

No put usr in Bump(). Ungh.

No conflate usr with player. Ungh!

Lummox JR

thanks but if i do
obj
Hp
icon = 'objs.dmi'
icon_state = "hp"
density = 0
mob/Bump(mob/src)
usr.HP += 10
var/R_x = rand(1,23)
var/R_y = rand(1,29)
var/R_z = rand(1,1)
var/Random_loc = locate(R_x,R_y,R_z)
if(src.Move(Random_loc))
src << "you have respawend."
respawend."

obj
Bomb
icon = 'objs.dmi'
icon_state = "bomb"
density = 1
mob/Bump(mob/src)
usr.icon_state = "bomb"
usr.bomb = 1
usr.verbs += /mob/tank/verb/Bomb
var/R_x = rand(1,23)
var/R_y = rand(1,29)
var/R_z = rand(1,1)
var/Random_loc = locate(R_x,R_y,R_z)
if(src.Move(Random_loc))
src << "you have respawend."


but when i get the hp it picks up the bomb.
In response to DerDragon
DerDragon wrote:
I personally don't like using density and the Bump() proc, as it creates stupid stuff when you use things like walk_to(). What I'd use is the Entered() proc for turfs:
> turf/Entered(atom/movable/O)
> if(ismob(O)) // if the atom/movable entering this turf is a mob
> for(var/obj/bomb/B in src) // for every obj/bomb in this turf
> B.loc = O // set the obj/bomb's location to the atom/movable that entered the turf
> return ..() // exit the proc by performing whatever the Entered() proc does normally
>

Hopefully that's a bit more helpful to you than the typical "no usr in proc" response, which might as well be included in the description of Newbie Central and Coding Help or something at this point.

i get

turfs.dm:36:error:B:undefined var
turfs.dm:37:error:B:undefined type: B
turfs.dm:38:error:B.loc:undefined type: B.loc
turfs.dm:37:B :warning: variable defined but not used
In response to CrazyFighter
Haha... how many times...

Alright, you've got to adapt that just a bit for your own use. Capitalize bomb so its var/obj/Bomb, so it matches your path of obj/Bomb. Also, make sure you don't have density defined as 1 for the Bomb, or players won't be able to enter the turf with the Bomb in it... If you had/have creatures with AI, chances are you'd be using some form of walk_proc, and your Bombs would be treated like walls, which is... alright, its pretty fricking stupid.
In response to CrazyFighter
CrazyFighter wrote:
thanks but if i do...

You still put usr in Bump(). Not read a thing Lummox JR say. Ungh.

Lummox JR
Ok, let me just finish this topic.
mob/Bump(atom/A)
if(!istype(A,/obj/Bomb)) return
bomb = 1
verbs += /mob/tank/verb/Bomb
A.loc = locate(rand(1,23),rand(1,29),rand(1,1))
src << "You have picked up a bomb!"
I have code that will keep it from appearing in walls, but you can figure that one out for yourself.
In response to Lummox JR
You need to find a more common synonym for "conflate". =) I didn't know what it meant until I looked it up because you used it, and it's a bit unrealistic to expect that most of the newbies will know what it means, or bother to look it up.
In response to Crispy
Crispy wrote:
You need to find a more common synonym for "conflate". =) I didn't know what it meant until I looked it up because you used it, and it's a bit unrealistic to expect that most of the newbies will know what it means, or bother to look it up.

Agreed, though "confuse" doesn't quite cut it.

Lummox JR