Jump to content

Photo

possible shop script?


  • Please log in to reply
4 replies to this topic

#1 Kendiggity

Kendiggity

    Initiate

  • Members

Posted 03 March 2018 - 04:25 PM

I'm trying to make a Zelda survival quest. as in room after room of enemies compensated by rupees after completion of each room.
I want to make a script for ex button 1 that will open a shop menu (only available when there are no monsters present). and it will be a menu in which

you can buy Heart containers, life refills, magic refills, better equipment, etc. Is this possible to do? I'm not very savvy with scripting. but it can be very basic.
Even if its just a black screen with a list like

Refill life                  25
Heart Container      100
Magic sword           250
Big shield                60
Wand                       200
etc

 

 

 

where you use up/down to browse and A to purchase.
B to exit.



#2 James24

James24

    Adept

  • Banned
  • Real Name:James
  • Location:Australia

Posted 03 March 2018 - 10:07 PM

It all depends on how much time you have to devote to learning scripting or whether you can find anyone who is willing to help you write good scripts.  My own quest has a survival portion that is very similar to what you're describing but I simply have a NES Zelda shop that the player has to walk backwards towards if they want to buy anything.  Cheap and nasty but it works and I didn't have to learn how to script something as complicated as that.  And I say complicated because whilst it looks easy I can't think of any easy way to script something like that.



#3 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 04 March 2018 - 05:15 AM

It's relatively easy to make a simple menu like this.

Essentially, you want a pointer, some text, and to track the pointer position relative to the strings.

Something like this.

Note: I wrote this 'off the cuff' on my mobile. I used some shorthand for some instructions, and the Screen->Draw* stuff may have args out-of-order. (It's easy to clean up, once I'm in front of a real computer.)

I didn't include any sound effects or other fancy stuff. This is purely to illustrate basic menu building.

#4 James24

James24

    Adept

  • Banned
  • Real Name:James
  • Location:Australia

Posted 04 March 2018 - 10:55 PM

You might think something like that is easy Zoria, but I guarantee you to someone starting out scripting its a nightmare.
 
Something truly easy would be:
int choice = Game->CreateMenu("Life: 25", "HC: 100", "Sword: 250", "BigShield: 60", "Wand:200");


#5 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 05 March 2018 - 03:21 AM

You might think something like that is easy Zoria, but I guarantee you to someone starting out scripting its a nightmare.
 
Something truly easy would be:
int choice = Game->CreateMenu("Life: 25", "HC: 100", "Sword: 250", "BigShield: 60", "Wand:200");


If that was valid syntax, it might be. ;)

You can use string literals in 2.54, but even then, that isn't a valid function.

It's still easy, compared to making a scripted enemy, weapon, or game event. What I posted is the basic template for a generic menu like this. You can go as fancy as you want, from there. I personally use a modified version of Tango.zh and its menu API.

I did say, relatively easy, after all.

FWIW, if I were to make a menu-building API, I'd go with:

CreateMenu(id);
AddMenuIrem(menu_id, slot, "text", FUNCTION, vars[]);
UI building should be as intuitive as possible, IMO. When we have function pointers, then designing this sort of thing will be more streamlined.

Anyway, my goal here was to demonstrate how to build a one-off menu, not how to automate the menu-creation process. For these sorts of things to work, you need an underlaying set of library functions, and a structure of some kind in place where menu IDs and slot entries are stored.

Neither of these are within the scope of the OP.


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users