Author Topic: Message sending from multiple sources  (Read 2317 times)

0 Members and 1 Guest are viewing this topic.

Offline Deora11

  • 25
Message sending from multiple sources
Me again.

I wanted to know how to send a message from multiple sources, so anyone can say it. Say I have a message concerning, i don't know, how bad beta wing is.

I want it to be sent from Alpha wing, but from any-one part of alpha wing. Same goes for if one of them dies, it goes to another pilot, not just default to the #Command sender.

P.S Expect to see a little more of me, I'm far from a pro mission designer and enjoy learning Mission Design techniques.

:)

 

Offline procdrone

  • Formerly TheHound
  • 29
  • Balance breaker! Thats me!
    • Steam
Re: Message sending from multiple sources
that situation screams for when-argument usage.
« Last Edit: November 03, 2014, 04:50:39 am by TheHound »
--Did it! It's RELEASED! VeniceMirror Thread--

 

Offline TopAce

  • Stalwart contributor
  • 212
  • FREDder, FSWiki editor, and tester
Re: Message sending from multiple sources
I'd use if-then-else here. If Alpha 2 isn't present, then Alpha 3 will talk; then if Alpha 3 isn't present, Alpha 4 will send the message, and so on.

Unless you want to ranzomize it, in which case, when-argument might be one option. You still need to check if the ship that the event picks is present, though.
My community contributions - Get my campaigns from here.

I already announced my retirement twice, yet here I am. If I bring up that topic again, don't believe a word.

 

Offline Deora11

  • 25
Re: Message sending from multiple sources
Well, I want it random, so I went with the (when-argument), but how do I set it so if one gets destroyed, it removes it from the list. Otherwise, if alpha 2 gets destroyed, he can still be chosen from the list, even though his not present.

Would I need a separate event where if any argument is destroyed, they become invalid?

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Message sending from multiple sources
I've not tested it but this should work.

when-argument
-random-multiple-of
--Alpha 2
--Alpha 3
--Alpha 4
- Whatever your trigger is that makes the message need to be sent
- if-then-else
-- is-destroyed-delay
--- <argument>
--- 0
--- invalidate-argument
---- <argument>
--- send-message
---- <argument>
---- high
---- Message Name
--- Invalidate-all-arguments

Set the repeat count the same as the number of ships and the repeat interval to 0. This event may actually take up to 3 frames to actually find the correct ship and send the message but for something like this, it won't matter at all since the game is running at 60 frames per second on most PCs and even at a ridiculously slow 10 FPS it's still going to trigger in under half a second.

What the event does is check if it is the right time to play the message. It then uses if-then-else to check if the wingman has been destroyed and invalidates it if it has. The event will then repeat the next frame. If the wingman hasn't been destroyed the game plays the message and then invalidates all the entries on the list so that none of the other wingmen who are still alive can send the message.
« Last Edit: November 03, 2014, 07:28:57 pm by karajorma »
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline Droid803

  • Trusted poster of legit stuff
  • 213
  • /人 ◕ ‿‿ ◕ 人\ Do you want to be a Magical Girl?
    • Skype
    • Steam
Re: Message sending from multiple sources
Isn't there a builtin system where if a message assigned to one fighter is dead, if the message priority is high enough it'll be sent by another pilot with the same persona?
(´・ω・`)
=============================================================

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: Message sending from multiple sources
Yes, but that (obviously) requires you to give all of the fighters identical personae.
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 

Offline Nagrach

  • 26
  • Just another Freespacer
Re: Message sending from multiple sources
I have a similiar Problem. I want that several Cap Ships are sending the same Message when they are Dying, but I have no clue how do to this, the Persona thing doesn't, so I consider if-than-else? Like posted before?
« Last Edit: November 13, 2014, 10:43:04 am by Nagrach »
Crabby the crappy crab crap.

-273 °C. Finally a place where I don't need to sweat.

 

Offline Cyborg17

  • 29
  • Life? Don't talk to me about life....
Re: Message sending from multiple sources
I have a similiar Problem. I want that several Cap Ships are sending the same Message when they are Dying, but I have no clue how do to this, the Persona thing doesn't, so I consider if-than-else? Like posted before?

To clarify, you want different cap ships to send the same message when they die or if their health is below a certain point?

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Message sending from multiple sources
What I've written will work perfectly well for capships but since the player tends to take more notice of capships than fighters, it's probably a good idea to give each ship its own message.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: Message sending from multiple sources
If the message needs to be sent on death, it makes more sense to use when-argument with any-of and a condition that checks if <argument> is dying.
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 

Offline Rheyah

  • 28
  • Will release something one day. Promise.
Re: Message sending from multiple sources
$Formula: ( when-argument
   ( any-of
      "Delta 1"
      "Delta 2"
      "Delta 3"
   )
   ( is-destroyed-delay 0 "<argument>" )
   ( when
      ( and
         ( is-destroyed-delay 0 "Delta 1" )
         ( not
            ( is-destroyed-delay 0 "Delta 2" )
         )
      )
      ( send-message
         "Delta 2"
         "Low"
         "Delta1DownD2-1"
      )
   )
   ( when
      ( and
         ( is-destroyed-delay
            0
            "Delta 1"
            "Delta 2"
         )
         ( not
            ( is-destroyed-delay 0 "Delta 3" )
         )
      )
      ( send-message
         "Delta 3"
         "Normal"
         "Delta12DownD3-1"
      )
      ( training-msg
         "Delta12DownPCT-2"
         "Delta12DownPCT-2"
         3
      )
   )
   ( when
      ( and
         ( is-destroyed-delay 0 "Delta 2" )
         ( not
            ( is-destroyed-delay 0 "Delta 1" )
         )
      )
      ( send-message
         "Delta 1"
         "Low"
         "Delta2DownD1-1"
      )
   )
   ( when
      ( and
         ( is-destroyed-delay 0 "Delta 3" )
         ( not
            ( is-destroyed-delay 0 "Delta 1" )
         )
      )
      ( send-message
         "Delta 1"
         "Low"
         "Delta3DownD1-1"
      )
   )
   ( when
      ( is-destroyed-delay
         0
         "Delta 3"
         "Delta 1"
         "Delta 2"
      )
      ( send-message-list
         "Delta 4"
         "Normal"
         "DeltaAllDownPC-1"
         0
         "Ephesus"
         "Normal"
         "DeltaAllDownEP-2"
         6000
         "Alpha 3"
         "Normal"
         "DeltaAllDownA3-3"
         6000
      )
   )
   ( invalidate-argument "<argument>" )
)
+Name: MSG:  Delta Death Messages
+Repeat Count: -1
+Trigger Count: 3
+Interval: 10


This is a more complicated example which provides seperate, updating messages for four personas as members of the wing die.  It is just given as an example of the kind of when-argument combined with when conditions which let you seperate out pilot personas.

Hope this helps :)

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Message sending from multiple sources
I'd probably have separated them into 4 different events (one for each member of Delta wing) but this works too. :)

To be honest, what I would do now is use the SEXP container feature. But since that's not in trunk yet, I don't blame anyone for waiting for it to hit trunk. 
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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