Character Selection Menu

Make games! Discuss those games here.

Moderators: Bob the Hamster, marionline, SDHawk

Post Reply
User avatar
Willy Elektrix
Liquid Metal Slime
Posts: 910
Joined: Sun Aug 15, 2010 11:30 pm

Character Selection Menu

Post by Willy Elektrix »

I want to make a menu that allows the player to select from 1 of 3 characters before they start a new game. I asked about this several months ago in a different thread and ended making a solution with text boxes and NPCs but now that my scripting skills are little better, I'd like to incorporate this as a script.

Here's what I've started. I've created a script that runs when you start a new game. This opens a menu with 3 choices labeled "robot" "cyborg" and "android." Robot is hero 0 inside custom.exe so he is assumed to be the default hero.

When you select one of the choices, one of the following 3 scripts should run:

Code: Select all

plotscript, addrobot, begin
add hero (robot)
swap by position (0,1)
delete hero (robot)
close menu (1)
end

Code: Select all

plotscript, addcyborg, begin
add hero (cyborg)
swap by position (0,1)
delete hero (robot)
close menu (1)
end

Code: Select all

plotscript, addandroid, begin
add hero (android)
swap by position (0,1)
delete hero (robot)
close menu (1)
end
The idea is that each script will (1) add the hero (2) swap him so he's the first slot in the party (3) delete the default character - robot and (4) close the menu

The "addrobot" script is redundant since technically robot is already part of the party, but I added it here for purposes of demonstration.

One thing that is a problem is that I don't know how to define my heros is constants. How do I do that?

Beyond that, will this actually work? Or is there an easier way to do this?

Thanks in advance!
User avatar
Mogri
Super Slime
Posts: 4598
Joined: Mon Oct 15, 2007 6:38 pm
Location: Austin, TX
Contact:

Post by Mogri »

That works.

You want to export an HSI file (it's in the same menu as Import script), which will automatically have all your constants.
User avatar
Willy Elektrix
Liquid Metal Slime
Posts: 910
Joined: Sun Aug 15, 2010 11:30 pm

Post by Willy Elektrix »

Got it! Thanks Mogri. Although, interestingly, my "add hero ()" command needed to reference the hero number, not the hero name. This is contrary to what it says in the plotscripting dictionary on the wiki.
User avatar
Bob the Hamster
Liquid Metal King Slime
Posts: 7460
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

Willy Elektrix wrote:Got it! Thanks Mogri. Although, interestingly, my "add hero ()" command needed to reference the hero number, not the hero name. This is contrary to what it says in the plotscripting dictionary on the wiki.
The hero name is just an alternate way of writing the hero ID number.

Did you get an error message when you tried to use hero name? If so, what did it say?
User avatar
mjohnson092088
Metal Slime
Posts: 428
Joined: Sun Jan 09, 2011 9:33 pm
Location: earth.

Post by mjohnson092088 »

Willy Elektrix wrote:Got it! Thanks Mogri. Although, interestingly, my "add hero ()" command needed to reference the hero number, not the hero name. This is contrary to what it says in the plotscripting dictionary on the wiki.
that's because you have to list the constant like it appears in your .hsi file. i noticed your script looked like this:

Code: Select all

add hero (android)
delete hero (android)
when it should look more like this:

Code: Select all

add hero (Hero:android)
delete hero (Hero:android)
Hey, I just met you, and this is crazy... So here's some lunchmeat... Sandwich, maybe?
User avatar
Sh4d0ws
Slime Knight
Posts: 199
Joined: Sun May 02, 2010 6:32 pm

Post by Sh4d0ws »

I hope we can look at the characters and get information about them before making the decision.

It might not be a bad idea to attach a textbox to that script, detailing you on the character, providing you with a portrait, and asking for confirmation.
User avatar
Willy Elektrix
Liquid Metal Slime
Posts: 910
Joined: Sun Aug 15, 2010 11:30 pm

Post by Willy Elektrix »

Sh4d0ws wrote:I hope we can look at the characters and get information about them before making the decision.

It might not be a bad idea to attach a textbox to that script, detailing you on the character, providing you with a portrait, and asking for confirmation.
Already got this. Thanks for the suggestion though. I've got a text box that includes characters images as well as stats for each that appears appears above the menu.
Post Reply