EDGE Demo Tutorials

By Lobo

Contents:

rtsmenu.wad  Download example wad  Download

Effect demonstrated: - RTS Menus

An RTS menu is a menu which, while shown on screen, freezes all gameplay. You press a key from 1 to 9 to indicate your choice.
It opens up possibilities for adding RPG elements to EDGE, since you could use it to have "conversations" with other things, "buy" things in a shop etc.

To use it, we just need to define an RTS script which, when run, will show us our menu.
The actual RTS menu commands syntax is:

MENU_STYLE  STYLENAME (this is optional)

SHOW_MENU  "TITLE YOU WANT"  "FIRST OPTION"  "SECOND OPTION"

JUMP_ON MENU  LabelToJumpTo1  LabelToJumpTo2



Heres the code with lots of helpful comments :)


//-130 258 is the lower left corner
//and 129 384 is the upper right corner


RECT_TRIGGER -130 258 129 384
    TAGGED_INDEPENDENT //Need this or RETRIGGER doesn't work properly
    TAGGED_USE //this trigger runs when we press the USE key
    TAGGED_REPEATABLE //We can run the script more than once each time we press USE

    //Step 1: what we want it to look like
    MENU_STYLE MENU3 //I have defined a custom style in styles.ddf called MENU3

    //Below I use the "\" character to divide up the command onto various lines
    //to make it easier to read but it could all be one line

    //Step 2: what we want to show
    SHOW_MENU "What Can I do for you?" \
    "Health" \
    "Ammo" \
    "Armour" \
    "Nothing"

    //Step 3: where we want to jump to in the script in each case
    JUMP_ON MENU option1 option2 option3 option4

    //Some labeled RTS
    label option1
        healplayer 150 200
        tip "Have some health" 2 false
        jump finishstuff

    label option2
        GIVE_BENEFIT BULLETS(100)
        tip "Have some ammo" 2 false
        jump finishstuff

    label option3
        GIVE_BENEFIT RED_ARMOUR(100)
        tip "Have some armour" 2 false
        jump finishstuff

    label option4
        tip "OK then. Have a nice Day" 2 false
        jump finishstuff

    label finishstuff
        //We do nothing else


    RETRIGGER //Set the script up to be able to re-execte it again

end_radiustrigger




Free Web Hosting