ID:1295980
 
(See the best response by Albro1.)
Code:
mob
var
tmp
shooting = FALSE
verb
Shoot()
if(shooting)
return
if(pLevel >= 1 && pLevel <= 25)
shooting = TRUE
new /obj/shots/standard(src)
spawn(5)
shooting = FALSE


Problem description:

I tried changing it to a list of shots and the such in hopes that it would cause it to work properly, but even that did not work.
It did not start doing this until I added a movement state. Does Byond call the Move() proc with a movement state or does it use a different proc, so that I can try to see if I can fix the delay.
mob
Move()
if(shooting)
return 0
..()
That's not working, that's why I am not sure what proc a movement state calls.
Best response
Move() is called whenever an atom moves.

I'm not sure what the issue is, but you may want to use usr in verbs, unless you know exactly what the difference is between them in verbs. (Specifying an argument name alone defaults to src)

Also note that you're only pausing for half a second before resuming. Are you sure you just aren't noticing the stop?
No I do notice the stop and that is what is causing the trouble. Say I move to the left and try to shoot. The shoot verb interrupts Move() proc and overrides it to where if I continue to shoot then I will just shoot, but it will not allow the Move() proc to run again. It did not start doing this until I added a movement state in the player icon.

I tried overriding the two procs like:

mob
var
tmp
shooting = FALSE
moving = FALSE
Move()
if(shooting)
moving = TRUE
//rest of shooting code with creating new objs
..()
verb
shoot()
if(shooting)
return
if(moving)
return
(rest of shooting code)


This way because the shoot verb was stopping the move proc I figured I would try to encapsulate the shoot verb inside of the move verb so when the player tries to move and shoot the Move proc would actually be the one creating the obj, without halting the proc.

I have not tried this route as of yet, but I thought about it more and I see an error of the Move proc causing it to where the player just shoots when they move so I am still working on it.
I changed the arguments to usr.pLevel it still debugs same as before.

I am using spacebar as a macro for the shoot verb with it on repeat.
Wait so you don't want shooting to stop movement?
Maybe it has to do with the macro being set up to repeat, which causes it to repeat the shoot verb so fast that the Move() proc never gets called whil the macro is repeating. Is there a way to make the repeat macros repeat less often, or a way to effect macros from the skin?
Yes I don't want shooting to stop movement.
Are your projectiles dense?
The shots objs are dense, but its not a fact of the projectile colliding with the ship as there is a inch gap between each shot, well past the bounding area. Yet, the ship will continue to sit still whenever you hold space to shoot. It is as if the macro is skipping move on the stack, but when I had a static ship icon it worked fine, now it just does this when calling the moement state designated in the. Dmi for the ship.
You've officially confused me as to what is going on and what you are trying to achieve. I don't know where a ship came from.
mob
Move()
moving = TRUE
if(shooting)
//rest of shooting code with creating new objs
spawn(5)
moving = FALSE
..()

The way you had it would only set the mob's moving var to true if they were already shooting(not sure if this is what you want to happen).
Also, it would not call the parent Move() proc if it was not shooting, causing it to stop moving.
Yeah the principle is that if the shooting proc is causing the move proc to not go, than I would need the move proc to set a variable showing that the mob is moving so that way instead of the obj being created in the shoot verb, it would instead be made through the move proc. Thus, not allowing the shoot verb to stop the move proc.
What needs to be shooting?

Can the thing shooting move while shooting?

Is there a delay between shots (a cooldown)?

Can the thing shooting ONLY shoot while moving?

I just need to clarify things here.
In response to Albro1
Albro1 wrote:
You've officially confused me as to what is going on and what you are trying to achieve. I don't know where a ship came from.

Sorry, This cracked me up.
The player is shooting, it can shoot while moving or not moving. There is a delay between shots.
mob
var/tmp/shooting = FALSE
verb/Shoot()
shoot(10)
proc/shoot(delay)
if(!shooting)
shooting = TRUE
//shoot
spawn(delay) shooting = FALSE


There's not really any reason that concept shouldn't work.
It works if I have a static icon. However, if I create an icon to use as a movement state. Has 1 set of frams, only west and east frames are used. If you shoot than you can not move. I think it is cause of macro.
There is no way an icon state can be causing you not to move.
Page: 1 2