 |
Castle Paradox
|
View previous topic :: View next topic |
Author |
Message |
Namyak

Joined: 27 Jan 2003 Posts: 12 Location: NEPA
|
Posted: Tue Oct 04, 2005 9:04 pm Post subject: Major Conundrum |
|
|
While attempting to regain what little plotscripting ability I once had, I decided to take a fresh stab at something I've been trying to do, which is have two concurrent parties that a player can switch between on the fly. The only problem is, the script I was attempting to do this with has the nasty side-effect of freezing the game whenever it's running... here's the script
Code: |
include, plotscr.hsd
include, battltet.hsi
define constant, begin #defining the switch party member keys
44, key_z
end
define script (1, Cycle Between Parties,none)
script, Cycle Between Parties, begin
variable (whichkey)
variable (Party 1 X)
Variable (Party 1 Y)
variable (Party 2 X)
variable (Party 2 Y)
variable (ConParty)
set variable (whichkey, 0)
set variable (Party 1 X, 0)
set variable (Party 1 Y, 0)
set variable (Party 2 X, 4)
set variable (Party 2 Y, 4)
set variable (ConParty, 0)
while (whichkey == 0) do
(
if (keyispressed (key_z)) then
(setvariable (whichkey, 1))
)
if (whichkey==1) then (setvariable (ConParty, 1))
if (conparty ==1) then (setvariable (Party 1 X,hero X (0)))
if (conparty ==1) then (setvariable (Party 1 Y,hero Y (0)))
#set the location of the first party
if (whichkey==1) then
(swap out hero (0))
(swap out hero (1))
(swap out hero (2))
(swap in hero (4))
(swap out hero (3))
(swap in hero (5))
(swap in hero (6))
(swap in hero (7))
#swap out the first party for the second party
set NPC position (0, Party 1 X, Party 1 Y)
#put a NPC to represent the party
set hero position (me, Party 2 X, Party 2 Y)
#teleport the new party to where it's supposed to be
set variable (whichkey, 0)
set variable (ConParty, 2)
#will restart it
while (whichkey == 0) do
(
if (keyispressed (key_z))
then (setvariable (whichkey, 1))
)
if (whichkey==1) then (setvariable(ConParty, 2))
if (conparty==2) then (setvariable (Party 2 X, hero X (4)))
if (conparty==2) then (setvariable (Party 2 Y, hero Y (4)))
#set the location of the second party
if (whichkey==1) then
(swap out hero (4))
(swap out hero (5))
(swap out hero (6))
(swap in hero (0))
(swap out hero (7))
(swap in hero (1))
(swap in hero (2))
(swap in hero (3))
#swap out the second party for the first party
set NPC position (1, Party 2 X, Party 2 Y)
#put a NPC to represent the party
set hero position (me, Party 1 X, Party 1 Y)
#teleport the new party to where it's supposed to be
end
|
there it is... any help would be appreciated, especially since like I said I was never too handy with plotscripting to begin with... I'm not sure if I'm attempting something impossible or not.
Thank you in advance
-Namyak |
|
Back to top |
|
 |
Mike Caron Technomancer

Joined: 26 Jul 2003 Posts: 889 Location: Why do you keep asking?
|
Posted: Tue Oct 04, 2005 9:18 pm Post subject: |
|
|
1. Why do you use setvariable instead of := ? Not a biggie, but...
2. How is this called? Are you sure it's this script, or is it a script calling this that freezes, or maybe calls this one repeatedly?
3. How does it freeze? Does it just lock up the OHR, or does it just not work?
To make sure it's this script, and to figure out where it freezes, you should insert "trace" commands, like such:
Code: | show value(0)
#do something
show value(1)
#do something else
show value(2)
#do something dangerous
show value (3) |
If it freezes, and "2" is on screen, then it must have been "something dangerous" that blowed up. _________________ I stand corrected. No rivers ran blood today. At least, none that were caused by us.
Final Fantasy Q
OHR Developer BLOG
Official OHRRPGCE Wiki and FAQ |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Tue Oct 04, 2005 11:12 pm Post subject: Re: Major Conundrum |
|
|
It is freezing in these two while loops:
Code: |
while (whichkey == 0) do
(
if (keyispressed (key_z)) then
(setvariable (whichkey, 1))
)
|
Change each one to
Code: |
while (whichkey == 0) do
(
if (keyispressed (key_z)) then
(setvariable (whichkey, 1))
wait
)
|
Anyway, unless you only want to be able to switch between each party once, you will want to put the whole lot inside a while loop. You will have to work out an exit to this loop if you do so.
As an aside, Pepsi Ranger made a tech demo with this ability which included the scripts. _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
Namyak

Joined: 27 Jan 2003 Posts: 12 Location: NEPA
|
Posted: Wed Oct 05, 2005 7:09 am Post subject: Thank you |
|
|
Thank Cacti... that seemed to be the problem... and with Pepsi Ranger's script as a guide, I'll probably be able to implement the rest of what I want to without any more trouble... thank you both.
-Namyak |
|
Back to top |
|
 |
Mr B
Joined: 20 Mar 2003 Posts: 382
|
Posted: Wed Oct 05, 2005 8:47 am Post subject: |
|
|
I know that this seems to be solved, but I thought that I'd mention this anyway.
I had a similar problem working on PB2. It turned out that I had a non-terminating "on-load-map" script for each map. When I switched to a different map, the party swap script would get put on the backburner and never finish.
Just something to look out for. |
|
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
|