 |
Castle Paradox
|
View previous topic :: View next topic |
Author |
Message |
Big M The one..the only Big M
Joined: 01 Sep 2006 Posts: 6 Location: Australia
|
Posted: Fri Sep 01, 2006 8:52 pm Post subject: How can I do this.. |
|
|
Okay..so my game starts on an island in the middle of the ocean. The person's boat (his name is Wap) is wrecked. I need to know how to code/tag it so that when Wap gets 11 Technical points (default was MP) he can repair the ship and sail away in it (I've alreay created the ship vehicle etc. I just need to know how to do the above)
I'm very sorry if this is the wrong forum to put it in but I'm new here so yeah.
Please help me! _________________
Quote: | If "Yes", rockin'. If "Yes, but we don't want to do it", send me a message and I'll see if I can contribute. If "No", well, then piss off. ;P |
- |
|
Back to top |
|
 |
Moogle1 Scourge of the Seas Halloween 2006 Creativity Winner


Joined: 15 Jul 2004 Posts: 3377 Location: Seattle, WA
|
Posted: Fri Sep 01, 2006 9:51 pm Post subject: |
|
|
This is a fine place to put it. It will require plotscripting, so maybe the plotscripting help forum would be better, but you may not have known it.
The easiest way to do this is by making a boat NPC that you can "talk to" to attempt to repair it. Make an NPC that looks like a boat. Go to the Plotscripting menu in CUSTOM and select "Export HSI." Then make a plotscript file:
Code: | include, plotscr.hsd
include, gamename.hsi #this should be your game name, not "gamename"
define script (1,repair boat,none)
script, repair boat, begin
if (get hero stat(me,stat:Technical Points,current stat)>=11) then
(
display text box (123) #make a text box that fixes the boat
)
else
(
display text box (456) #text box that says you need more tech pts
)
end |
Then make the textboxes as suggested above and replace 123 and 456 with the actual text box numbers.
If you need more details please ask! _________________
|
|
Back to top |
|
 |
Big M The one..the only Big M
Joined: 01 Sep 2006 Posts: 6 Location: Australia
|
Posted: Fri Sep 01, 2006 11:54 pm Post subject: |
|
|
Is the plotscripting menu the script management menu? Because when I press export.hsi it just says :
exporting HamsterSpeak Definitions to:
C:\OHRRPGCE\wap2006.hsi
tag names
song names
hero names
item names
stat names
slot names
map names
attack names
shop names
done
Then when I press any key it goes back to the Script Mnagement menu.
What do I do?? _________________
Quote: | If "Yes", rockin'. If "Yes, but we don't want to do it", send me a message and I'll see if I can contribute. If "No", well, then piss off. ;P |
- |
|
Back to top |
|
 |
Onlyoneinall Bug finder
Joined: 16 Jul 2005 Posts: 746
|
|
Back to top |
|
 |
Moogle1 Scourge of the Seas Halloween 2006 Creativity Winner


Joined: 15 Jul 2004 Posts: 3377 Location: Seattle, WA
|
Posted: Sat Sep 02, 2006 12:11 am Post subject: |
|
|
Right. It might help you to take a look at the HSI file it generated. It is basically just assigning a number value to every piece of your game. Those numbers are substituted in when you make your scripts. You could use those numbers instead, but it's easier to read when it says something like "stat:HP" rather than a bare number. _________________
|
|
Back to top |
|
 |
Big M The one..the only Big M
Joined: 01 Sep 2006 Posts: 6 Location: Australia
|
Posted: Sat Sep 02, 2006 12:28 am Post subject: |
|
|
So, in that hsi file that it created, is that where I write this:
Code:
include, plotscr.hsd
include, gamename.hsi #this should be your game name, not "gamename"
define script (1,repair boat,none)
script, repair boat, begin
if (get hero stat(me,stat:Technical Points,current stat)>=11) then
(
display text box (123) #make a text box that fixes the boat
)
else
(
display text box (456) #text box that says you need more tech pts
)
end
Do I write that in there? Or a separate document?
(sorry, I'm completely new to this...) _________________
Quote: | If "Yes", rockin'. If "Yes, but we don't want to do it", send me a message and I'll see if I can contribute. If "No", well, then piss off. ;P |
- |
|
Back to top |
|
 |
Onlyoneinall Bug finder
Joined: 16 Jul 2005 Posts: 746
|
|
Back to top |
|
 |
JSH357

Joined: 02 Feb 2003 Posts: 1705
|
Posted: Sat Sep 02, 2006 5:05 am Post subject: |
|
|
The "yourgamename.hsi" file you created is sort of like a library. What you want to do is create a "yourgamename.hss" file to write your own scripts in and include the hsi file so that it can use the information that was exported from the game. Additionally, you'll need to include plotscr.hsd so that your hss file can use all of the basic plotscripting commands.
I'm not sure how much you know about scripting, so I've pasted this code and added my comments.
There are some problems with Moogle1's example. First, he did not use the correct terminology for showing text boxes. Second, that script will not actually DO anything about your vehicle's usability. Getting that to work is a wee bit more complicated. I'll reply with my own version in a sec.
Code: |
include, plotscr.hsd
# You'll need this for ANY plotscripting you plan to do.
# Generally, it's good practice to include it at the top of the file.
include, gamename.hsi
#This is the list of constants you exported from your game. When it's
#included, you can use the constants in your scripts instead of referring
#to everything by number. Open the hsi file in notepad if you want to
#see what everything is called.
define script (1,repair boat,none)
# This tells the compiler that you're creating a script. The arguments
# are as follows:
# 1 = the script ID number.
# repair boat = the name of the script
# none = Arguments passed into the script. You don't need any for this
# one.
script, repair boat, begin
# This tells the compiler that you are writing the content of the
# repair boat script. "Begin" is equivalent to (
if (get hero stat(me,stat:Technical Points,current stat)>=11) then
# This line is checking the FIRST HERO in your party's MP value.
# Moogle should have noted that if you have more than one hero,
# there is more to this command. If so, please ask about that.
(
display text box (123) #make a text box that fixes the boat
# Moogle messed this up and it will not compile.
# Make sure to use this instead:
# showtextbox(123), waitfortextbox
)
else
(
display text box (456) #text box that says you need more tech pts
#Again:
# showtextbox(456), waitfortextbox
)
end
# Ends the script.
|
Last edited by JSH357 on Sat Sep 02, 2006 9:39 am; edited 1 time in total |
|
Back to top |
|
 |
JSH357

Joined: 02 Feb 2003 Posts: 1705
|
Posted: Sat Sep 02, 2006 5:40 am Post subject: |
|
|
OK. Before you create your hss file and get the party started, here's some information I'm taking into account. If anything is different about if in your game, change it accordingly.
Hero's name: Wap
"Boat is not fixable" text box : 123
"Wap fixes the boat" text box: 456
This is an older method that I used to use, and it isn't the most effecient way of doing things, but it will work well for a beginner.
- Create TWO NPC's for this event. One of them is the boat, and one of them is a blank picture.
- Create a tag and name it 'boat is usable'.
Now, I'm going to post a diagram. It might be confusing, but I'll tell you what it means.
The black lines are separating tiles on your map.
The white lines are walls. DO NOT use the space bar to place these walls. Use Ctrl + direction. You'll see why soon. Also, leave all of the water wall-less except on the coasts.
(Now, I'm just assuming that your boat is on a southern edge like this. If it's on another side of the map, you'll need to change the script I'm writing a little)
Now, we are going to create a script. If you're planning on this boat being needed more than once, you will need more scripts than this, so please ask if that is the case.
Go to script options and export your data again.
Now, create a .hss file. (Right click in windows, new .txt file, rename it "yourgamename.hss") Open the hss file in notepad or whatever you are planning on using to write scripts. Do not use Microsoft Word for this.
This is what you need to do. If you are confused about any of my comments, please ask. In case you didn't know, the # key is how you leave comments in scripts. Anything written after the # will not be read by the compiler, so you can use it to leave notes.
Code: |
include, plotscr.hsd
# Do this in every hss file you make
include, yourgamename.hsi
# make sure to change the name of this
# to whatever the name of the file is.
define script(
1,fixing the boat
)
# You don't have to use that name if you don't like it. Just remember
# to change it up ahead.
script, fixing the boat, begin
#Anything between here and 'end' is part of this script now.
suspend player
# This keeps the player from pressing any keys until the script is over.
# If you don't do this, they can keep walking while it's going on or, even
# worse, use the boat!
If ( get hero stat(findhero(hero:Wap)),stat:Technical Points,maximum stat)>=11)
# Whoah! What the heck does that mean? Let's go command by
# command.
# If: This is a conditional statement. If you've done any programming,
# You know what this is. If not, well, let's just say it lets the computer
# determine what action is necessary under given circumstances.
# get hero stat: This checks on one of your hero's stats.
# find hero(hero:Wap): This tells the game to find Wap's
# position in the party and use it for the getherostat() command.
# maximum stat: Moogle used current stat, but I chose
# maximum in case the player used some MP in battle. I'm not sure
# what your intentions were, but this should work.
then(
# If that whole big line was all true, this will happen.
show text box (456), wait for text box
# This displays the "Boat is fixed" text box and waits for the player to
# advance it.
set tag(tag:boat is usable, on)
)
# You'll see what this does in a moment.
else(
# If Wap's MP isn't 11 yet...
show text box (123), wait for text box
walkhero(me, up), wait for hero (me)
)
# This prevents the player from using the boat by moving them out of the
# way. Not elegant, but it works.
resume player
end
# That's all for this script.
|
Now, make any changes needed (the text boxes are probably the wrong number in my example), save the file, and drag the hss file into HSPEAK.exe and it will compile. If it doesn't compile, please tell us what the error is.
Go into your game and choose script options. Import the hss file. You should see something like:
Scripts imported: fixing the boat
Go to the map where you put those two NPCs. Edit the invisible NPC. Make it appear ONLY if the 'boat is usable' tag is OFF. Set the npc to be activated when it is stepped on. Set it to run the script you just made. It will be the only script available.
If the boat is set up properly, that should be all you need to do. Here are some problems I foresee in your near future. If you'd like some advice on how to tackle these, please ask:
1. How can I make it so the boat is usable, even if the player leaves the map or saves and quits?
2. How to I design my map so that the boat works properly?
If you can't figure out how to do these things or anything else, please ask.
Hope this is helpful. |
|
Back to top |
|
 |
RedMaverickZero Three pointed, red disaster! Halloween 2006 Creativity Winner


Joined: 12 Jul 2003 Posts: 1459
|
Posted: Sat Sep 02, 2006 7:54 am Post subject: |
|
|
This is actually a really good idea that I haven't seen implemented into any games. I think I'll use something like this in my project. It sounds great. |
|
Back to top |
|
 |
Moogle1 Scourge of the Seas Halloween 2006 Creativity Winner


Joined: 15 Jul 2004 Posts: 3377 Location: Seattle, WA
|
Posted: Sat Sep 02, 2006 9:23 am Post subject: |
|
|
Okay, so my plotscripting is a bit rusty, but I'll still nitpick and say you need to take out the line that says "Code:".
If you're interested in learning more about plotscripting, check the Moglery link in my signature, which has some really old but nonetheless useful tutorials that are great for beginners. _________________
|
|
Back to top |
|
 |
Big M The one..the only Big M
Joined: 01 Sep 2006 Posts: 6 Location: Australia
|
Posted: Sat Sep 02, 2006 8:26 pm Post subject: |
|
|
Thanks a TON!
..but there was an error.
Here:
Semicompiling C:\OHRRPGCE\import\boat.hs to C:\OHRRPGCE\import\boat.HS
file C:\OHRRPGCE\import\boat.HS already exists. Overwrite it? (Y/N)
y
reading C:\OHRRPGCE\import\boat.hs
file plotscr.hsd not found
including C:\OHRRPGCE\import\wap2006.hsi
88 lines read from 2 files
splitting commands
parsing constants
parsing top-level
ERROR: in line 32 of C:\OHRRPGCE\import\boat.hs
then(
Expected top-level declaration, but found flow control then. Perhaps there is
an extra end or ) earlier in the file
[Press Any Key]
What do I do? _________________
Quote: | If "Yes", rockin'. If "Yes, but we don't want to do it", send me a message and I'll see if I can contribute. If "No", well, then piss off. ;P |
- |
|
Back to top |
|
 |
JSH357

Joined: 02 Feb 2003 Posts: 1705
|
Posted: Sat Sep 02, 2006 8:48 pm Post subject: |
|
|
Sorry, sorry.
It's this line:
If ( get hero stat(findhero(hero:Wap)),stat:Technical Points,maximum stat)>=11)
Change it to this:
If ( get hero stat(findhero(hero:Wap),stat:Technical Points,maximum stat)>=11)
Parenthesis are tricky. |
|
Back to top |
|
 |
Big M The one..the only Big M
Joined: 01 Sep 2006 Posts: 6 Location: Australia
|
Posted: Sat Sep 02, 2006 8:58 pm Post subject: |
|
|
K. But there's another error...*groan*
Code: | Semicompiling C:\OHRRPGCE\import\boat.hs to C:\OHRRPGCE\import\boat.HS
file C:\OHRRPGCE\import\boat.HS already exists. Overwrite it? (Y/N)
y
reading C:\OHRRPGCE\import\boat.hs
file plotscr.hsd not found
including C:\OHRRPGCE\import\wap2006.hsi
88 lines read from 2 files
splitting commands
parsing constants
parsing top-level
compiling scripts
ERROR: in line 14 of script fixtheboat in C:\OHRRPGCE\import\boat.hs
suspend player
Unrecognised name suspendplayer. It has not been defined as script, constant,
variable, or anything else
[Press Any Key] |
_________________
Quote: | If "Yes", rockin'. If "Yes, but we don't want to do it", send me a message and I'll see if I can contribute. If "No", well, then piss off. ;P |
- |
|
Back to top |
|
 |
JSH357

Joined: 02 Feb 2003 Posts: 1705
|
Posted: Sat Sep 02, 2006 9:11 pm Post subject: |
|
|
Paste the top of your hss file. (The includes and script definitions) I'm assuming that you forgot to include plotscr.hsd, but let's make sure. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot 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
|