ID:178590
![]() Apr 25 2002, 10:37 am
|
|
How would I make it where after you attack something it moves back 2 tiles in the direction you hit it in?
|
Hmm this still isn't working for me.This is my attacking verb
mob/verb And this is my AttackPC proc mob/proc/AttackPC(atom/movable/attacker) I get no errors from this but when i start the game I get a runtime error that says.. runtime error: Cannot read null.dir proc name: AttackPC (/mob/proc/AttackPC) source file: Verbs.dm,119 usr: Empeor Beld (/mob/PC) src: Talin (/mob/Talin) call stack: Talin (/mob/Talin): AttackPC(null) Empeor Beld (/mob/PC): A() Can anybody tell me what im doing wrong? |
SuperGoku15 wrote:
Hmm this still isn't working for me.This is my attacking verb > mob/verb And this is my AttackPC proc > I get no errors from this but when i start the game I get a runtime error that says.. Yes, unindent this part once,var/turf/T=get_step(src,attacker.dir) if(!T || !Move(T)) break |
Yes, unindent this part once,var/turf/T=get_step(src,attacker.dir)
I Did that but now i get errors sayingif(!T || !Move(T)) break Verbs.dm:119:error:get_step:undefined proc Verbs.dm:120:error::invalid expression Verbs.dm:119:T :warning: variable defined but not used and this is what the code looks like now mob/proc/AttackPC(atom/movable/attacker) Whats wrong here? |
SuperGoku15 wrote:
Can anybody tell me what im doing wrong? You're not calling AttackPC with an argument. Look closely at the definition of the proc: It calls for you to specify who the attacker is. Thus, you'd have to call M.AttackPC(src). That's why it can't read null.dir; it thinks the attacker is null. And pay no attention to what Sariat said, because it's wrong. I have no idea what he was thinking. Lummox JR |
Sariat wrote:
Yes, unindent this part once,var/turf/T=get_step(src,attacker.dir) Sariat, that's indented for a reason; it's part of a for loop. I can't quite figure out how you inferred "indentation error" from "cannot read null.dir". The clue to the actual bug is right in that line: in attacker.dir, attacker is null, and it's happening because the proc isn't being called correctly. Lummox JR |
If you want it to move 2 tiles right away:
If you want it to move at a certain speed, you'll have to put in sleep(). This code as it stands now will make the monster appear to "jump" 2 tiles over.
Lummox JR