Author Topic: How to set up a key prompt?  (Read 1508 times)

0 Members and 1 Guest are viewing this topic.

Offline HLD_Prophecy

  • PVD_Hope in a former life
  • 29
How to set up a key prompt?
Hey all!

So I'm trying to figure out how to set up a Y/N type key press prompt for the player. Subtitle Text will display prompting the player to press Y or N, and whichever key is pressed will determine the next chain of events (so if the event "key pressed is N" is true, then a certain subtitle text will display and a ship will warp in a few seconds later, but if the event "key pressed is Y" is true, then a different subtitle text will display and the ship will warp in right away.

Anyone know how this works?

Thanks!

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: How to set up a key prompt?
I'm at work, so I'm doing this off the cuff without reference to FRED, but it will look something like this.

Code: [Select]
SomeEvent
-When
--(some trigger, doesn't matter.. just whatever you want to start the keypress event)
--show-subtitle-text [your text (Press Y for this N for that)]
--key-reset (This causes FSO to see those keys as unpressed from this moment until they are pressed)
---[the keys you want to use for yes/no]
SomeEvent 2 (also use this event with is-event-true-delay for the ship arrival trigger)
-When
--And (so that this event only triggers after the event above)
---is-event-true-delay[SomeEvent]
---key-pressed [whatever key for yes]
--clear-subtitles(to clear the instruction subtitle)
--show-subtitle-text
SomeEvent 3 (also use this event with is-event-true-delay for the ship arrival trigger with a delay)
-When
--And
---is-event-true-delay[SomeEvent]
---key-pressed [whatever key for no]
--clear-subtitles(to clear the instruction subtitle)
--show-subtitle-text

Now if the ship to warp in is the same ship for both yes and no with the delay being different, then you can add something like this.
Code: [Select]
SomeEvent 4 (use THIS as your ship arrival cue)
-When
--or
---is-event-true-delay(SomeEvent 2)
---is-event-true-delay(SomeEvent 3)
--Do-nothing

Then add set-arrival-info to SomeEvent 2 & 3 to modify the arrival delay.
« Last Edit: October 19, 2016, 12:19:38 pm by mjn.mixael »
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 

Offline HLD_Prophecy

  • PVD_Hope in a former life
  • 29
Re: How to set up a key prompt?
Awesome, thanks! I'd tried it before and came out with pretty much this, but I didn't have the key-reset.

I will try it when I've got the time and reply again if it doesn't work, but I can't see why it shouldn't. :)

  

Offline HLD_Prophecy

  • PVD_Hope in a former life
  • 29
Re: How to set up a key prompt?
Okay, I've tried it - pressing Y works perfectly! But pressing N does nothing. The events are set up right... can you help me solve this?