ID:140521
 
Code:
mob
verb
Fire_Ball_Jutsu()

if(src.fatigue < 100)
src.Frozen = 1
var/mob/E=src.enemy
src.Facedir(E)
usr.icon_state = "Base type 1 seal 4"
usr.overlays +='fire ball jutsu base.dmi'
var/obj/Fire_Ball_Jutsu/K = new /obj/Fire_Ball_Jutsu
K.loc = usr.loc
K.nin=usr.nin
K.dir = usr.dir
K.name=usr.name
src.fatigue ++
K.Gowner=usr
for(var/mob/M in oview(4,usr))
if(M.loc==K.loc)
var/damage = src.nin*1.7
src <<output("<font size=1><b><font color = blue>[damage]<font color = white> damage</font>.","combat")
view()<<"<font size=1><b><font color = red>[damage]<font color = white> damage</font>."
M.health -= damage
world << "LOL"
if(M.client)
M.updateHealth()
M.Die(src)
spawn(30)
usr.Frozen = 0
usr.icon_state = ""
usr.overlays -='fire ball jutsu base.dmi'
spawn(50)
del(K)



else
src << "<font color = grey><font size = 1>You need to rest"
return


Problem description:

I dont know if this is a byond problem or my code..

Ok well, i want it so that if the mob is inside of the object then it will execute the rest, but whenever its used when a mob is underneth, nothing happens..

i dont know if its my code problem or something with the new maps(cuz the fire ball jutsu icon is a big icon)

thx
Something people like to say is don't use usr, use src.
(That's not your problem here, but it's 'smarter' to do.)

Ok well, i want it so that if the mob is inside of the object then it will execute the rest, but whenever its used when a mob is underneth, nothing happens..

I didn't quite understand this...
You want them to Fire, then automatically rest... ?
Which mob? They who fired, or thee who got fired?
Tell us;
Fire Shooter and Burned Victim.

FS Shoots the fireball.
It hits the Burned Victim.
Then it calculates whether dead or not.
It tells the world, "LOL!"
Then it waits patiently in the background for 30 ticks.
Then, bye bye fireball.

What else do you want and when do you want it to happen?
In response to Dark Vendetta
Dark Vendetta wrote:
Something people like to say is don't use usr, use src.
(That's not your problem here, but it's 'smarter' to do.)

That only counts for procs; Agrey123 only has a verb in his code snippet. Usr in verbs is completely appropriate.
In response to Nielz
how is usr more appropriate in a verb than in a proc? it's the same thing. i don't follow the 'no usr in proc' philosophy (verbs, Click, etc are all procs), i don't see how usr is appropriate in one but not the other.

usr is appropriate anywhere, so long as you know what usr actually is. consider this:

mob
verb
hello_world()
world << "[usr] says hello world!"

trigger_hello_world(mob/M as mob in world)
M.hello_world()


there's 2 mobs in our world, mob1 and mob2. mob1 calls the trigger verb, and selects mob2. guess who the usr is gonna be in mob2.hello_world. this is the very reason why usr in proc is bad, the usr wont always be the src. but in this case here, the usr wont always be the src in the verb either. the same goes for Click, if mob1 calls mob2.Click(x), the usr in Click wont be mob2.

That only counts for procs; Agrey123 only has a verb in his code snippet. Usr in verbs is completely appropriate.

it cannot count for one or the other, you either adopt a no usr anywhere policy or a smart use of usr anywhere policy. vendetta was correct in suggesting src, unless the verb was designed in a way where usr could be any mob, then this is smart use of usr (but strange in this case).
In response to Nielz
Like I said, "Something people like to say..."

Edit;
Anyways...
What is it Agrey123 wishes to complete? I'm still trying to decipher what his goal is. o.O
In response to Crashed
Crashed wrote:
how is usr more appropriate in a verb than in a proc?

Because verbs are primarily player-invoked, and when a procedure is player-invoked, usr is set to the player who started it, therefore it's guaranteed not to be set to some arbitrary mob or null, like it could be set to in the middle of a proc chain. Duh, really. usr isn't so user-friendly as most newbies tend to think.

Incidentally, the OP in this case should switch all his usages of usr to src, as he's mixing them both, leading to inconsistent source code and potential funny, difficult to explain behavior if the verb is ever called from another proc. It is generally better to use src in mob verbs with the default src setting, as it will always point to the correct object, even when the verb is called from code (which is something that's quite often useful but admittedly underused) - similarly to Login().
In response to Kaioken
no need to call me agrey123, u can call me agrey *winks*

anyways my problem is this

well since my icon i am using is using a big icon(bigger than 32x32) then the actual loc of the icon is in the south western corner(the 32x32 part which byond reads) well when i use this technique, i want it to find another mob underneth the object but not in the southwestern corner that byond only reads from, but since byond only reads from the southwestern corner of the big_icons how would i make the objects loc = to a mobs loc which is located anywhere in the object.

sorry for not explaining properly
In response to Agrey123
If you have a larger icon, then you probably want to use block() to get a list of turfs within the object, as in:

proc
get_turfs_covered_by_icon(var/turf/source, var/size)
//size is the size of the icon in multiples of world.icon_size
//for example, it should be 2 if the icon is 64x64 and the icon_size is 32x32
if(!size || !source)
return list()

//step NORTHEAST [size] times
var/turf/dest = source
for(var/v = 0, v < size, v++)
dest = get_step(source, NORTHEAST)

return block(source, dest)


Note: this assumes your icon doesn't go off the edge of the map.