 |
Castle Paradox
|
View previous topic :: View next topic |
Author |
Message |
kgenly
Joined: 13 Jun 2007 Posts: 5
|
Posted: Wed Jun 13, 2007 3:15 am Post subject: Edit: Now all new bizarre errors, unrelated to "while&q |
|
|
First time poster! Apologies if this has been answered somewhere, I can't seem to find what I'm looking for.
The scene is this: Two heroes walk into a castle and enter into a heated discussion with the guards. Simultaneously, in the background, a seemingly insignificant NPC is walking back and forth talking (really just nodding back and forth) to other, uninvolved guards. At a crucial moment the seemingly insignificant NPC breaks out of his walking and talking loop and intervenes in the argument that the heroes are having.
I want the NPC to move smoothly and continually in the background on his scripted path, despite all "wait for textbox" commands related to the heroes' conversation. Likewise, I want his "wait for NPC" commands to not interfere with the actions and textboxes of the action in the foreground.
It seems to me as if the best way to achieve this is with a "while" command. My script looks sort of like this:
Code: | while (check tag(9)) do (walk, wait, talk, wait)
show textbox (blahblahblah)
wait for textbox
show textbox (blahblahblah)
wait for textbox
show textbox (blahblahblah)
wait for textbox
set tag (9,off) |
But it seems that it never moves past the while command, because it is always true. The only solution I can think of is to pluck the while command out of this script and put it in a second, and then call that script to run simultaneously until the tag is turned off, but I am not entirely sure that it is possible to have two scripts running at the same time or if the second will pause the first.
Hopefully the solution is something very simple I am failing to understand.
Thanks for any and all help!
Last edited by kgenly on Fri Jun 15, 2007 8:08 am; edited 1 time in total |
|
Back to top |
|
 |
msw188
Joined: 02 Jul 2003 Posts: 1041
|
Posted: Wed Jun 13, 2007 7:02 am Post subject: |
|
|
Scripted movement of more than one thing at a time is VERY difficult, but if your heroes heated discussion involves nothing but textboxes, then I think this can be done fairly easily.
First, instead of having all the show text box commands scripted, simply connect all of these text boxes to each other in custom. Have the last text box before the new NPC comes over set to turn on tag 9. Then use the same sort of while loop, like so:
Code: | show text box (the first text box of their conversation)
#no wait here!!!
while(checktag(9)), do
begin
#back and forth walking and talking and so forth
end
#walk the NPC over to the heroes |
If you want the NPC to wait for the player to finish reading that 'last' text box (the one triggering tag 9), just put a wait for text box command directly after the end of the while loop. _________________ My first completed OHR game, Tales of the New World:
http://castleparadox.com/gamelist-display.php?game=161
This website link is for my funk/rock band, Euphonic Brew:
www.euphonicbrew.com |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Wed Jun 13, 2007 8:09 am Post subject: |
|
|
This problem sounds like it would be much easier to deal with if you use the new 'plot:set timer' command. It is only available in the nightly 'WIP' builds.
You use a timer-triggered script to control the NPC's pacing, and write your regular script without worrying about him any more than to start the timer script at the beginning, and disable it when the pacing NPC joins the conversation. |
|
Back to top |
|
 |
kgenly
Joined: 13 Jun 2007 Posts: 5
|
Posted: Fri Jun 15, 2007 7:31 am Post subject: |
|
|
Thanks all, this was very helpful.
I now have another, unrelated problem, in the same script, that I cannot understand for the life of me.
When the script begins, I turn on caterpillar mode and have the two heros "come out" of each other as they do in Final Fantasy 6. It looks like this:
Code: |
variable (originalleader)
set variable (originalleader,hero by slot (0))
variable (originalsecond)
set variable (originalsecond,hero by slot (1))
set tag (8,on)
pan camera (north,1)
set caterpillar mode (on)
suspend caterpillar
set hero position (originalsecond,herox(me), heroy(me))
walk hero (originalleader, up, 1)
walk hero (originalsecond, down, 1)
wait for hero
wait for hero |
But for some reason, no matter what order the heroes were in originally, it always treats Stephy as the hero in slot 0. If Kim is in slot 0, the whole script behaves REALLY strangely. Stephy always goes up, Kim always goes down, but if Kim was in fact the original leader there is one particular error where they suddenly teleport to an entirely different map. There's a door that they walk over in this script, but it is set to only work if tag 8 is off - tag 8 is turned on at the very beginning of the script, before anybody touches the door. This particular door, even when enabled, is linked to a door on the same map, not on the other side of the earth, so I have no idea what's going on. Another error that happens the other half of the time is that Stephy suddenly looks like a Kim twin, but there is no code here that would change her graphic.
I thought maybe find "hero by rank" would work better than "slot", but both commands yield exactly the same errors. Ideas? |
|
Back to top |
|
 |
Uncommon His legend will never die

Joined: 10 Mar 2003 Posts: 2503
|
Posted: Fri Jun 15, 2007 8:19 am Post subject: |
|
|
Man, I did something like this in my first game. If I hadn't lost the scripts years ago, I could just show you how I did it then, but it wasn't that hard from what I remember.
Now, apparently you want to move them by their rank in the caterpillar, so the problem is, I think the whole variable deal you've got there. See, hero by slot returns the hero's number. Walk hero runs on the rank in caterpillar already, so what the variables are doing is confusing the information. So cut out everything those four lines before you set the tag and replace all instances of "originalleader" with 0 or "me" as you've been using elsewhere, and all instances of "originalsecond" with 1 and the movement should be smoother.
As for the door, lemme guess. It's door zero on this map, right? But this map isn't map zero, is it? The problem is all the default door links, they all say "Door 0 links to door 0 on map 0" until you come in and change them, so my bet is that's where the door's sending you, especially when tag 8 is on.
They really need to do something about that, it might be nice once per game, but it's more a nuisance. |
|
Back to top |
|
 |
kgenly
Joined: 13 Jun 2007 Posts: 5
|
Posted: Fri Jun 15, 2007 8:24 am Post subject: |
|
|
Wow, thanks for the fast reply. I think I understand the confusion now. I'll give that a try. |
|
Back to top |
|
 |
Moogle1 Scourge of the Seas Halloween 2006 Creativity Winner


Joined: 15 Jul 2004 Posts: 3377 Location: Seattle, WA
|
Posted: Fri Jun 15, 2007 9:14 am Post subject: |
|
|
I assume you haven't posted the whole script, but if you want to make the heroes walk back into each other, make sure you suspend passability for the heroes. Don't forget to set caterpillar mode off afterward, though you don't need to resume caterpillar unless you ever use that functionality. _________________
|
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Sat Jun 16, 2007 12:30 am Post subject: |
|
|
All commands involving the heroes as they are on the map refer to them by their rank in the caterpillar party. (Which isn't the same thing as their rank in the battle party)
'plot:Wait for hero' only waits for a single hero. You probably meant
Code: | wait for hero (0)
wait for hero (1) |
_________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|