Author Topic: (Fred)Request for fightergroup-handling  (Read 4614 times)

0 Members and 1 Guest are viewing this topic.

Offline Starman01

  • 213
  • Mechwarrior
    • Wing Commander Saga
(Fred)Request for fightergroup-handling
Hello,

since I ran into many problems with SEXP-Limits and the AI don't do what I what her to do, I thought I just show you one of my problems, maybe you can think of some solutions or upgrades in the (hopefully near) future. I know I could have written the post shorter, but that makes it easier for me to explain the situation, (and I wanted to explain the argument-skipping below) so sorry for that :)

Unlike normal freespace-missions I don't have missions like "arriving, fighting and departing" (no offense guys, I just want to give an example :) ) I have due to the usage of navpoints (spread all over the mission-area with uge distances between them) mostly 3 or more "income, fight and departing"-stages, which also result everytime into a calm mission-part between those stages, where nothing big happens (in this situations, the battlegroups should form together again and / or we have most of our mission-chatter).

Now, what I don't like is the fact, that after a battle is won, fighters have "no orders" and start cruising slowly on their last position in circles, which makes them look like idiots.

To prevent that, I always have to control them by giving them AI-goals like "stay near ship", "guard" or something like that, which will force them into a close position. Since I normally use more than one wing, my problems start. Here is a part of a typical SEXP for one of this calm-stages, to give a picture of it :



Since many single events would use lots of SEXP-Nodes, I already started using more than 1 "when" argument in a single SEXP, but I've noticed many times that escpecially when using more than one "add-goal", you have a 30% chance (only a guess of course ), that at least one goal will not be given to the fighters.
Making use of "clear goals" decreases the possibility that it will happen, but don't prevent it at all.

So much for the "bug", I could mantis it if you wish (but I can't be produced by purpose, it is random).

To make life easier (certainly other people would also benefit from this) would it be possible to :

1) create a variable "all allied fighter/bombers" additional to wingnames (sometimes "all friendly" is available, but not for that AI-Goal part), so that I have only one "add-goal"-argument to create ? (But "all friendly" will be misplaced here, since this shouldn't affect any capships at all)

2) Another idea (or even better additional) some sort of "global goal" , that will be given everytime a fighter has "no orders", or simply force them to stay near the player if nothing happens

Before you ask, I know there are 8 possible goal-slots in ship- or wingedit, but that will not work here, since most of the goals-targets aren't even in the mission-area when the mission starts.

However, I certainly don't know everything about FRED, so maybe there is already a possibility to do that. Just tell me them ;)

(edit) While writing this, I just get an Idea. Since the "everytime" argument is now possible, is there a way to say "everytime XY has "no orders", add goal to XY" ? That would already be a good solution for the time being.

Thanks.
MECHCOMMANDER OMNITECH

9 out of 10 voices in my head always tell me that I'm not insane. The 10th is only humming the melody of TETRIS.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
(Fred)Request for fightergroup-handling
Why can't you just use when-argument >> every-of?
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline Starman01

  • 213
  • Mechwarrior
    • Wing Commander Saga
(Fred)Request for fightergroup-handling
uh... what ? :confused:

Sorry, I don't get that. Maybe you could give me a small example what you meant ?
MECHCOMMANDER OMNITECH

9 out of 10 voices in my head always tell me that I'm not insane. The 10th is only humming the melody of TETRIS.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
(Fred)Request for fightergroup-handling
Sorry. I thought I'd seen you use the when-argument SEXPs before. So I didn't bother explaining them.  

When-argument
-every-of
--Alpha 1
--Bravo
--Charlie
-true
-clear goal
--< Argument >
-add-goal
--< Argument >
--Ai-stay-near-ship
--Alpha 2
--89

Replace the true with whatever it was that you were using to trigger the event. I've never personally had to use a when-argument event that didn't check for the argument somewhere in the trigger so you may have to add

-not
--is destroyed
---0
---< Argument >

to the trigger in order to make it work. I don't think you do, it's just that I've never tried. That Event should do everything the one you posted does.
« Last Edit: March 20, 2005, 01:47:05 pm by 340 »
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline Starman01

  • 213
  • Mechwarrior
    • Wing Commander Saga
(Fred)Request for fightergroup-handling
Now that's interesting, I never knew this is possible (It was even this morning when I wondered what's the bigger deal behind these "argument") This is why I like doing this type of things, you can always learn something new ! Thanks man :)

But for better understanding, let me ask one more question. So when I make something like this :


does this really work like that :

Once Alpha2 is closer than 999 meters to navpoint 1,  Alpha1 and entire bravo and charlie wing will get the goal to stay near alpha 2 ? (However, according to my experience so far I might have to add a "clear goals" first)

I'm don't understand fully, why I should make this "not destroyed" addition. What's it supposed to do ? Will it make any problems, if one of the ships inside the argument isn't alive anymore ?

(Edit)

BTW, I tried that out with the everytime-argument right away, because I hoped that it will also be usable to repair every fighter once disabled, and guess what, it really does :)

But as I see it, the upper entry with "any-of" or "every-of" defines the argument inside this SEXP, and it can be used in the lower bases. Are those arguments only active inside this SEXP, or will/can they effect other SEXP ?
« Last Edit: March 20, 2005, 03:11:44 pm by 1072 »
MECHCOMMANDER OMNITECH

9 out of 10 voices in my head always tell me that I'm not insane. The 10th is only humming the melody of TETRIS.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
(Fred)Request for fightergroup-handling
Quote
Originally posted by Starman01
I'm don't understand fully, why I should make this "not destroyed" addition. What's it supposed to do ? Will it make any problems, if one of the ships inside the argument isn't alive anymore ?


 If your test worked fine then you don't need it. It's just that I'd never had never used when-argument without wanting to check the argument in the trigger In other words I've always used it in events like this.

when-arguement
-any-of
--Alpha 2
--Alpha 3
--Alpha 4
-is destroyed delay
--0
--< Argument >
-Do-Something

Where < Argument > was used in the trigger as well. So I didn't know if the game needed it in the trigger. Thinking logically about it, it doesn't seem likely it would.

Quote
Originally posted by Starman01
BTW, I tried that out with the everytime-argument right away, because I hoped that it will also be usable to repair every fighter once disabled, and guess what, it really does :)


Check if one of the other WCP programmers uses it. I'm almost certain I've seen one of them use it so I thought it was you. If I'd known that you didn't know how to use it I'd have suggested it earlier for dealing with that problem :)

Quote
Originally posted by Starman01
But as I see it, the upper entry with "any-of" or "every-of" defines the argument inside this SEXP, and it can be used in the lower bases. Are those arguments only active inside this SEXP, or will/can they effect other SEXP ?


I'm not quite sure I follow you.
If you use the any-of, every-of etc anything in that event it will be substituted in throughout that event. You can't use it directly in other events.

However String Variables have been made a lot more useful thanks to a few changes Goober made recently so what you could do is this

EVENT 1
When-Argument
-Any-of
--Alpha
--Beta
--Gamma
-EVENT TRIGGERED BY
--< Argument >
-Modify-Variable
--WingThatTriggeredEvent(Alpha)
--< Argument >

EVENT 2
When
-and
--event-true-delay
---EVENT 1
---0
--SOME OTHER TRIGGER
-Do-Something to
--WingThatTriggeredEvent(Alpha)

That's probably hideously complicated to follow but if you gave me an example I could probably explain it better :)
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

  

Offline Starman01

  • 213
  • Mechwarrior
    • Wing Commander Saga
(Fred)Request for fightergroup-handling
Quote
Originally posted by karajorma

If you use the any-of, every-of etc anything in that event it will be substituted in throughout that event. You can't use it directly in other events.


That was basically my question :)

However, I read a few times through your examples on the bottom of your post, but somehow my brain gives me "your call cannot be connected"-error  :D

These strings have always been something unreachable to me, I guess I really need some example to fully comprehend.


Let's say I want to make two events with the everytime-argument, one is for repairing all engine-subsystems, the other one is for repairing all weapon-subsystems (I tried to combine both in one SEXP, but that doesn't seem to work).

So when I set the Argument in the first SEXP to the wingnames "Alpha, Beta, Gamma" can I use the same argument in the second  SEXP also, when I define it as a string ?

Example :

EventA[/color]
-everytime-argument
--any-of
----alpha
----beta
----gamma
-<
-----hits left subsystem
--------argument A[/color]
--------engine
--------1
-set subsystem strength
---argument A[/color]
---Engine
---100

EventB[/color]
-everytime
-----<
------hits left subsystem
---------argument A[/color]
---------weapons
---------1
-set subsystem strength
---argument A[/color]
---weapons
---100

Since the argument can not be carried from Event A to Event B, I guess this is what must be done by a string. However, If I'm right (and somehow I doubt that :) ) it looks like not being worth the effort making a string just to save me a second time defining the argument, which will be only a few arguments.
MECHCOMMANDER OMNITECH

9 out of 10 voices in my head always tell me that I'm not insane. The 10th is only humming the melody of TETRIS.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
(Fred)Request for fightergroup-handling
Okay. There are two reasons that won't work.

1) As you say the argument can't be carried across from event to event. The reason for this is because you can of course have lots of when-argument SEXPs in your mission.

2) The reason this isn't working as a single event is simply cause the hits-left-subsytem SEXP only works with individual ships not wings. You can only plug in data that the SEXP recieving it will be expecting.

What you could of course do is change the any-of section to this

-any-of
--alpha 1
--alpha 2
--alpha 3
--alpha 4
--beta 1
..
--charlie 3
--charlie 4

Now the data is in the form the SEXPs you're using are expecting.

In the second event you'd have to use another everytime-argument set up in the same way. It will eat a few SEXP nodes repairing both subsytems in this way but nowhere near the amount you'd use to do each ship individually.

I wouldn't bother with a string variable for that sort of thing. What you use a string variable for is when you want to check in a later event which ship triggered the first one. Suppose you doing a mission where say one ship choosen at random is a traitor. You'd use the random-of SEXP in the first event and write the argument into a SEXP. The variable would now contain the identity of the traitor.

You could then use SEXPs like

-When
--Is Disabled Delay
---WhoIsTheTraitor(Ship)
---0

to set up a complicated chain of events without needing to know ahead of time who is the traitor. Done like this you could have anyone in the mission be the traitor.

There are some minor problems with doing that but if you look at my thread here you won't make the mistakes I made when I first tried using String Variables in this way :)

One last piece of advice. Remember that the argument can be anything. If you had 3 ships and five subsystems to check it would be more effecient to check on a ship by ship case rather than subsystem by subsystem

i.e

everytime-argument
-every-of
--Engine
--Communications
--Sensors
--Weapons
--Navigation
-<
--hits left subsystem
---Alpha 1
---< Argument >
---1
-set subsystem strength
--Alpha 1
--< Argument >
--100

Repeat the event for the other two ships you wanted to check and you'd be done. In your case I think it's better to check ship by ship like you were trying to do but I just wanted to show you how versatile this SEXP can be :)
« Last Edit: March 21, 2005, 03:00:48 am by 340 »
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline Starman01

  • 213
  • Mechwarrior
    • Wing Commander Saga
(Fred)Request for fightergroup-handling
I think I understand now. My example with the subsystemsabove was actually a typo, I already used ship-names and not wingnames, and it worked excellent (but I can now save me the time trying out, if it will work with wings too :) )

I will now also try this using for the death-screams SEXP I made, theoretically it should work also, and I can save again some sexp and get the missions more stable ;)

In any case, thank you very much for all this explanation, this definitly brought me one step ahead in my work here.
MECHCOMMANDER OMNITECH

9 out of 10 voices in my head always tell me that I'm not insane. The 10th is only humming the melody of TETRIS.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
(Fred)Request for fightergroup-handling
No problem. I did say that the next person who asked me about When-argument was going to get a really long explaination on how to use it because I'm planning to add something about it to the FAQ :)

You just happened to get lucky :)
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline Starman01

  • 213
  • Mechwarrior
    • Wing Commander Saga
(Fred)Request for fightergroup-handling
:bump:

Sorry for bumping this here up, but I have another question regarding the "argument"-SEXP, and I didn't want to make a new one. However, since it isn't really related to SCP-Requests, feel free to move it :)

I want a random ship of a wing play a specific message. Theoretically it is kinda easy now using the argument, but my problem is, that the "random ship" is selected from the system, right after the wing has arrived, but until the message-trigger get's true, the "random ship" coud have been destroyed already. If that happens, the message will be send by "#command" again. Karajorma mention the "not destroyed" above, but it doesn't work like it should, or at least I don't know where to put it.

This here is the working send-event (if no fighter is destroyed)

_op when argument
___op random of
_______cancer 1
_______cancer 2
_______cancer 3
___op has arrived delay
_______15
_______argument             (alternative I can insert then wing-name here )
___op send message
______argument
______high
______message


So where do I have to put the :

___op not
______op is destroyed delay
________0
________argument


so that the message will be played by one the still available ships from the argument, and not by #command ?
« Last Edit: April 23, 2005, 06:37:34 am by 1072 »
MECHCOMMANDER OMNITECH

9 out of 10 voices in my head always tell me that I'm not insane. The 10th is only humming the melody of TETRIS.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
(Fred)Request for fightergroup-handling
Hmm. To be honest I've never played around with the random-of SEXP much. If it works the way I think it does I can see your problem. If you call random-of for a ship that has been destroyed then it won't be able to send the message.

What I'd do is I'd split the selection into a random selection pseudo-function event and an event that actually sends the message.

Event 1 - Random Selection

Every-time-argument
_random of
__cancer 1
__cancer 2
__cancer 3
-and
--has arrived delay
__15
__< argument >
-string-equals
--alpha 1
--ShipPicked(Alpha 1)
--not
---is-destroyed-delay
----< argument >
modify-variable
-ShipPicked(Alpha 1)
-< argument >

Event 1 basically cycles around continuously until it spits out a ship that hasn't been destroyed. (In case you're wondering the initial value of the ShipPicked variable has to be a ship that is present in the mission or FS2 will crash out on loading the mission so I've set it to Alpha 1). When it does find a ship that hasn't been destroyed it writes that value into the variable which also has the effect of preventing it from being called again.

Event 2 - Send the message

when
-not
--String-equals
---Alpha 1
---ShipPicked(Alpha 1)
Send-message
-ShipPicked(Alpha 1)
-high
-message-name

Event 2 simply waits until the variable is set to something other than the default value and then sends the message

Unfortunately at the moment this won't work because event 1 will write the word < Argument > into the variable instead of writing in the value of < argument > which is what you want. When the message is sent it will come from < argument > rather than an actual ship (And that's if FS2 doesn't crash while trying to figure out who the hell < argument > is).
 Goober is aware of the problem in part and I'm going to be doing some extensive testing this weekend to see if I can figure out exactly what bugs are present.

Till that happens you're probably stuck with the old school method.

Event 1 (repeating event 1 second delay)
when
-and
--=
---0
---ShipPicked(0)
--has arrived delay
__15
---cancer
modify-variable
-Ship(0)
-rand-multiple
--1
--3

Event 2 (also repeating)
When
-and
--not
---is-destroyed-delay
----cancer 1
--=
---0
---ShipPicked(0)
--=
---1
---Ship(0)
Send-message
-cancer 1
-high
-message
modify-variable
-ShipPicked(0)
-1

You'll need an event like event 2 for every ship in cancer wing.

Personally I don't find the second solution anywhere near as elegant as the first. You need a lot more events, you need more variables and unlike the first one if you then want the ship to send another message 3 minutes later you've got to add another event for each ship in Cancer wing (Whereas with the first method you'd only need one more event!).
« Last Edit: April 23, 2005, 07:15:41 am by 340 »
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline Starman01

  • 213
  • Mechwarrior
    • Wing Commander Saga
(Fred)Request for fightergroup-handling
Really interesting what you can do in FRED :)

Though I have no Idea how to work with variables, and the solutions you offer me here, are not really what I'm looking for (not really easier or a safe of SEXP-Nodes), actually I'm not even able to rebuild those SEXP in FRED, i.e. in the first one I can't enter that "not" at this position.

But you already said, that the 1.variant doesn't work yet, and the second would require it doing this for every fighter. Even with Goober's raised SEXP-Node value I will break the limit again I guess.

Therefore I made it the old fashion way, I selected the ship which should send the message (a simple taunt) from the start on, and made only one SEXP for it. There is a chance, that the ship will be destroyed before it could send it's message, but I guess I must live with that :(

Nevertheless, thanks for your help again. :):yes:

StarmanĀ©
MECHCOMMANDER OMNITECH

9 out of 10 voices in my head always tell me that I'm not insane. The 10th is only humming the melody of TETRIS.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
(Fred)Request for fightergroup-handling
Quote
Originally posted by Starman01
actually I'm not even able to rebuild those SEXP in FRED, i.e. in the first one I can't enter that "not" at this position.


Now that you mention it I've come across that problem a few times myself. I got around it by entering the = first and then inserting the not in front of it IIRC. :D
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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