Author Topic: Rearming Questions (Split From (Mission) Fight)  (Read 3424 times)

0 Members and 1 Guest are viewing this topic.

Offline Calmeir

  • 23
Rearming Questions (Split From (Mission) Fight)
You can use the get and set ammo SEXPs to give the player more ammo if you wish but that will always seem arcadey.

I've been working on combat reaming by doing a combat landing on the Battlestar. Basically rearm, and get a little bit of a patch up on the hull (I'm doing about 25%) and takes about 15 seconds sitting (immobilized) on the landing strip. The problem I am having is that I can only really get it to work one time since it is a series of events that are chained together.  I'm trying to have it open ended so you can rearm/repair as often as you need to, but can't seem to get it to function properly. Either way, if you only need to rearm once during the mission that could work out for you. Not sure if there is a way to extract the events "code" to paste how I have it, so I guess just let me know if you're interested.
« Last Edit: January 28, 2014, 07:38:08 pm by karajorma »

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
You'll be able to solve that problem pretty quickly with variables and repeat counts.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
FS2 missions can be opened in Notepad. Simply look for your event's name and post that particular chain of events here.

Or you could post a picture.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline Colonol Dekker

  • HLP is my mistress
  • 213
  • Aken Tigh Dekker
    • My old squad sub-domain
It makes me happy to see new people learning Fred.
Your friendly Orestes tactical controller
GO GO DEKKER RANGERSSSS!!!!!!!!!!!!!!!!!
President of the Scooby Doo Model Appreciation Society
The only good Zod is a dead Zod
NEWGROUNDS COMEDY GOLD, UPDATED DAILY
http://badges.steamprofile.com/profile/default/steam/76561198011784807.png

 

Offline Calmeir

  • 23
FS2 missions can be opened in Notepad. Simply look for your event's name and post that particular chain of events here.

Or you could post a picture.
You'll be able to solve that problem pretty quickly with variables and repeat counts.

So I have tried using the repeat counts, but it seems like either I have no idea how to actually use the repeat counts, or there is something wrong with the fact that it is chained. When I set a repeat count of anything higher than 1 it will repeat the first event as many times as I have it listed, but it will do them immediately as opposed to having a cool down time. Also it doesn't seem like it goes through the chain then. It all happens within a matter of a second or two. Anyhow, below is the chain I have.


1st is the actual landing/rearming
Code: [Select]
$Formula: ( when
   ( and
      ( or
         ( <
            ( distance-ship-subsystem
               "Alpha 1"
               "Battlestar Theseus"
               "landingstrip_porta"
            )
            55
         )
         ( <
            ( distance-ship-subsystem
               "Alpha 1"
               "Battlestar Theseus"
               "landingstrip_stbda"
            )
            55
         )
         ( is-in-box
            "Alpha 1"
            110
            210
            -47
            -27
            -160
            350
            "Battlestar Theseus"
         )
         ( is-in-box
            "Alpha 1"
            -210
            -110
            -47
            -27
            -160
            350
            "Battlestar Theseus"
         )
      )
      ( < ( current-speed "Alpha 1" ) 15 )
      ( or
         ( <
            ( primary-ammo-pct "Alpha 1" 0 )
            50
         )
         ( <
            ( secondary-ammo-pct "Alpha 1" 0 )
            25
         )
         ( < ( hits-left "Alpha 1" ) 50 )
      )
   )
   ( set-camera-shudder 1000 600 )
   ( set-immobile "Alpha 1" )
   ( play-sound-from-file
      "Landing_Mag_Lock.ogg"
   )
   ( set-primary-ammo "Alpha 1" 0 99999 )
   ( set-primary-ammo "Alpha 1" 1 99999 )
   ( set-primary-ammo "Alpha 1" 2 99999 )
   ( set-secondary-ammo
      "Alpha 1"
      0
      99999
   )
   ( set-secondary-ammo
      "Alpha 1"
      1
      99999
   )
   ( set-secondary-ammo
      "Alpha 1"
      2
      99999
   )
   ( set-immobile "Battlestar Theseus" )
   ( repair-subsystem
      "Alpha 1"
      "Hull"
      25
   )
)
+Name: Combat Rearm Alpha1
+Repeat Count: 1
+Interval: 1


2nd is letting the ship exit the hangar without worry of the battlestar moving
Code: [Select]
$Formula: ( when
   ( true )
   ( set-mobile "Alpha 1" )
   ( play-sound-from-file
      "Landing_Mag_Lock.ogg"
   )
   ( send-message
      "Battlestar Theseus"
      "High"
      "mag lock disengaged"
   )
)
+Name: rearm complete alpha1
+Repeat Count: 1
+Interval: 1
+Chained: 15

3rd is to "release" the battlestar to resume whatever it's doing
Code: [Select]
$Formula: ( when
   ( true )
   ( set-mobile "Battlestar Theseus" )
)
+Name: resume flight alpha1
+Repeat Count: 1
+Interval: 1
+Chained: 10

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
For the first event, you want to be using a trigger count instead of a repeat count. In really simple terms, repeat count says 'once this event's preconditions are met, repeat it X times, even if the conditions aren't met.' Trigger count says 'once this event's conditions are met, check whether the conditions are met again - and if so, repeat the event.'

To avoid the event triggering over and over again in a row, you need to set up a variable that indicates whether Alpha 1 is currently rearming. Add a variable called RearmingNow or something. Add another condition to your first event: RearmingNow = 0. Have that event set RearmingNow=1 after it does everything else. Give it a trigger count (say, 5) and a reasonable interval time (say, 30 seconds).

Then, have your second event set RearmingNow back to 0.

The last thing to deal with are your chains. I'm a little spooked by chained events involving trigger counts - I don't know if my superstition's up to date, but I don't think they work right. So what we're going to do is make your events work without chains.

Your first event is obviously fine on its own.

Your second event needs to say 'once that first event is true, plus a short period of time, I'm going to fire'. (How long do you want it to be?) How do we do this without a chain? Let's build a timer!

Create a new variable called RearmTimer. Create a brand new event. Give it a trigger count of 100 and an interval time of 1. Call it 'rearm timer' and tell it to say 'when RearmingNow = 1, modify the value of RearmTimer like this: (current value of RearmTimer + 1)' This variable will count up once a second when rearming is underway.

Go back to your second event, 'rearm complete alpha1'. Instead of true, set the condition to, say, RearmTimer = 10 (for a 10 second long rearm.) Then add a modify-variable to that event which resets RearmingNow (your first variable) to 0.

Now we 'rearmcomplete alpha1' should trigger 15 seconds after your first event triggers, no matter how many times your first event has triggered.

I'll leave the third event for you to solve using these tools.  ;) There are more elegant ways to do some of this stuff, but I think this is a reasonable intro to variables. Anything you want me to explain in more depth?

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
For the first event, you want to be using a trigger count instead of a repeat count. In really simple terms, repeat count says 'once this event's preconditions are met, repeat it X times, even if the conditions aren't met.' Trigger count says 'once this event's conditions are met, check whether the conditions are met again - and if so, repeat the event.'

That's not actually quite correct.

Repeat Count means that after the first time the event triggers the game will wait Interval Time and then test again to see if the conditions are true. If they are, repeat again. If not, wait Interval time again. Repeat until the event has been tested Repeat Count times.

Trigger Count means that after the first time the event triggers the game will wait Interval Time and then test again to see if the conditions are true. If they are, repeat again. If not, test every frame (i.e the same number of times a second as your FPS) until it becomes true. Keep doing this until the event has triggered Trigger Count times.

It is in fact possible to use both at the same time in fact. If you want something to be tested every 30 seconds for 4 minutes but only happen twice you'd set a Trigger Count of 2, a Repeat Count of 8, and an Interval Time of 30.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline Calmeir

  • 23
First off, sorry Crash for basically hijacking your thread, I only hope that it is helping you out with your mission as well.

Second, thanks for the help Battuta. I've got my series of events mostly working now, but I can't seem to get the trigger/repeat to work, so I haven't been able to fully test it. However, using the variables appears to be working correct. I can't seem to figure out what the deal is as to why it won't "fire" the event more than once. I am using the suggested trigger number of 5 and an interval of 30, which should be plenty of time. I have also tried using the repeat count of 5 instead of a trigger count, and I get the same result. I am only able to do the sequence 1 time. If I get a chance I might throw my mission back onto the forum so that others can take a more in depth look at the CRAZY spaghetti of events I have going on, and tell me that I have way overcomplicated most of it.   :banghead:

Also, when I add my mission to the forum there is some more cap ship combat questions that I have. I'll leave that alone for the moment though.

Thanks again for your help guys.

For the first event, you want to be using a trigger count instead of a repeat count. In really simple terms, repeat count says 'once this event's preconditions are met, repeat it X times, even if the conditions aren't met.' Trigger count says 'once this event's conditions are met, check whether the conditions are met again - and if so, repeat the event.'

To avoid the event triggering over and over again in a row, you need to set up a variable that indicates whether Alpha 1 is currently rearming. Add a variable called RearmingNow or something. Add another condition to your first event: RearmingNow = 0. Have that event set RearmingNow=1 after it does everything else. Give it a trigger count (say, 5) and a reasonable interval time (say, 30 seconds).

Then, have your second event set RearmingNow back to 0.

The last thing to deal with are your chains. I'm a little spooked by chained events involving trigger counts - I don't know if my superstition's up to date, but I don't think they work right. So what we're going to do is make your events work without chains.

Your first event is obviously fine on its own.

Your second event needs to say 'once that first event is true, plus a short period of time, I'm going to fire'. (How long do you want it to be?) How do we do this without a chain? Let's build a timer!

Create a new variable called RearmTimer. Create a brand new event. Give it a trigger count of 100 and an interval time of 1. Call it 'rearm timer' and tell it to say 'when RearmingNow = 1, modify the value of RearmTimer like this: (current value of RearmTimer + 1)' This variable will count up once a second when rearming is underway.

Go back to your second event, 'rearm complete alpha1'. Instead of true, set the condition to, say, RearmTimer = 10 (for a 10 second long rearm.) Then add a modify-variable to that event which resets RearmingNow (your first variable) to 0.

Now we 'rearmcomplete alpha1' should trigger 15 seconds after your first event triggers, no matter how many times your first event has triggered.

I'll leave the third event for you to solve using these tools.  ;) There are more elegant ways to do some of this stuff, but I think this is a reasonable intro to variables. Anything you want me to explain in more depth?

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Yeah, just post the mission.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Rearming Questions (Split From (Mission) Fight)
Reminds me, I really should write a tutorial on how to use the event.log to debug things like this. Especially since patch 1.1 gives Diaspora FREDders access to those tools.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline Calmeir

  • 23
Yeah, just post the mission.

http://calmeir.dyndns.org/diaspora/missingWIP.fs2

Alright, so here it is.

The main two things I am really trying to get wrapped up right now are:

1. Combat rearming (to be able to rearm multiple times if you wanted)

2. Getting the damned Battlestar to engage and destroy the basestars in a timely manner. My main issue seems to be that they stop firing the heavy front mount turrets after only a few volleys. Does it have only a very limited amount of ammo? Do they overheat? Are they targeted and destroyed? Why don't they keep firing the main guns?! It just seems to take a crazy amount of time for it to destroy even one basestar, and by then all the fighters have been long gone.  Should I try to park it directly beside the basestar?

Anyhow, take a look. There is of course still a lot of polishing to do, so don't mind the mess. 

Thanks!

 

Offline Calmeir

  • 23
Re: Rearming Questions (Split From (Mission) Fight)
After experiencing some weird graphical issues (hud/dradis not displaying properly)  I deleted my pilot and recreated it. That solved the graphical weirdness, but now the cap ship battle that I thought was pretty much a stalemate is now heavily one sided to the basestars. So, I'll definitely have to rework that..  :banghead:

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Rearming Questions (Split From (Mission) Fight)
Your difficulty setting probably changed. If the Diaspora AI does not normalize capship heavy weapon fire rates across all difficulties then yes, that's going to be a major, major problem for creating robust battles.

Re: your main gun problems, use SEXPs or physical examination in mission to make sure the batteries aren't being taken out by Cylon fire.

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Rearming Questions (Split From (Mission) Fight)
Getting a 404 on the mission file :( You can always just Pastebin it.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Rearming Questions (Split From (Mission) Fight)
Yeah, I'm getting the same issue. I was wondering if it was just me.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline Calmeir

  • 23
Re: Rearming Questions (Split From (Mission) Fight)
Getting a 404 on the mission file :( You can always just Pastebin it.

Weird it was working earlier. I just tried it and got the same thing. Strangely enough though, if you go to calmeir.dyndns.org/diaspora and then right click "save target as" it seemed to work.... Also, not sure what this pastebin is. Are you talking about just pasting the fs2 file as text so you can just copy and paste it? If so, then yeah, I suppose I could do that.

http://pastebin.com/download.php?i=hPYGcS0D

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Rearming Questions (Split From (Mission) Fight)
Okay! I can't load the mission right now to check it out in person, but the first thing I want to sort out is multiple rearms. Let's make sure all your variables are behaving correctly.

If you create a new event that says

every-time
(true)
training-msg (VarMonitor)

Then create message called VarMonitor and make its contents the following:
$Rearm-Timer
$RearmingNow

You can keep on eye on the value of those variables in real time.

You should also add 'RearmingNow = 0' as a prerequisite to the 'Combat Rearm Alpha1' event.

As for the Battlestar's attack behavior, instead of giving it attack orders, try telling it to face the target base ship with set-object-facing-object (and a reasonable turn time), or create a waypoint, tell the battlestar to move towards it, and set the waypoint's coordinates to the base ship's position every frame with the get-object-x/y/z sexps and a repeating event.

 

Offline Calmeir

  • 23
Re: Rearming Questions (Split From (Mission) Fight)
Alright, so using the variable monitor I was able to find out that it has something to do with the ammo/hull percentage check that I was doing. Once I removed that I was able to repeatedly rearm. THANK YOU for that!

As to the battlestar issue, I have actually tried using the facing object as well as waypoints. The main factor is that it seems like they run out of ammo is the best way I can describe it. As far as I can tell (from physical examination IG) it looks like the main cannons are still there, and if I scroll through the subsystems the heavy artillery is still at 100%. I'm not sure how to use a SEXP to check for that, although I'm guessing basically like the Variable Monitor function?

Thanks again on the rearming, it's been a pain in my aft for some time now... Should have just posted earlier.  :hopping:

Okay! I can't load the mission right now to check it out in person, but the first thing I want to sort out is multiple rearms. Let's make sure all your variables are behaving correctly.

If you create a new event that says

every-time
(true)
training-msg (VarMonitor)

Then create message called VarMonitor and make its contents the following:
$Rearm-Timer
$RearmingNow

You can keep on eye on the value of those variables in real time.

You should also add 'RearmingNow = 0' as a prerequisite to the 'Combat Rearm Alpha1' event.

As for the Battlestar's attack behavior, instead of giving it attack orders, try telling it to face the target base ship with set-object-facing-object (and a reasonable turn time), or create a waypoint, tell the battlestar to move towards it, and set the waypoint's coordinates to the base ship's position every frame with the get-object-x/y/z sexps and a repeating event.