ID:268229
 
#1
mob/verb/rock()
var/obj/o = 'rocks.dmi'
new o(usr.loc)
sleep(1)
o.pixel_y += 2

#2
mob/verb/rock()
var/obj/o = 'rocks.dmi'
new o(usr.loc)
while(o)
sleep(1); o.pixel_y+=2


Those don't work. I get runtime errors.

RUNTIME ERROR FOR #1:
runtime error: Cannot create objects of type null.
proc name: rock (/mob/verb/rock)
source file: Verbs.dm,130
usr: \[Designer] SSJ4_Gohan_Majin (/mob/characters/Male_White)
src: \[Designer] SSJ4_Gohan_Majin (/mob/characters/Male_White)
call stack:
\[Designer] SSJ4_Gohan_Majin (/mob/characters/Male_White): rock()

RUNTIME ERROR FOR #2: SAME ERROR AS #1


Please help if you can, thanks!

--Dan

You're trying to set an object reference equal to an icon file.

Try something like this:
/*  This defines what a rock is, sets an icon for them, and
adds a Hover() proc which will make the rock rise into
the air, then vanish when it gets as high as the Height
var which is passed to it.
*/


obj
rock
icon = 'rock.dmi'
proc
Hover(Height=10 as num)
while(Height)
pixel_y += 1
Height--
sleep(1)
del src

/* This verb simply creates a new rock in the usr's
location, then calls the rocks Hover() proc. You
can change the height of the hover to whatever you
want.
*/


mob
verb
Rock()
var/obj/rock/Rock = new(loc)
Rock.Hover(30)


There are a few problems with this snippet, but it's a start. You may not even see the rock at all, depending on how high you hover it, and how big your mob's icon is. The rock will be on a lower layer than the mob, so it may be behind it. Set the objects layer var to MOB_LAYER+1 to fix this temporarily.

You would also need to check to be sure Height is a valid
value. You wouldn't want a negative value to get passed, etc.
In response to Flick
Thanks, Flick!

--Dan