Author Topic: How to check for Player firing Primary and Secondary banks?  (Read 1806 times)

0 Members and 1 Guest are viewing this topic.

Offline LoneKnight

  • 27
  • One does not simply ALT-J into Mordor.
How to check for Player firing Primary and Secondary banks?
I'm trying to set up a sexp that is triggered by the Player firing their primary or secondary banks. I originally thought it would be possible with checking through Key-Pressed, and simply enter Spacebar, Left CTL, etc to register for whether or not the Player fires, but

1. People can remap their controls.
2. Left and Right Click don't appear in the key-pressed conditions list.

Is there a way to check for any primary fire, regardless of what button is pressed to trigger it?

EDIT: I'm trying to add all of the fail conditions for a stealth mission I'm building.
« Last Edit: July 28, 2011, 02:51:06 pm by LoneKnight »
Burning Heaven

 

Offline Lester

  • 27
Re: How to check for Player firing Primary and Secondary banks?
primary-fired-since and secondary-fired-since are your friends. Set the delay to something low, as in 50ms and beware of bank numbers. Bank 1 is actually bank 0 in the sexp itself.

 

Offline LoneKnight

  • 27
  • One does not simply ALT-J into Mordor.
Re: How to check for Player firing Primary and Secondary banks?
I tried working earlier with primary-fired-since but left the delay at 0, assuming that it was better to keep it at 0, and nothing happened. But once I changed the delay to 50 ms it worked perfectly! Thanks so much!
Burning Heaven

 
Re: How to check for Player firing Primary and Secondary banks?
primary-fired-since and secondary-fired-since are the best way of doing this, but FYI if you use key-pressed and the player has remapped their controls, FS2 will take that into account and the SEXP will trigger anyways. Also, "Button 1" and "Button 2" correspond to left- and right-click, respectively.

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Re: How to check for Player firing Primary and Secondary banks?
I tried working earlier with primary-fired-since but left the delay at 0, assuming that it was better to keep it at 0, and nothing happened. But once I changed the delay to 50 ms it worked perfectly! Thanks so much!
That's the thing with this sexp, it pretty much asks "Has the player fired primary/secondary bank 0/1/2 in the past <number> of ms", It's not a delay. (;
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

  

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: How to check for Player firing Primary and Secondary banks?
As you say, the idea is to check if the key has been pressed within a certain amount of time, not if a certain amount of time has passed since the key was last pressed. A delay wouldn't make any sense. You could easily check for that using the key-pressed SEXPs.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]