Post new topic    
Metal Slime
Send private message
Walking script = odd result? 
 PostSat Aug 17, 2013 2:32 pm
Send private message Reply with quote
Hello,
I have a plotscript and some oddly behaving NPCs and no clue why this happens....

Here's the code:
Code:

This is the plotscript:
plotscript, Arrested1, begin
suspend player
set tag(29,1)
# camera zooms to npc 3
focus camera (19,0,2)
wait for camera
wait(25) # Wait about 3 seconds
set NPC direction (5,east)
wait for npc      (5)
wait(50) # Wait about 3 seconds
set NPC direction (2, west)
wait for NPC (2)
wait(50) # Wait about 3 seconds
camera follows NPC (5)        
# walks  guard
  walk NPC         (5,south,1)
  wait for NPC      (5)
  walk NPC          (5,east,2)
  wait for NPC      (5)
  walk NPC         (5,north,1)
  wait for NPC      (5)
  walk NPC         (5,east,4)          
  wait for NPC      (5)
  walk NPC         (5,north,5)
  wait for NPC     (5)            
  walk NPC         (5,north,1)
  wait for NPC      (5)      
  walk NPC         (5,east,1)
  wait for NPC      (5)   
 
# walks squire
  walk NPC          (2,south,1)
  wait for NPC      (2)
  walk NPC          (2,east,2)
  wait for NPC      (5)
  walk NPC         (2,north,2)
  wait for NPC      (2)
  walk NPC         (2,east,5)
  wait for NPC      (2)
  walk NPC         (2,north,4)
  wait for NPC      (2)
  camera follows hero (me)
  show text box      (28) # hey you?
  wait for textbox
  set hero direction (me,east)
  wait for hero
  show text box      (29)#me?
  wait for textbox
  show text box      (30)#I arrest you...
  wait for textbox
  show text box (132)
wait for textbox
resume player
end

That's what happens:

((Uploaded with ImageShack.us))

Somehow the NPC walks diagonal, instead the way it should walk from wait to wait command.
I'd also like to move the camera one tile upwards, but I'm not sure how to do that and if I can use negative numbers like focus camera (19,-2,2) or such.

I hope you can help me to find the mistakes.
Metal King Slime
Send private message
 
 PostSat Aug 17, 2013 3:00 pm
Send private message Reply with quote
You have a waitfornpc (5) in the middle of a bunch of waitfornpc (2). Probably the problem.
Metal Slime
Send private message
 
 PostSat Aug 17, 2013 3:44 pm
Send private message Reply with quote
Thanks a lot! That was the mistake for the odd walking...
I feel like I should have noticed it. xD
Liquid Metal King Slime
Send private message
Re: Walking script = odd result? 
 PostSat Aug 17, 2013 4:13 pm
Send private message Reply with quote
marionline wrote:

Somehow the NPC walks diagonal, instead the way it should walk from wait to wait command.
I'd also like to move the camera one tile upwards, but I'm not sure how to do that and if I can use negative numbers like focus camera (19,-2,2) or such.

I hope you can help me to find the mistakes.


If you ever want to move an NPC diagonally on purpose, here is the trick:

Code:

walk NPC(5, south, 1)
walk NPC(5, east, 1)
wait for NPC(5)


And the NPC will walk diagonally south-east.

As for moving the camera one tile up, I think you will find pan camera much easier to use than focus camera for that purpose
Metal Slime
Send private message
 
 PostSat Aug 17, 2013 7:42 pm
Send private message Reply with quote
Thanks Bob!

I don't really understand why pan camera is easier to use, but I added a pan camera north to the script, hoping it will work out.
Slime Knight
Send private message
 
 PostSun Aug 18, 2013 2:35 pm
Send private message Reply with quote
Well, in theory, it should be easier to think of moving the camera like you're moving an NPC instead of manually setting where it's looking at.

You also don't have to go into custom and manually look up your coords. It also lets you make the cutscene more robust if it can begin at various coordinates. The camera movements are all relative so you can adjust it later by changing the starting point.

Hard set coordinates means you need to go change all the coordinates or apply funky math that pan camera already does for you. Pan camera commands are also easier to read and tell what they're doing. Focus camera you need to compare the coordinates in your head and figure out which direction it's going

Just my .02$
Display posts from previous: