View previous topic :: View next topic |
Author |
Message |
PK-Gamer Currently making an RPG
Joined: 11 Jan 2013 Posts: 23 Location: MD
|
Posted: Mon Jan 20, 2014 8:23 am Post subject: Creating a revival shop/Main Menu scripting |
|
|
Hi all,
I'm trying to create a shop that revives allies. Basically, the npc asks who needs to be revived and the player choose the ally that needs to be revived.
And for the allies that are alive that are selected a message needs to come up saying, "this person is already alive."
Is this possible to be created.
Last edited by PK-Gamer on Tue Jan 21, 2014 9:53 am; edited 1 time in total |
|
Back to top |
|
|
Bob the Hamster OHRRPGCE Developer
Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Mon Jan 20, 2014 8:34 am Post subject: |
|
|
Hello! Yes, this is possible. You can't do this with the built-in shops, but you can do it with a plotscript. Here is a simple plotscript that should do the job
Code: |
plotscript, revive allies, begin
show text box(1) # Who do you wish to revive?
wait for text box
variable(slot)
slot := pick hero
if(slot == -1) then(
# The player canceled
show text box(1) # Perhaps another time.
wait for text box
exit script
)
variable(hp)
hp := get hero stat(slot, stat:HP, current stat)
if(hp > 0) then(
# Already alive
show text box(2) # This one is not in need of my services
wait for text box
exit script
)
show text box(3) # Now I shall perform the rites of revivification!
wait for text box
hp := get hero stat(slot, stat:HP, maximum stat)
set hero stat(slot, stat:HP, hp, current stat)
end
|
If you want an explanation of how the script works line-by-line, just let me know. |
|
Back to top |
|
|
PK-Gamer Currently making an RPG
Joined: 11 Jan 2013 Posts: 23 Location: MD
|
Posted: Tue Jan 21, 2014 9:54 am Post subject: |
|
|
Thanks Bob!
I also had another question (I don't want to create new thread after thread...)
Is there a way for the player not to open the main menu? As in somewhere in a plotscript it prevents the player to not open the main menu while playing and in another plotscript, it makes the player able to open the main menu again? |
|
Back to top |
|
|
Bob the Hamster OHRRPGCE Developer
Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Tue Jan 21, 2014 11:23 am Post subject: |
|
|
If you are using the nightly WIP builds, then scripting this is super-easy.
Code: |
plotscript, menu handler, begin
if(check tag(tag:menu disabled) == false) then(
main menu
)
end
|
Then you go to "Edit General Game Data" -> "Special Plotscripts" and set "Menu-Action plotscript:" to the "menu handler" script.
If you are using the beelzebufo stable release it is still possible to script a feature like this, but it is a lot more complicated. If you want to stick with the stable release, let me know and I can explain the other method. |
|
Back to top |
|
|
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
|
Back to top |
|
|
|