Backward walk

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
User avatar
guo
Metal Slime
Posts: 749
Joined: Fri Dec 04, 2009 9:12 pm

Backward walk

Post by guo »

Quick question :

How do I make an NPC or Hero walk backwards? eg facing upwards while walking 1 step down.

Regards.
vvight.wordpress.com
User avatar
Foxley
Metal Slime
Posts: 832
Joined: Sat Nov 09, 2013 5:54 pm

Post by Foxley »

Write a simple script to change the hero's walkabout picture set to a copy of their normal one, with the frames facing in opposite directions.

If it's something like facing up while going down a ladder, just have an NPC at the top of the ladder trigger that script, then have another NPC set your hero picture back to normal when you're not on the ladder anymore.

EDIT:
An example might be handy too, now that I think of it.

Code: Select all

## Assuming walkabout set 1 is the hero climbing,
## and set 0 is the regular one.

plotscript, climb ladder, status, begin
	if (status) then (
	set hero picture (me, 1)
	)
	else (reset hero picture(me))
end
Just give the NPC(s) that turns on the climbing graphic a script argument 1, and the NPC(s) that sets it back to normal a script argument 0.
Last edited by Foxley on Sun Dec 04, 2016 3:39 am, edited 1 time in total.
User avatar
Pepsi Ranger
Liquid Metal Slime
Posts: 1457
Joined: Thu Nov 22, 2007 6:25 am
Location: South Florida

Post by Pepsi Ranger »

Real easy:

Code: Select all

script,Moonwalk,begin
walk hero (who,direction,distance)
set hero direction (who,opposite direction)
wait for hero (who)
end
Basically, just set the direction after you send the hero (or NPC) in motion.
Last edited by Pepsi Ranger on Sun Dec 04, 2016 3:35 am, edited 1 time in total.
Place Obligatory Signature Here
User avatar
guo
Metal Slime
Posts: 749
Joined: Fri Dec 04, 2009 9:12 pm

Post by guo »

Thanks guys! I just wanted the hero to back away from a threat rather than walk backwards and turn around. If I wanted to move back more than 1 space I guess I'd need to do something like:

Code: Select all

script,Moonwalk,begin 
  walk hero (bigsteve,down,1) 
  set hero direction (bigsteve,up) 
  wait for hero (bigsteve) 
  walk hero (bigsteve,down,1) 
  set hero direction (bigsteve,up) 
  wait for hero (bigsteve) 
  walk hero (bigsteve,down,1) 
  set hero direction (bigsteve,up) 
  wait for hero (bigsteve) 
  walk hero (bigsteve,down,1) 
  set hero direction (bigsteve,up) 
  wait for hero (bigsteve) 
end
right?
vvight.wordpress.com
User avatar
FnrrfYgmSchnish
Metal Slime
Posts: 741
Joined: Thu Jun 18, 2009 4:37 am
Location: Middle of Nowhere

Post by FnrrfYgmSchnish »

I don't think you'll have to use a new set of "walk hero"/"set hero direction" commands for every step unless you want each step to have a slight pause before the next one. If I'm remembering right, all you need to do to make a hero walk down several steps while still facing up is to use a single "walk hero" for however many steps you need, then a single "set hero direction" immediately afterward. The game won't try to change the direction again until after that "walk hero" command is finished.
FYS:AHS -- Working on Yagziknian NPC walkabout sprites
User avatar
guo
Metal Slime
Posts: 749
Joined: Fri Dec 04, 2009 9:12 pm

Post by guo »

Muchas gracias.
vvight.wordpress.com
User avatar
pjbebi
Slime Knight
Posts: 112
Joined: Mon Jul 31, 2017 7:22 am
Location: Florida
Contact:

Post by pjbebi »

this is what I did

Code: Select all

variable (d)
d:= hero direction (me)
walk hero (me,d,-1)
wait for hero (me)
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7660
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

Haha! Cool! I did not even realize that a negative walk distance would work like that.

I have added a note about it to the documentation, and added tests for it, so now it is officially supported behavior :)
User avatar
FyreWulff
Slime Knight
Posts: 107
Joined: Wed Mar 13, 2013 9:16 pm
Location: The Internet
Contact:

Post by FyreWulff »

Reminds me of back in the day where if you talked to an NPC that walked in any game, they could walk backwards or sideways from you if you talked to them just at the right time for one more tile. I swear that got fixed at some point?
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7660
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

FyreWulff wrote:Reminds me of back in the day where if you talked to an NPC that walked in any game, they could walk backwards or sideways from you if you talked to them just at the right time for one more tile. I swear that got fixed at some point?
I remember that one! I seem to remember that talking to an enemy would not cancel their move, so it happened all the time.

That was fixed a long time ago, so now talking to them causes them to snap back if they are stepping away

Image
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Bob the Hamster wrote:Haha! Cool! I did not even realize that a negative walk distance would work like that.
Funny, you too? I said the same thing when pjbebi mentioned it a couple weeks ago.
User avatar
SwordPlay
Chemical Slime
Posts: 966
Joined: Sun Jan 22, 2017 9:32 am
Location: London, England
Contact:

Post by SwordPlay »

I'm pretty sure it's always been written in the plotscripting dictionary.
http://hamsterrepublic.com/ohrrpgce/doc ... ut-walknpc

EDIT: Is that recently added? I seem to remember reading it somewhere, at least.
Last edited by SwordPlay on Sat Aug 19, 2017 5:05 pm, edited 1 time in total.
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7660
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

Yep, I added that on the 15th :)
Post Reply