ID:703700
 
(See the best response by .screw.)
Code:
obj
Beam
verb
Shinobi(M as mob)
set src in usr.contents/*Something is missing here */
usr.MP -= 10
var/Damage = rand(10, 50)
var/obj/beamobj/b = new(src.loc)
walk(b, src.dir)
view()<<"[usr] hit [M] with a beam for [Damage] "
var/mob/foe = M
foe.TakeDamage(Damage,usr)
obj
beamobj
icon='skills.dmi'
icon_state="Beamobj"


Problem description: It keeps on when it has 0 MP can some one please help me i want it to stop when 0 MP because its a very strong attack

I am not entirely sure why your beam has a verb. Logically, you'd want the player to have the attack verb. Therefore, I will construct one for you.

obj
beamobj
icon = 'skills.dmi'
icon_state = "Beamobj"
var/mob/owner // who shot the beam
var/damage
Bump(atom/a)
if(ismob(a) && (a != owner)) // if you bump into a mob
world << "The beamed has hit [a.name]!"
var/mob/m = a
m.TakeDamage(damage, owner)
del src // delete the beam
..()

proc/movement(speed) // can add more to the movement, if needed
walk(src, owner.dir, speed) // default speed is 0

mob
verb
Shinobi()
if(MP >= 10) // if you have at least 10 mp left
MP -= 10
var/obj/beamobj/b = new(usr.loc)
b.owner = usr
b.damage = rand(10, 50)
b.movement()
loading Darkeyes.dme
loading Skin.dmf
Main.dm:14:error: /obj/Beam: undefined type path

Darkeyes.dmb - 1 error, 0 warnings (double-click on an error to jump to it)


mob
Login()
if(usr.key=="Whybe")
usr.verbs += typesof(/mob/Admin/verb/)
usr.verbs += typesof(/mob/Admin/verb/)
src.contents += new /obj/Beam
usr << "<font color=white>Go to our <u>new</u> Website/Forum click <A HREF='http://whybegaming.ucoz.com/'>here</A> you can also sign up for admin there.</font>"
if(src.LoadProc())
world<<"<font color=blue><b>[src]</b> has Returned to the awesome game Darkeyes</font>"
else
src.loc=locate(9,3,1)
world<<"<font color=white>The Game Grows Bigger As <b>[src]</b> logs in</font> "



runtime error: Cannot read null.dir
proc name: movement (/obj/beamobj/proc/movement)
usr: Whybe (/mob/player)
src: the beamobj (/obj/beamobj)
call stack:
the beamobj (/obj/beamobj): movement(null)
Whybe (/mob/player): Shinobi()



When i click the verb
In response to Whybe
Whybe wrote:
>
> loading Darkeyes.dme
> loading Skin.dmf
> Main.dm:14:error: /obj/Beam: undefined type path
>
> Darkeyes.dmb - 1 error, 0 warnings (double-click on an error to jump to it)


Ah, I see what you're doing there. Well, to make my snippet a "plug-n-play", simply change the mob/var/Shinobi() path to obj/beam/verb/Shinobi().
> mob
> Login()
> if(usr.key=="Whybe")
> usr.verbs += typesof(/mob/Admin/verb/)
> usr.verbs += typesof(/mob/Admin/verb/)
> src.contents += new /obj/Beam
> usr << "<font color=white>Go to our <u>new</u> Website/Forum click <A HREF='http://whybegaming.ucoz.com/'>here</A> you can also sign up for admin there.</font>"
> if(src.LoadProc())
> world<<"<font color=blue><b>[src]</b> has Returned to the awesome game Darkeyes</font>"
> else
> src.loc=locate(9,3,1)
> world<<"<font color=white>The Game Grows Bigger As <b>[src]</b> logs in</font> "
>



In response to Whybe
Whybe wrote:
runtime error: Cannot read null.dir
proc name: movement (/obj/beamobj/proc/movement)
usr: Whybe (/mob/player)
src: the beamobj (/obj/beamobj)
call stack:
the beamobj (/obj/beamobj): movement(null)
Whybe (/mob/player): Shinobi()



When i click the verb

obj
beam
verb
Shinobi()
if(usr.MP >= 10) // if you have at least 10 mp left
usr.MP -= 10
var/obj/beamobj/b = new(usr.loc)
b.owner = usr
b.damage = rand(10, 50)
b.movement()
That was smart the thing it's amazing brb let me try it on a monster
Opps found another problem it gives these verbs to all the npcs
mob
npc
Penguinlaso
icon='Penguinlaso.dmi'
icon_state="Penguinlaso"
verb
Talk()
set src in oview(1)
usr << "<font color=white><b>Penguinlaso</b></font><font color=green>: Hi [usr] i am Penguin laso a high ranked penguin in the ice would you like to get the darkeyes?</font>"
alert("Do you want to Darkeyes?",,("Yes"),("No"))
verb
Hit()
set src in oview(1)
usr << "<font color=white><b>Penguinlaso</b></font><font color=green>: i'll send you to the grave!!!!!!!!!!</font>"
world <<"<font color=white><b>Penguinlaso</b></font><font color=red> Has Killed [usr]"
usr.Deaths += 1
usr.loc=locate(9,3,1)
And also when i use my skill it goes through the enemy
In response to Whybe
Whybe wrote:
Opps found another problem it gives these verbs to all the npcs
> mob
> npc
> Penguinlaso
> icon='Penguinlaso.dmi'
> icon_state="Penguinlaso"
> verb
> Talk()
> set src in oview(1)
> usr << "<font color=white><b>Penguinlaso</b></font><font color=green>: Hi [usr] i am Penguin laso a high ranked penguin in the ice would you like to get the darkeyes?</font>"
> alert("Do you want to Darkeyes?",,("Yes"),("No"))
> verb
> Hit()
> set src in oview(1)
> usr << "<font color=white><b>Penguinlaso</b></font><font color=green>: i'll send you to the grave!!!!!!!!!!</font>"
> world <<"<font color=white><b>Penguinlaso</b></font><font color=red> Has Killed [usr]"
> usr.Deaths += 1
> usr.loc=locate(9,3,1)
>


Tab everything, from icon ='Penguinlaso.dmi' and down, over once.
In response to Whybe
Whybe wrote:
And also when i use my skill it goes through the enemy

Are enemies mob or obj?
loading Darkeyes.dme
loading Skin.dmf
Penguinlaso.dm:6:error: : empty type name (indentation error?)

Darkeyes.dmb - 1 error, 0 warnings (double-click on an error to jump to it)


            verb
Talk()
set src in oview(1)
usr << "<font color=white><b>Penguinlaso</b></font><font color=green>: Hi [usr] i am Penguin laso a high ranked penguin in the ice would you like to get the darkeyes?</font>"
alert("Do you want to Darkeyes?",,("Yes"),("No"))
Enemies are mobs
In response to Whybe
Whybe wrote:
> loading Darkeyes.dme
> loading Skin.dmf
> Penguinlaso.dm:6:error: : empty type name (indentation error?)
>
> Darkeyes.dmb - 1 error, 0 warnings (double-click on an error to jump to it)
>

>           verb
> Talk()
> set src in oview(1)
> usr << "<font color=white><b>Penguinlaso</b></font><font color=green>: Hi [usr] i am Penguin laso a high ranked penguin in the ice would you like to get the darkeyes?</font>"
> alert("Do you want to Darkeyes?",,("Yes"),("No"))
>


What I intended:

mob
npc
Penguinlaso
icon='Penguinlaso.dmi'
icon_state="Penguinlaso"
verb
Talk()
set src in oview(1)
usr << "<font color=white><b>Penguinlaso</b></font><font color=green>: Hi [usr] i am Penguin laso a high ranked penguin in the ice would you like to get the darkeyes?</font>"
alert("Do you want to Darkeyes?",,("Yes"),("No"))
verb
Hit()
set src in oview(1)
usr << "<font color=white><b>Penguinlaso</b></font><font color=green>: i'll send you to the grave!!!!!!!!!!</font>"
world <<"<font color=white><b>Penguinlaso</b></font><font color=red> Has Killed [usr]"
usr.Deaths += 1
usr.loc=locate(9,3,1)

So what should i do with the enemies
They are mobs
In response to Whybe
Whybe wrote:
They are mobs

Are the mobs dense? If not, there's your problem.

idk what do you mean
In response to Whybe
Whybe wrote:
idk what do you mean

You stated that you're shooting beamobj at mobs. For those mobs, is their density 1 or 0? If it's 0, set it to 1.

By the way, are you receiving the "The beamed has hit..." when a beamobj hits a mob? If not, and the density was 1, please show the updated obj/beam and beam/beamobj code snippet.
obj
beamobj
icon = 'skills.dmi'
icon_state = "Beamobj"
var/mob/owner // who shot the beam
var/damage
Bump(atom/a)
if(ismob(a) && (a != owner)) // if you bump into a mob
world << "The beamed has hit [a.name]!"
var/mob/M = a
M.TakeDamage(damage, owner)
del src // delete the beam
..()

proc/movement(speed) // can add more to the movement, if needed
walk(src, owner.dir, speed) // default speed is 0

obj
Beam
verb
Shinobi()
if(usr.MP >= 10) // if you have at least 10 mp left
usr.MP -= 10
var/obj/beamobj/b = new(usr.loc)
b.owner = usr
b.damage = rand(10, 50)
b.movement()
Page: 1 2