ID:143562
 
Code:
mob/Monster/Tentomon
icon = 'tentomon.dmi'
icon_state = "rookie"
density = 1
HP = 150 // its power
Str = 15
Def = 2
Exp = 100//ow much exp it gives
Money = 100
var/attacking = 0
var/mob/player/P // it is way easyer it type P then to type mob/player all the time :)
New()
. = ..()
spawn()//starts to do the next command
Wander()
proc/Wander()
while(src)//makes sure it is doing it
var/Found = FALSE// flase is the same as 0 and ture means 1, just did diferent for a while XD
for(P in oview(5,src))//if the player is within 5 steps.
step_towards(src,P)//steps towards the player
Found = TRUE
break // makes it so it wont just leave the person it is chasing and go after something else
if(Found != TRUE)
step_rand(src)//steps randomly for a while
sleep(10)
sleep(5)
Bump(mob/M)
if(istype(M,/mob/player))
var/lo = roll(6,20)
Attack(M)
if(lo == 7)
Shocker(M)
proc/Attack(mob/M)
if(!attacking)
attacking = 1
spawn(15)
attacking = 0
flick("attack",src)//shows the mnster attacking. OPTION :)
sleep(15)
var/damage = rand(1,Str) - round(rand(M.Def*0.6,M.Def*1.25))
if(damage <= 0)
damage = 1
M.HP -= damage
M.DeathCheck()
view(src) << "[src] attacks [M]!"//tell people who and what got attacked
view(src) << "[damage] damage!"// says how much damage
proc/Shocker(mob/M)
if(!attacking)
attacking = 1
spawn(5)
attacking = 0
flick("shock",src)//shows the mnster attacking. OPTION :)
sleep(15)
M.mov = 0
Move(loc,dir)
if(M.mov == 0) return 0
return..()


Problem description:
Try to make the mob/M unavaible to move but I get "monsters.dm:385:error: proc definition not allowed inside another proc" on "if(M.mov == 0) return 0"

I'm a little confused on what you're trying to do with that method but I know what your issue is anyways, problem is that you're trying to change a set proc within another proc, ya can't do that (Like defining a proc within another proc).


This is a fix from getting a compile error but not sure if it'll do what you want it to though.

    proc/Shocker(mob/M)
if(!attacking)
attacking = 1
spawn(5)
attacking = 0
flick("shock",src)//shows the mnster attacking. OPTION :)
sleep(15)
M.mov = 0
Move(loc,dir)
if(src.mov == 0) return 0
return..()


(Oh is the move suppose to make the target unable to move? Should work then but you might want to add a spawn() M.mov = 1 so the person can move after set time)
In response to Rifthaven
thanks :) Got no errors so I hope it will work :)
In response to Syltmunk
Whoops, I didn't have part of my code indented correctly (my mistake) so if you have issues relook at my message above.
In response to Rifthaven
Hmmm :S
This is my new code:
mob/Monster/Tentomon
icon = 'tentomon.dmi'
icon_state = "rookie"
density = 1
HP = 150 // its power
Str = 15
Def = 2
Exp = 100//ow much exp it gives
Money = 100
var/attacking = 0
var/mob/player/P // it is way easyer it type P then to type mob/player all the time :)
New()
. = ..()
spawn()//starts to do the next command
Wander()
proc/Wander()
while(src)//makes sure it is doing it
var/Found = FALSE// flase is the same as 0 and ture means 1, just did diferent for a while XD
for(P in oview(5,src))//if the player is within 5 steps.
step_towards(src,P)//steps towards the player
Found = TRUE
break // makes it so it wont just leave the person it is chasing and go after something else
if(Found != TRUE)
step_rand(src)//steps randomly for a while
sleep(10)
sleep(5)
Bump(mob/M)
if(istype(M,/mob/player))
var/lo = roll(2,20)
// Attack(M)
Shocker(M)
proc/Attack(mob/M)
if(!attacking)
attacking = 1
spawn(15)
attacking = 0
flick("attack",src)//shows the mnster attacking. OPTION :)
sleep(15)
var/damage = rand(1,Str) - round(rand(M.Def*0.6,M.Def*1.25))
if(damage <= 0)
damage = 1
M.HP -= damage
M.DeathCheck()
view(src) << "[src] attacks [M]!"//tell people who and what got attacked
view(src) << "[damage] damage!"// says how much damage
proc/Shocker(mob/M)
if(!attacking)
attacking = 1
spawn(5)
attacking = 0
flick("shock",src)//shows the mnster attacking. OPTION :)
sleep(15)
M.mov = 0
Move(loc,dir)
if(M.mov == 0) return 0
M.verbs -= /mob/player/verb/tackle
M.verbs -= /mob/player/verb/Shoot
M.verbs -= /mob/player/agumon/verb/fire
M.verbs -= /mob/player/gomamon/verb/Fish
M.verbs -= /mob/player/gabumon/verb/blueblaster
M.verbs -= /mob/player/palmon/verb/ivy
M.verbs -= /mob/player/biyomon/verb/spiral
M.verbs -= /mob/player/birdramon/verb/meteor_wing
M.verbs -= /mob/player/garurumon/verb/howling_blaster
M.verbs -= /mob/player/greymon/verb/nova_blast
M.verbs -= /mob/player/togemon/verb/needle_spray
M.verbs -= /mob/player/ikkakumon/verb/hapoon_torpedo
M.overlays += 'shock.dmi'
spawn(600)
M.overlays -= 'shock.dmi'
M.mov = 1
M.verbs += /mob/player/verb/tackle
M.verbs += /mob/player/verb/Shoot
if(M.icon_state == "rookie")
if(M.icon_state == "rookie")
if(istype(M,/mob/player/koromon/koro))
M.verbs += /mob/player/agumon/verb/fire
else
if(M.type == /mob/player/bokamon/boka)
M.verbs += /mob/player/gomamon/verb/Fish
else
if(M.type == /mob/player/yokomon/yoko)
M.verbs += /mob/player/biyomon/verb/spiral
else
if(M.type == /mob/player/yuramon/yura)
M.verbs += /mob/player/palmon/verb/ivy
else
if(M.type == /mob/player/tsunamon/tsuna)
M.verbs += /mob/player/gabumon/verb/blueblaster
else
if(M.icon_state == "champion")
if(istype(M,/mob/player/koromon/koro))
M.verbs += /mob/player/greymon/verb/nova_blast
else
if(M.type == /mob/player/bokamon/boka)
M.verbs += /mob/player/ikkakumon/verb/hapoon_torpedo
else
if(M.type == /mob/player/yokomon/yoko)
M.verbs += /mob/player/birdramon/verb/meteor_wing
else
if(M.type == /mob/player/yuramon/yura)
M.verbs += /mob/player/togemon/verb/needle_spray
else
if(M.type == /mob/player/tsunamon/tsuna)
M.verbs += /mob/player/garurumon/verb/howling_blaster


But it does not work, the overlay does not add and I can move :/
In response to Syltmunk
Before I answer I wanna make sure I understand what you're doing, are you trying to modify Move() so that you can't move when mov = 0 correct?

Well, I'll assume yes. Here's the issue, you have to modify Move() for it to work, you are somewhat on the right track but not quite hitting home.

First of all, remove the Move(loc,dir) and the if(M.mov == 0) return 0. Remove both.

Any time a player tries to move the Move function gets called, so we have to modify it to suit our needs.

Like so,

mob
Move()
if(!src.mov)
return 0
..()


Now notice this is not in your Shocker proc.

Umm as far as overlays go, it probably didn't work because you kept having it return out of the proc before it got to the overlays.
In response to Rifthaven
correct! Also when he stops moving a overlay will be added and all attack options will dissapear.
In response to Syltmunk
Granted I didn't pay much attention to all the additional code but if you do the fix I had in my previous message it should fix the overlays/verbs issue. If not I can take another look.
In response to Rifthaven
yup now it workes :)

Thanks a lot :)