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

Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Sun Feb 17, 2008 1:09 am Post subject: making a battle menu using maptiles |
|
|
I'm making a battle menu using maptiles (see screenshot above) but the problem is that I don't see how to launch the right sub menu.
Here is my screenshot with the battle system I came with so far
Here are the scripts:
To call them I count on re-interpreting the right arrow key and the left one.
Code: |
define script (autonumber, launchmenu, none)
define script (autonumber, leavemenu, none)
define script (autonumber, menu 1, none)
define script (autonumber, menu 2, none)
define script (autonumber, menu 3, none)
define script (autonumber, menu 4, none)
define script (autonumber, menu 5, none)
define script (autonumber, menu 6, none)
define script (autonumber, menu 7, none)
#-------------------------------------------------------
#my on-keypress script
script, on keypress script, begin
if (key is pressed(key: numlock)) then, begin # key is numlock: Pause
while(key is pressed(key: numlock)) do, begin
if (pauseisactive==false) then, begin
pause script
end, else, begin
#thus, pauseisactive must be true
unpaused script
end #end of the first if
end #end for the while
end #end of the second if
if (key is pressed (key:d), and, check tag (tag: battle)) then, begin
while (key is pressed (key:d)) do, begin
if (menuappears==false) then, begin
launch menu
end, else, begin
leave menu
end
end #end for the while
end #end for the if key is pressed
#if (key is pressed (key: space), and, check tag (tag: battle)) then, begin
#while (key is pressed (key: space)) do, begin
#suspend player
#wait(1)
#resume player
#end # end for the while
#end # end for key is pressed space bar
if (key is pressed(key:esc), xor, key is pressed(key:alt)) then, begin # menu is unactivated while battles only
while(keyispressed (key:esc), xor, key is pressed(key:alt)) do, begin
if (check tag (tag: battle)==on) then, begin
suspend player
wait(1)
resume player
end #end for the tag
end #end for the while
end #end for if key is pressed
if (key is pressed (key: up),and, check tag (tag: battle))then, begin #prevents up key from being efficient while battle
while (keyispressed (key: up)) do, begin
suspend player
wait (1)
resume player
end
end
if (key is pressed (key: down),and, check tag (tag: battle))then, begin #prevents down key from being efficient while battle
while (keyispressed (key: down)) do, begin
suspend player
wait (1)
resume player
end
end
end #end of the plotscript here
#----------------------------------------------
script, launchmenu, begin
suspend player
suspend npcs
set variable (tile menu 1, read map block (3,4)) #store previous tiles of the menu
set variable (tile menu 2, read map block (4,4))
set variable (tile menu 3, read map block (5,4))
set variable (tile menu 4, read map block (6,4))
set variable (tile menu 5, read map block (7,4))
set variable (tile menu 6, read map block (8,4))
set variable (tile menu 7, read map block (9,4))
write map block (3,4 ,2) #menu is launched
write map block (4,4 ,3)
write map block (5,4 ,4)
write map block (6,4, 5)
write map block (7,4 ,18)
write map block (8,4, 19)
write map block (9,4, 20)
create npc (9, 9, 6) #cursor to choose player appears
resume player
resume npcs
wait for key (key:d)
menuappears:=true
wait (1)
#set tag (choose menu, on)
end #end of the plotscript
#----------------------------------------------------------------------------
script, leavemenu, begin
set variable (battleX, herox(me))
wait (1)
if (battleX==3) then, begin #menu1
while (battleX==3), do, begin
menu 1
end
end
if (battleX==4) then, begin #menu1
while (battleX==4), do, begin
menu 2
end
end
if (battleX==5) then, begin #menu1
while (battleX==5), do, begin
menu 3
end
end
if (battleX==6) then, begin #menu1
while (battleX==6), do, begin
menu 4
end
end
if (battleX==7) then, begin #menu1
while (battleX==7), do, begin
menu 5
end
end
if (battleX==8) then, begin #menu1
while (battleX==8), do, begin
menu 6
end
end
if (battleX==9) then, begin #menu1
while (battleX==9), do, begin
menu 7
end
end
end #end of the plotscript
#-------------------------------------------------------------------------------
|
My problem is the following, I can't managed to adapt the on-keypress script: I would like that when I move the left or right arrows AND THEN press D my submenu is launched.
As I'm using advanced plotscripting tecnics, feel free to ask as many questions as needed so that you understand precisely what I'm searching for.
Good luck in making your games everybody! _________________ It's time to make games! |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Sun Feb 17, 2008 10:47 pm Post subject: |
|
|
You haven't clearly explained what you are trying to do, how your menu is supposed to work, or what the problem is, so nobody can actually help you. You're not checking the left and right keys anywhere.
Code: | while(keyispressed (key:esc), xor, key is pressed(key:alt)) do, begin |
Use OR, not XOR. XOR is exclusive-or, something different. _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
bis_senchi

Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Tue Feb 19, 2008 2:23 am Post subject: Some more explanations |
|
|
All right here are some more explanation.
The menu functions this way: when you press D a first time the menu appears (like on the screenshot). When you move the arrow keys you can switch from M1 to M2 (and then eventually to M3)
If you press D a second time, you enter the sub menu. Let's say that M3 is the item menu then you'll see a list of the items you can use while battle (like battle).
My problem is the following, I don't see how to call sub-menu after D is pressed a second time because I can't put on plotscript language "if M3 is selected, then go to the item menu".
I also have to think about how to unactivate the arrow keys after D have been press a second time.
If you still have questions about this feel free to ask!
As always thanks for answering so quickly! _________________ It's time to make games! |
|
Back to top |
|
 |
Gizmog1 Don't Lurk In The Bushes!

Joined: 05 Mar 2003 Posts: 2257 Location: Lurking In The Bushes!
|
Posted: Tue Feb 19, 2008 12:38 pm Post subject: |
|
|
I'm not sure I fully understand, but, if you're using an NPC of some kind to be the cursor, and mapblocks to be the menu buttons, you could use readmapblock to figure out where the cursor is. If the cursor appears beneath the button you want to press, you'd want to check a tile above the cursor. That'd work like
Code: | if (readmapblock (NPCX (Cursor)-1,NPCY (Cursor))==WhateverTileM3 is) then (WhateverTheHeckM3Does)
|
NPCX (Cursor)-1 checks to see what's one spot above the cursor. If the cursor's above the menubutton, change it to +1 instead, to check beneath.
You'll have to find the value you want for WhateverTileM3 is by going into the Tile Graphic editor, and counting left to right until you're at the M3 tile. The first line is 0-15, second line 16-31, and so on.
You could do the same thing for all of the buttons. Everytime you pressed D, it could see what menu button it was pointing at, and then execute the proper menu. |
|
Back to top |
|
 |
bis_senchi

Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Wed Feb 20, 2008 8:06 am Post subject: Well it seems to be a good idea but... |
|
|
It seems to be a good idea but I already use an npc (npc 9) to indicate which hero is selected (it's the big yellow cursor in front of the hero dressed in white)
But there is enough free npcs left so I guess I could use another one. The question is now why so should I put after the follwoing code
Code: |
if (key is pressed(key:right),and, check tag (tag: battle)) then, begin
while (keyispressed (key:right) do, begin
if (readmapblock (NPCX (Cursor)-1,NPCY (Cursor))==WhateverTileM3 is) then (WhateverTheHeckM3Does)
end #end for the while
end #end for the if
|
I hope that there are not too many ifs in this code!
A cursor moves a specific way and there's also the cursor animation that has to be taken in account. This last part should be easier because there is an article in the wiki that explains how to animate npcs)
Good luck! _________________ It's time to make games! |
|
Back to top |
|
 |
Chenzi User was banned for this post

Joined: 02 Aug 2003 Posts: 190 Location: Grand Rapids, MI
|
Posted: Thu Feb 21, 2008 6:01 pm Post subject: |
|
|
I demand better graphics for Sanzo. _________________ Allow me to preemptively disclose that I probably hate the person posting below, including myself. |
|
Back to top |
|
 |
bis_senchi

Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Sat Feb 23, 2008 11:20 pm Post subject: Don't worry those are only the basic grafics! |
|
|
You have guessed that it was the battle system for my Saiyuki Game!
Don't worry! Those are only the basic grafics! I will all remake them when the gameplay will be implemented! If you have any suggestions, please put them here!
Good luck in making your games everybody! _________________ It's time to make games! |
|
Back to top |
|
 |
bis_senchi

Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Sun Mar 09, 2008 2:09 am Post subject: Error message in my hsd file. |
|
|
When I compile my game I get the following message:
Hspeak wrote: |
warning: in line 507 of script inputstring" in plotscr.hsd
variable (done, key, show, c)
c is never used
|
As explained in the message the error comes from plotscr.hsd. Does somoene see what to do about this?
As always thanks in advance for your help! _________________ It's time to make games! |
|
Back to top |
|
 |
Onlyoneinall Bug finder
Joined: 16 Jul 2005 Posts: 746
|
Posted: Sun Mar 09, 2008 2:31 am Post subject: |
|
|
Yeah, it doesn't seem to affect your scripts, but I think it's a typo in the .hsd file that one of the programmers left perhaps from editing. I think it should have been fixed by now though... are you using the most recent .hsd file? _________________ http://www.castleparadox.com/gamelist-display.php?game=750 Bloodlust Demo 1.00
 |
|
Back to top |
|
 |
bis_senchi

Joined: 08 Jun 2004 Posts: 460 Location: Reims, France
|
Posted: Sun Mar 09, 2008 10:53 pm Post subject: Still go with the same problem! |
|
|
I've downloaded the hsd files that comes with the WIP and the problem have been solved. I no longer have the error. I'm still working on my battle menu system and I have problems with on keypressscript
Code: |
if (key is pressed(key: numlock)) then, begin # key is numlock: Pause
while(key is pressed(key: numlock)) do, begin
if (pauseisactive==false) then, begin
pause script
end, else, begin
#thus, pauseisactive must be true
unpaused script
end #end of the first if
end #end for the while
end #end of the second if
if (key is pressed (key:d), and, check tag (tag: battle)) then, begin #tag battle on tag menu launched off
if (check tag (tag: menu launched)==off) then, begin
launch menu
end, else, begin # if tag is on then begin
suspend npcs
set variable (CursorX, (npcx, 11))
set variable (CursorY, (npcy, 11))
wait (5)
if (CursorX ==3) then, begin
menu 1
end
if (CursorX ==4) then, begin
menu 2
end
if (CursorX ==5 ,and, CursorY ==4) then, begin
menu 3
end
if (CursorX ==6 ,and, CursorY ==4) then, begin
menu 4
end
if (CursorX ==7 ,and, CursorY ==4) then, begin
menu 5
end
if (CursorX ==8 ,and, CursorY ==4) then, begin
menu 6
end
if (CursorX ==9 ,and, CursorY ==4) then, begin
menu 7
end
resume npcs
end #end for the if check tag
end #end for the if key is pressed
if (key is pressed (key: space), and, check tag (tag: battle)) then, begin
while (key is pressed (key: space)) do, begin
suspend player
wait(1)
resume player
end # end for the while
end # end for key is pressed space bar
if (key is pressed(key:esc), xor, key is pressed(key:alt)) then, begin # menu is unactivated while battles only
while(keyispressed (key:esc), xor, key is pressed(key:alt)) do, begin
if (check tag (tag: battle)==on) then, begin
suspend player
wait(1)
resume player
end #end for the tag
end #end for the while
end #end for if key is pressed
if (key is pressed (key: up),and, check tag (tag: battle))then, begin #prevents up key from being efficient while battle
while (keyispressed (key: up)) do, begin
suspend player
wait (1)
resume player
end
end
if (key is pressed (key: down),and, check tag (tag: battle))then, begin #prevents down key from being efficient while battle
while (keyispressed (key: down)) do, begin
suspend player
wait (1)
resume player
end
end
if (key is pressed (key: left),and, check tag (tag: battle)) then, begin #tag battle on tag menu launched off
if (check tag (tag: menu launched)==off) then, begin
suspend player
wait (1)
resume player
end, else, begin # if tag is on then begin
resume player
set variable (CursorX, (npcx, 11))
set variable (CursorY, (npcy, 11))
wait (5)
if (readmapblock (CursorX, CursorY)== 2) then, begin
set npc position (11, 9, 4)
end
if (readmapblock (CursorX, CursorY)== 3) then, begin
set npc position (11, 3, 4)
end
if (readmapblock (CursorX, CursorY)== 4) then, begin
set npc position (11, 4, 4)
end
if (readmapblock (CursorX, CursorY)== 5) then, begin
set npc position (11, 5, 4)
end
if (readmapblock (CursorX, CursorY)== 18) then, begin
set npc position (11, 6, 4)
end
if (readmapblock (CursorX, CursorY)== 19) then, begin
set npc position (11, 7, 4)
end
if (readmapblock (CursorX, CursorY)== 20) then, begin
set npc position (11, 8, 4)
end
resume player
resume npcs
end #end for the menu launched tag
end
if (key is pressed (key: right),and, check tag (tag: battle))then, begin #make moves the cursor toward right
if (check tag (tag: menu launched)==off) then, begin
suspend player #do nothing
wait (1)
resume player
end, else, begin # if tag is on then begin
resume player
set variable (CursorX, (npcx, 11))
set variable (CursorY, (npcy, 11))
wait (5)
if (readmapblock (CursorX, CursorY)== 3) then, begin
set npc position (11, 4, 4)
end
if (readmapblock (CursorX, CursorY)== 4) then, begin
set npc position (11, 5, 4)
show value (1)
end
if (readmapblock (CursorX, CursorY)== 5) then, begin
set npc position (11, 6, 4)
end
if (readmapblock (CursorX, CursorY)== 6) then, begin
set npc position (11, 7, 4)
end
if (readmapblock (CursorX, CursorY)== 7) then, begin
set npc position (11, 8, 4)
end
if (readmapblock (CursorX, CursorY)== 8) then, begin
set npc position (11, 9, 4)
end
if (readmapblock (CursorX, CursorY)== 9) then, begin
set npc position (11, 3, 4)
end
resume npcs
resume player
end #end for if check tag
end #end for the if key is pressed
end #end of the plotscript here
|
I've tried with the line "if read mapblock then...) but it doesn't work. I also tried with a previous stored location and it still doesn't work. My problem is still the same. I'm using Npc 11 as cursor and I would like to make it move using arrows.
I also would like that when D is pressed and if the menu has been previously launched the script will check where the cursor is and launch the appropriate menu screen after checking.
All the suggestions are welcomed! As always thanks very much for the help and for answering so quickly! _________________ It's time to make games! |
|
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
|