ID:161566
 
umm how would i be abel to make someone not be able to move if they use the resting verb? then return to their original icon state??
from this code, or if theirs something better out there
mob
var
resting = 0
verb
rest()
resting = 1
usr<<"You sit down to rest..."
icon = 'base.dmi'
icon_state = "rest"
sleep(30)
usr<<"You finished resting"
sleep(10)
usr<<"You stand up again"
usr.HP=maxHP
resting = 0
return
Well, to stop them moving, you'll need a moveallowed variable, and then to override the Move() proc. should be simple enough:
mob
var
moveallowed = 1
Move()
if(moveallowed) //Only of the moveallowed var is true
..() //do the default (allow the mob to move)

As for changing their icon state back to normal, just put at the end of the verb
icon_state="normal"
Not that hard.
In response to Adam753
hmm...
well the walking thing doesn't seem to work...
and i put some more code in to it so it would return the player back to their original icon according to their gender...
also, when you pick your gender @ beggining of the game its invisible... help! lol (b4 their wasn't an icon state for the walking or the standind)

mob
var
resting = 0
verb
rest()
resting = 1
usr<<"You sit down to rest..."
if(/mob/Male)
icon = 'base.dmi'
icon_state = "rest"
sleep(30)
usr<<"You finished resting"
sleep(10)
usr<<"You stand up again"
usr.HP=maxHP
resting = 0
icon_state = "1"
if(/mob/Female)
icon = 'baseF.dmi'
icon_state = "rest"
sleep(30)
usr<<"You finished resting"
sleep(10)
usr<<"You stand up again"
usr.HP=maxHP
resting = 0
icon_state = "1"
if(/mob/Neuter)
icon = 'baseN.dmi'
icon_state = "rest"
sleep(30)
usr<<"You finished resting"
sleep(10)
usr<<"You stand up again"
usr.HP=maxHP
resting = 0
icon_state = "1"

mob
Male
icon = 'Base.dmi'
icon_state = "1"
Female
icon = 'BaseF.dmi'
icon_state = "1"
Neuter
icon = 'BaseN.dmi'
icon_state = "1"


and when i went into the game i got this when i rested :


Your name is: RanEsu. <--- supposed to be there
Your gender is:/mob/Male. <--- supposed to just be Gender = male, but it still works fine
You sit down to rest... <--- supposed to be there
You finished resting <--- supposed to be there
You stand up again <--- supposed to be there
You finished resting <---- NOT SUPPOSED TO HAPPEN >_<
You stand up again <---- NOT SUPPOSED TO HAPPEN >_<
You finished resting <---- NOT SUPPOSED TO HAPPEN >_<
You stand up again
In response to RanEsu
if(/mob/Neuter) /*this is not the way to search for the person's type. I think it checks to see if the
type path exists- all 3 type paths here exist (/mob/Male, /mob/Female and /mob/Neuter) so it's resting
the person 3 times! */


if(type==/mob/Neuter)//try finding out their type this way.
In response to Adam753
Use istype(), not type==.

Additionally, your Move() proc won't work properly. Move() needs to return a value. So, in the simplest case:

mob/Move()
if(Icanmove)
return ..()
else
return 0
In response to Garthor
ah, see? even i learned something!
In response to Garthor
Garthor wrote:
Use istype(), not type==.

Additionally, your Move() proc won't work properly. Move() needs to return a value. So, in the simplest case:

mob/Move()
> if(Icanmove)
> return ..()
> else
> return 0


you said use istype()

but if i plug it in

if(istype(/mob/Male))
obviously dont work... how would i make it work?
In response to RanEsu
By looking up istype() in the reference.
In response to Garthor
ya i did
how to i get this to work??
and every move proc i use that freezes movment freezes it all the time, not all of the time
and also it don't change icons when i tell it too :(

well heres the code
mob
var
resting = 0
verb
rest()
resting = 1
usr<<"You sit down to rest..."
if(istype(M,/mob/Male))
icon = 'rest.dmi'
icon_state = "rest"
sleep(30)
usr<<"You finished resting"
sleep(10)
usr<<"You stand up again"
usr.HP=maxHP
resting = 0
icon = 'Base.dmi'
if(istype(M,/mob/Female))
icon = 'rest.dmi'
icon_state = "restf"
sleep(30)
usr<<"You finished resting"
sleep(10)
usr<<"You stand up again"
usr.HP=maxHP
resting = 0
icon = 'BaseF.dmi'
if(istype(M,/mob/Neuter))
icon = 'rest.dmi'
icon_state = "restn"
sleep(30)
usr<<"You finished resting"
sleep(10)
usr<<"You stand up again"
usr.HP=maxHP
resting = 0
icon = 'BaseN.dmi'
In response to RanEsu
did you define M anywhere?
In response to Eternal Desire
im not sure, i went to the DM refrence and thats what it had, i diddnt question it >_> lolz u kno how to fixxx itt? pleash :D
In response to RanEsu
a tip: define M.

var/mob/M //that should fix it

//... your code here.
In response to Eternal Desire
k lol, ty, but do u have a proc i can use to make some1 not be abel to move if they rest?
In response to Eternal Desire
Eternal Desire wrote:
a tip: define M.

> var/mob/M //that should fix it
>
> //... your code here.


no doubt its a good idea, but it doesent work >_>

i suppose i need to do sumthing else V_V
In response to RanEsu
RanEsu wrote:
k lol, ty, but do u have a proc i can use to make some1 not be abel to move if they rest?
last time i'll write code (learn from it) for you >_>
mob
var/canmove = 1
Move()
if(!canmove) return 0
..()

mob/verb
Rest()
src.canmove=0
sleep(150)
src<<"<font color=White>You fall asleep...</font>"
sleep(150)
src<<"<font color=White>You wake up!</font>"
src.hp=maxhp
src.canmove=1
In response to Eternal Desire
ok... i see what u did there... lol ty.. but whats the ..() for?? i put that in and it sais operation has no effect
In response to RanEsu
OMGGGGGG
the rest code stopped working completely
:/
the move proc works fine now but the rest code stopped...



do you see anything wrong?
mob
var/canmove = 1
Move()
if(!canmove) return 0
..()


mob
var
resting = 0
verb
rest()
resting = 1
usr<<"<font color=White>You sit down to rest...</font>"
var/mob/M //that should fix it
if(istype(M,/mob/Male))
icon = 'rest.dmi'
icon_state = "rest"
src.canmove=0
sleep(30)
usr<<"<font color=White>You finished resting</font>"
sleep(10)
usr<<"<font color=White>You stand up again</font>"
usr.HP=maxHP
resting = 0
icon = 'Base.dmi'
src.canmove=1
if(istype(M,/mob/Female))
icon = 'rest.dmi'
icon_state = "restf"
src.canmove=0
sleep(30)
usr<<"<font color=White>You finished resting</font>"
sleep(10)
usr<<"<font color=White>You stand up again</font>"
usr.HP=maxHP
resting = 0
icon = 'BaseF.dmi'
src.canmove=1
if(istype(M,/mob/Neuter))
icon = 'rest.dmi'
icon_state = "restn"
src.canmove=0
sleep(30)
usr<<"<font color=White>You finished resting</font>"
sleep(10)
usr<<"<font color=White>You stand up again</font>"
usr.HP=maxHP
resting = 0
icon = 'BaseN.dmi'
src.canmove=1
In response to RanEsu
RanEsu wrote:
OMGGGGGG
the rest code stopped working completely
:/
the move proc works fine now but the rest code stopped...



do you see anything wrong?
> mob
> var/canmove = 1
> Move()
> if(!canmove) return 0
> ..()
>
>
> mob
> var
> resting = 0
> verb
> rest()
> resting = 1
> usr<<"<font color=White>You sit down to rest...</font>"
> var/mob/M //that should fix it
> if(istype(M,/mob/Male))
> icon = 'rest.dmi'
> icon_state = "rest"
> src.canmove=0
> sleep(30)
> usr<<"<font color=White>You finished resting</font>"
> sleep(10)
> usr<<"<font color=White>You stand up again</font>"
> usr.HP=maxHP
> resting = 0
> icon = 'Base.dmi'
> src.canmove=1
> if(istype(M,/mob/Female))
> icon = 'rest.dmi'
> icon_state = "restf"
> src.canmove=0
> sleep(30)
> usr<<"<font color=White>You finished resting</font>"
> sleep(10)
> usr<<"<font color=White>You stand up again</font>"
> usr.HP=maxHP
> resting = 0
> icon = 'BaseF.dmi'
> src.canmove=1
> if(istype(M,/mob/Neuter))
> icon = 'rest.dmi'
> icon_state = "restn"
> src.canmove=0
> sleep(30)
> usr<<"<font color=White>You finished resting</font>"
> sleep(10)
> usr<<"<font color=White>You stand up again</font>"
> usr.HP=maxHP
> resting = 0
> icon = 'BaseN.dmi'
> src.canmove=1
>


indent every line with TAB (ONCE) after the var/mob/M line
In response to Eternal Desire
ok whats that do to the code? (trying to become more experienced :< )
Page: 1 2