 |
Castle Paradox
|
View previous topic :: View next topic |
Author |
Message |
Master K Ex-Akatsuki Masked Ninja

Joined: 11 Jun 2011 Posts: 57 Location: Everywhere and Nowhere. Muahaha!
|
Posted: Wed Jun 22, 2011 11:03 am Post subject: Party Plight |
|
|
So, heres my problem.
I'm going to have an optional hero available. This hero has no significance to the story, except for battling. This hero is not human, more or less a pet. I don't want him to be able to be put anywhere but the fourth slot, that way slots 3 and up can be used for talking heroes. I don't want this pet to be able to be in slots 2, 3 or be leader.
Its really tough and confusing for me, but I do want it in my game. How could I switch it out in significant plot places, but yet have the choice to add him to battle for a boss battle, then have him taken out after battle and replaced with a plot significant hero? |
|
Back to top |
|
 |
mswguest Guest
|
Posted: Wed Jun 22, 2011 1:56 pm Post subject: |
|
|
In custom, under Edit General Game Data, Preference Bitsets, there is a bitset you want: "Locked Heroes Can't Be Reordered". Then whenever the 'pet' is in the party, lock it. This will take care of any places where the 'pet' is handled by scripts (plot points).
On the other hand, if you want the player to have the option to put the pet in the party, but ONLY in the 4th slot (don't forget this is slot 3, since slot 0 is the leader's slot), then we will have to get clever. I'm envisioning something along the following lines:
*The normal party menu is not used for the 'pet', ever
*Thus, the pet is always locked
*A separate menu entry (this will require customizing the main menu) allows the player to 'activate/deactivate' the pet
*If the pet is currently in the party, this new menu entry simply removes it
*If the pet is not currently in the party, this new menu entry asks the player which hero he would like to remove to allow the pet in, and leads to a script that:
1)checks to make sure that the player is not trying to swap out a truly locked hero
2)swaps the pet and the hero chosen by the player to be swapped out
3)swaps the pet and whatever hero is in the 4th slot
There may be more to this that I'm not thinking of at the moment, but that would be the gist of it. Does this sound like what you want? If so, we can help you accomplish it.
If this seems overly complicated, there is a less polished alternative. You could simply have a script that runs any time the menu closes, checks to see if the pet is in the party, and if so swaps it into the 4th slot. The thing about this is that the player will be able to freely move the pet wherever he likes without knowing that it will be swapped to the 4th slot; also, it may be confusing to the player if the silent swap changes the order of his other characters (although we can probably think of a way to avoid that, if we're clever). |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Wed Jun 22, 2011 3:52 pm Post subject: |
|
|
Msw's suggestions are good.
To avoid confusion, remember that the slots are numbered like this:
0
1
2
3 |
|
Back to top |
|
 |
Master K Ex-Akatsuki Masked Ninja

Joined: 11 Jun 2011 Posts: 57 Location: Everywhere and Nowhere. Muahaha!
|
Posted: Fri Jun 24, 2011 5:40 pm Post subject: |
|
|
Ah, so the pet gets put into the third slot, and then locked. That way, heroes can be reordered, but not into the third slot. Perfect.
Quote: | *The normal party menu is not used for the 'pet', ever
*Thus, the pet is always locked
*A separate menu entry (this will require customizing the main menu) allows the player to 'activate/deactivate' the pet
*If the pet is currently in the party, this new menu entry simply removes it
*If the pet is not currently in the party, this new menu entry asks the player which hero he would like to remove to allow the pet in, and leads to a script that:
1)checks to make sure that the player is not trying to swap out a truly locked hero
2)swaps the pet and the hero chosen by the player to be swapped out
3)swaps the pet and whatever hero is in the 4th slot |
I'm going to customize the menu. What kind of a script would I need for the quoted idea? |
|
Back to top |
|
 |
mswguest Guest
|
Posted: Wed Jul 13, 2011 1:28 pm Post subject: |
|
|
Okay, here we go:
step 1 - write, compile, and import the script "Add or Remove Pet", described below
step 2 - new menu item on main menu, named "Add/Remove Pet" or something similar
step 3 - have this new "Add/Remove Pet" menu item set to call the script "Add or Remove Pet", and also close the menu when selected (I think)
Here's the script, with some comments to help understand what's going on:
Code: | plotscript, Add or Remove Pet, begin
variable(PET, HEROSWITCH)
PET:=find hero ( the hero ID number of the pet should go here )
#we have now set the variable PET to represent the slot that the pet is currently in
if (PET==3), then #if the pet is already in the party
begin
swap out hero ( the hero ID number of the pet )
#if you wish, you may call the team menu here
#along with a text box explaining to the player that he
#can now choose a hero from the reserves to
#take the place of the pet
show text box ( the ID of a text box saying "Mr. Pet went back to the kennel" )
end
else #otherwise, the pet was not already in the party
begin
show text box ( the ID of a text box saying "What hero will go into the
reserve in favor of the pet?" )
wait for text box
HEROSWITCH:=pick hero #setting HEROSWITCH to be the position
#of the hero to be removed, or -1 if player cancelled
#I am not sure how to check if a hero is locked. (developers?)
#Basically we need to make sure that if the player
#picks a locked hero, then we tell him that this hero
#cannot be removed, and then change HEROSWITCH to -1
#to make it as if the player did not pick anyone
#ie if(HEROSWITCH is locked),then
# begin
# show text box ( "ERROR - he stays" )
# wait for text box
# HEROSWITCH:=-1
# end
if(HEROSWITCH<>-1), then
begin
swap by position (HEROSWITCH,PET)
swap by position (PET,3)
end
end
end |
All of this is untested, but if you give it a try we can help you debug it. |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Wed Jul 13, 2011 8:38 pm Post subject: |
|
|
There's no command to check whether a hero is locked. That ought to be added.
The last part of that script should read:
Code: | if(HEROSWITCH<>-1), then
begin
swap by position (HEROSWITCH,3)
swap by position (PET,3)
end |
Also, you could skip the "pick hero" if there's already room in the party. For example:
Code: |
plotscript, Add or Remove Pet, begin
variable(PET, HEROSWITCH)
PET:=find hero ( the hero ID number of the pet should go here )
#we have now set the variable PET to represent the slot that the pet is currently in
if (PET==3) then #if the pet is already in the party
begin
swap out hero ( the hero ID number of the pet )
#if you wish, you may call the team menu here
#along with a text box explaining to the player that he
#can now choose a hero from the reserves to
#take the place of the pet
show text box ( the ID of a text box saying "Mr. Pet went back to the kennel" )
end
else #otherwise, the pet was not already in the party
begin
if (room in active party >> 0) then
begin
swap in hero ( the hero ID number of the pet )
PET := find hero ( the hero ID number of the pet )
swap by position (PET, 3)
end
else
begin
show text box ( the ID of a text box saying "What hero will go into the
reserve in favor of the pet?" )
wait for text box
HEROSWITCH:=pick hero #setting HEROSWITCH to be the position
#of the hero to be removed, or -1 if player cancelled
#I am not sure how to check if a hero is locked. (developers?)
#Basically we need to make sure that if the player
#picks a locked hero, then we tell him that this hero
#cannot be removed, and then change HEROSWITCH to -1
#to make it as if the player did not pick anyone
#ie if(HEROSWITCH is locked),then
# begin
# show text box ( "ERROR - he stays" )
# wait for text box
# HEROSWITCH:=-1
# end
if(HEROSWITCH<>-1) then
begin
swap by position (HEROSWITCH,3)
swap by position (PET,3)
end
end
end
end |
_________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
mswguest Guest
|
Posted: Thu Jul 14, 2011 4:58 am Post subject: |
|
|
Just out of curiosity, can you explain to me why you changed the swapping at the end of the script? I don't understand why my way would ever fail. |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Thu Jul 14, 2011 5:55 am Post subject: |
|
|
After the first swap the PET slot contains the hero that you're trying to swap out. So the second swap swaps it back in, in slot 3. _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
mswguest Guest
|
Posted: Thu Jul 14, 2011 10:50 am Post subject: |
|
|
Right, PET hold the pet's original spot and doesn't get updated after the first swap. I'm an idiot. |
|
Back to top |
|
 |
Master K Ex-Akatsuki Masked Ninja

Joined: 11 Jun 2011 Posts: 57 Location: Everywhere and Nowhere. Muahaha!
|
Posted: Thu Jul 14, 2011 8:55 pm Post subject: |
|
|
Tested the original pet script. It seemed to work...but, I would rather it swap out hero 3 automatically. I tested it with just the pet and a hero, and if theres only one party member, you have to pick the other. Glitchy!
Also, when adding the pet for the first time, how shall I make sure it goes to the fourth slot and stays there?
And, for important plot parts, how would I switch out heroes for plot relevant heroes, like in VoM?
Finally, How would I bring up the team menu at plot relevant points, and make sure when the hero uses one menu, the plot doesn't continue until all menu functions are done? For example, the team screen is two options. One is the actuall team screen, the other activates the pet. How would I resolve that plight? |
|
Back to top |
|
 |
mswguest Guest
|
Posted: Fri Jul 15, 2011 5:21 am Post subject: |
|
|
Another quick reply.
You should use TMC's version of the script; he had already noticed possible bugs with mine, AND he takes care of your cases with less than a full party by skipping the "pick hero" part if there's already room in the party.
When adding the pet for the first time, simply:
Code: | add hero (hero:pet)
swap by position ( findhero(hero:pet) , 3 )
lock hero (hero:pet)
|
There's still the problem of: what if hero3 is supposed to be locked in the party? This problem will remain unresolvable until we have a command to check hero locks.
When a certain hero needs to be in the party for a certain plot point, the easiest thing to do is probably:
Code: | swap by position ( findhero(hero:required1) , 0 )
swap by position ( findhero(hero:required2) , 1 )
... |
This will make all required heroes take up slots 0 through whatever, depending on how many you need. If the required heroes were already in the party, then they'll simply be re-ordered. If you want to avoid reordering, this is a much more complicated task I believe.
I hope this helped! |
|
Back to top |
|
 |
mswguest Guest
|
Posted: Fri Jul 15, 2011 11:15 am Post subject: |
|
|
As for your final question, you do have access to the command "wait for menu (menu handle)", that works like so:
Code: | variable(first menu, second menu)
first menu := openmenu(team menu)
second menu := openmenu(pet menu)
wait for menu (first menu)
wait for menu (second menu)
|
|
|
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
|