ID:1125497
 
(See the best response by A.T.H.K.)
Code:
mob/deidara/var/tmp/can_move_time = 0

mob/deidara/proc/Move()
if(world.time < src.can_move_time) return 0
. = ..()
if(.)
src.can_move_time = world.time + 3


        Attack()
usr.can_move_time = world.time + 10
flick("Attack",src)
for(var/mob/character/m in get_step(src, dir))
world << m
var/Damage=max(0,src.Str-m.Def)
flick("Hit",m)
step(m,WEST)
step(m,m.dir)
step(m,WEST)
m.dir=EAST
Bump()
m.KnockBack(10)
view(m)<<"[src] hit [m] for [Damage] Damage!"
m.Deathcheck()


Problem description:
this was a case specific example i was given in another post, and im still trying to figure out why the move proc is overridden by another one, when the only move proc in my project is the built in one. when i tried to make "mob/deidara/proc/move(" i get the error that :Main.dm:80:error: Move:

duplicate definition (conflicts with built-in proc)

but if i try and do it with just mob in general, it doesnt work for my project since my project is divided into classes and each mob can move differently...

Best response
You have named a proc Move() you can't do that, as it's a built in procedure.

mob/deidara/proc/Move()


Should be

mob/deidara/Move()
well that fixes the error. and in a normal game that stops the movement. but if i use the sidescroller library, how can you stop the movement of that? i was reading Forum_accounts comments on that in the movement library and all i found was "if you want to prevent movement don't do it through move()"....
Hmm no idea I have never used that library.

You should be able to override the North() South() East() West()

client
North()
if(mob.paused) return
South()
if(mob.paused) return
East()
if(mob.paused) return
West()
if(mob.paused) return


http://www.byond.com/docs/ref/info.html#/client/proc/North
alright thats a good place to start...ill look around and see if anyone else had a similar issue or if i can figure it out myself....
In response to Panda dude XD
I just gave you the answer :), Override those procedures and you will stop the movement.

North()
Default action:
Calls src.Move() towards the north.
FA's Sidescroller library bypasses the client's North/South/etc procs. Not sure which is responsible for the control of movement so play around with the libraries procs.
On an off topic but related note, I wish DM had a trace debug function.
In response to A.T.H.K
A.T.H.K wrote:
Hmm no idea I have never used that library.

You should be able to override the North() South() East() West()

> client
> North()
> if(mob.paused) return
> South()
> if(mob.paused) return
> East()
> if(mob.paused) return
> West()
> if(mob.paused) return
>

http://www.byond.com/docs/ref/info.html#/client/proc/North

im having trouble overriding those movements because whenever i try and create a var that would temporarily freeze those procs, i get the errors:
Main.dm:97:error: West: undefined proc

or a different one depending on the direction...
the way i've tried to do it was
mob
var
tmp/freeze_time = 0
proc
frozen()
return world.time < freeze_time

freeze(ticks)
freeze_time = max(freeze_time,world.time+ticks)

West()
if(frozen())
return 0
. = ..()
if(.)
freeze(3)


but that just gives me the error.....
West() North() etc are not mob procedures they are supposed to be under the client.
alright, but since my game uses a class system and i have mobs divided by names. when i input the freeze into the verb:
        Attack()
freeze(20)
flick("Attack",src)
for(var/mob/character/m in get_step(src, dir))
world << m
var/Damage=max(0,src.Str-m.Def)
flick("Hit",m)
step(m,WEST)
step(m,m.dir)
step(m,WEST)
m.dir=EAST
Bump()
m.KnockBack(10)
view(m)<<"[src] hit [m] for [Damage] Damage!"
m.Deathcheck()
sleep(10)


i get the error that:
Characters.dm:9:error: freeze: undefined proc.

which i understand, but i dont see how i can define it under mob/deidara for example, if i cant use West() under something other than client....
if(mob.paused) return

You can still use the variable under mob ... you just read it differently in the client, same goes for procs.

mob
var
tmp/freeze_time = 0
proc
frozen()
return world.time < freeze_time

freeze(ticks)
freeze_time = max(freeze_time,world.time+ticks)
client
West()
if(mob.frozen())
return 0
. = ..()
if(.)
mob.freeze(3)


Pretty sure that *should* still call those procs.
To OP: You can really tell that you don't know what you're doing, which means that just solving this small problem will only help you out for a little while until you really run into something that requires you to understand things like the difference between client and mob and what the error message: "undefined proc" actually means.

I'm not really yelling at you, but more so the people who are helping you only to patch the problems, and not explain more into what and why so that you can learn from this experience.
its called constructive criticism, and ya its actually the first time i've had to use "client" instead of "mob" so i am unfamiliar with it. And as for calling the directional procs. It wont work for me :I
I dont suppose anyone knows a demo or something that would help...?
In response to Jemai1
Jemai1 wrote:
FA's Sidescroller library bypasses the client's North/South/etc procs. Not sure which is responsible for the control of movement so play around with the libraries procs.

I have tried to freeze the North,south,east,west, and move procs... what else is possible to create movement? .-.
The library doesn't use those procs. Play with the library's procs. Try this for example
mob
move_speed = 4 // this var is provided by the library to set the movement speed

var
tmp/freeze_time = 0

proc
frozen()
return world.time < freeze_time

freeze(ticks)
freeze_time = max(freeze_time,world.time+ticks)

verb
Attack()
freeze(20)
// do stuff

action()
if(frozen())
return
..()

/*
Excerpt from the library's readme file:

mob
proc
action
In version 2.0 the movement() proc was further split. The part that contains the
movement behavior (the call to follow_path and the processing of keyboard input)
was moved to the action proc. This way you can override the action proc to change
a mob's movement behavior without overriding the entire movement proc.

Because the movement proc handles a lot of things (enforces gravity, calls
pixel_move, etc.) when you override it, you often want to change just a small
part of the behavior (the part that's now in action()) but you have to remember
to call gravity(), pixel_move(), and other procs. Now you can just override
action if that's all you want to change.
*/
Finally Progress was made! thx jemail! the only thing now, is that when the action proc is frozen, if my mob is in motion while using an attack it will stay in motion when attacking which isnt what i wanted. however if the mob is standing still, it cant move while attacking which is what i wanted!
In response to Panda dude XD
Panda dude XD wrote:
Finally Progress was made! thx jemail! the only thing now, is that when the action proc is frozen, if my mob is in motion while using an attack it will stay in motion when attacking which isnt what i wanted. however if the mob is standing still, it cant move while attacking which is what i wanted!

when you say "in motion" do you mean he is animating in place, or physically moving location.
it physically moves while attacking, so if my guy swings a sword, he does it while running or jumping depending on the action.
Page: 1 2