Ingame Menus -1 reply

  • 1
  • 2

Please wait...

The One and Only

I R Scary Eyeball

50 XP

28th January 2004

0 Uploads

4,091 Posts

0 Threads

#1 10 years ago

In some maps in singleplayer, menus are triggered by scripts on certain events (Eg. Killing Rosh because you can't stand listening to him whining will bring up a menu telling you you've failed the mission) and give you options such as Load, Restart, Exit etc. Is it possible to have a menu where the options run other scripts, or target entities in the map? Here's a little example of the sort of thing I want to do:

1. You approach an object an press the "use" button. 2. A menu appears with options "examine", "use", "exit". 3. If you press "examine", it sets off a target_print in the map. 4. If you press "use", it sets off a target_scriptrunner. 5. "Exit" obviously closes the menu.

Would this sort of thing be possible? If so, how?




redsaurus

Uses a Mac

50 XP

2nd February 2004

0 Uploads

126 Posts

0 Threads

#2 10 years ago

Assuming SP, you can use a target_level_change with "mapname" set to "+" to open the menu file to start with.

I'm pretty sure menus can run scripts, by doing the command "runscript scriptname" (or maybe you need to put that in a .cfg and then exec that cfg? not too sure..).

If it's MP you'll just need to code it all :p .




The One and Only

I R Scary Eyeball

50 XP

28th January 2004

0 Uploads

4,091 Posts

0 Threads

#3 10 years ago

No, it's for singleplayer. So, using the target_level_change method, would you be able to return to the map again, or not?




redsaurus

Uses a Mac

50 XP

2nd February 2004

0 Uploads

126 Posts

0 Threads

#4 10 years ago

It just opens the menu without doing anything to the map in the background. So you can still go back/forth as many times as you like.




The One and Only

I R Scary Eyeball

50 XP

28th January 2004

0 Uploads

4,091 Posts

0 Threads

#5 10 years ago

That's perfect, thanks!




The One and Only

I R Scary Eyeball

50 XP

28th January 2004

0 Uploads

4,091 Posts

0 Threads

#6 10 years ago

The command is something I'm not quite sure how to set up, could you give me some examples please?

1. To run an ICARUS script 2. To target a map entity (if possible) 3. To run a cfg file (Although I think I know how to do this one)

Hmm, too late to edit that post, could someone merge these?

Spoiler: Show

{ menuDef { name "hyperspacered" visible 0 // Not full screen so we can see the game behind it. fullscreen 0 rect 0 0 640 480 focusColor 1 1 1 1 style WINDOW_STYLE_FILLED border 1 descX 320 descY 458 descScale 1 descColor 1 0.6 0 0.8 descAlignment ITEM_ALIGN_CENTER ignoreescape 0 } itemDef { name background group none rect 0 0 640 480 style WINDOW_STYLE_SHADER background "gfx/menus/hyperspace" forecolor 1 1 1 1 visible 1 decoration }

// Title itemDef { name destination_title group title style WINDOW_STYLE_EMPTY background "gfx/menus/menu_blendbox" text "Select Destination" rect 0 20 640 16 font 3 textscale 1 textalign ITEM_ALIGN_CENTER textalignx 320 textaligny -1 forecolor 1 0 0 1 visible 1 decoration } itemDef { name green group none style WINDOW_STYLE_EMPTY type ITEM_TYPE_BUTTON rect 170 380 300 20 text "Green Planet" desctext "Go to the Green Planet" textscale 1 font 4 textalign ITEM_ALIGN_CENTER textalignx 150 forecolor 1 0.6 0 1 visible 1 action { play "sound/misc/nomenu.wav" close all runscript gotogreen scriptname } mouseEnter { show button_glow setitemrect button_glow 170 378 300 24 } mouseExit { hide button_glow } }

For some reason, nothing from the first item (the background) onwards will work. I get error messages telling me I've specified an invalid keyword (which I don't think I have) in every line from there. The menu definition itself works, but none of the items do.




The One and Only

I R Scary Eyeball

50 XP

28th January 2004

0 Uploads

4,091 Posts

0 Threads

#7 10 years ago

Ok, minor success. The menu items now show up as they're meant to, but I'm still no closer to making them trigger events in the game. Is there a way of doing so through a cfg file? (Which I can trigger with the menu.)

Spoiler: Show
picture1rf7.png



redsaurus

Uses a Mac

50 XP

2nd February 2004

0 Uploads

126 Posts

0 Threads

#8 10 years ago

*possible method*:

make a cfg called 'blah.cfg' or whatever, and put

runscript

in it. exec'ing it should work just like a target_scriptrunner (replace with script targetname of ent + scriptname with the script).




The One and Only

I R Scary Eyeball

50 XP

28th January 2004

0 Uploads

4,091 Posts

0 Threads

#9 10 years ago

Thanks, I'll try it. I'm a little confused as to what each of those refers to though. What do I put in place of the ?




redsaurus

Uses a Mac

50 XP

2nd February 2004

0 Uploads

126 Posts

0 Threads

#10 10 years ago

something like player if you want the player to be affected - it's probably the script_targetname of the entity you want to target.




  • 1
  • 2