Author Topic: Rotating a moving warship  (Read 3736 times)

0 Members and 1 Guest are viewing this topic.

Offline Colt

  • 28
  • Needs more dakka
    • Steam
Re: Rotating a moving warship
Use a numeric variable, not a string.
Whoops. Anyway, swapped it from string to number. No change however.

...
I probably did this wrong too, but I placed both events around the play dead event (the one with the is-destroyed-subsys). No change.

What I could do if I'm not fruitful here is, as mentioned earlier, guardian the turrets until the destroyer arrives and then have the corvette begin moving instead of waiting for the next attack force to arrive. Command/whoever can just tell the player to hold position/focus other targets until the destroyer arrives.

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Rotating a moving warship
Okay let me be sure I have this right:

1. You want a ship to spin to bear fresh turrets when some turrets die - you have an event to order this
2. At some point the ship also runs waypoints
3. If the ship has NOT YET begun waypoints, it should spin first, then begin waypoints
4. If the ship is already running waypoints, it should spin while moving, then continue waypoints

 

Offline Colt

  • 28
  • Needs more dakka
    • Steam
Re: Rotating a moving warship
Okay let me be sure I have this right:

1. You want a ship to spin to bear fresh turrets when some turrets die - you have an event to order this
2. At some point the ship also runs waypoints
3. If the ship has NOT YET begun waypoints, it should spin first, then begin waypoints
4. If the ship is already running waypoints, it should spin while moving, then continue waypoints

1. Correct.
2. Yup. This would happen when the 2nd allied wave enters the system.
3. Yes. If it's turrets are knocked out, it will spin. If it's in the middle of spinning when it receives the order to move, then it should at the same time continue it's spin (it takes 40 seconds total to spin) and begin moving to the waypoint.
4. Correct. This is assuming it still has at least 1 turret.

In summery:

Deimos is stationary - allied destroyer arrives, Deimos starts shooting destroyer - destroyer departs - 2nd allied wave arrives,  Deimos begins to move parallel of them to engage with beamfire - If port beams are destroyed at any point in time, it spins to use starboard beams.

Currently it spins when the guns are destroyed, both when stationary and when on already on the move. However, if the Deimos receives the waypoint order as it's spinning, it cancels the spin, thus leaving it possible that it's starboard guns won't be able to fire on the allied ships of wave 2 as it goes past them.

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Rotating a moving warship
It sounds like you have everything working, except you need it to finish spinning before it waypoints.

I have a fancy way to do this but it is too long to explain! The short version is: you have a variable that is only ==1 if the roll is underway. You need to tell the waypoint event that it needs to wait for that variable to ==0 to trigger.

 

Offline Colt

  • 28
  • Needs more dakka
    • Steam
Re: Rotating a moving warship
It sounds like you have everything working, except you need it to finish spinning before it waypoints.

I have a fancy way to do this but it is too long to explain! The short version is: you have a variable that is only ==1 if the roll is underway. You need to tell the waypoint event that it needs to wait for that variable to ==0 to trigger.

I believe I have those variables down already. I'll post what I have so far.

Code: [Select]
Waypoint 1
    when
        has-time-elapsed
            15
        add-goal
            Deimos
            ai-waypoint-once   
                Waypoint path 1
                89
        modify-variable
            rotation-in-progress(0)
            0

Play dead
    when
        is-subsystem-destroyed-delay
            Deimos
            turret03
            0
        clear-goals
            Deimos
        add-goal
            Deimos
            ai-play-dead
                100

Deimos roll
    when
        is-event-true-delay
           play dead
           0
        ship-maneuver
             deimos
             40000
             0
             0
             100
             true
             0
             0
             100
             true
        send-message (used to double confirm the event fired)
        modify-variable
            rotation-in-progress(0)
            1

Deimos keep rolling (CHAINED TO DEIMOS ROLL)
    when
        is-event-true-delay
            Deimos roll
            40
        modify-variable
            rotation-in-progress
            0

Waypoint 2
    when
        and
            is-event-true-delay
                Deimos roll
                40
            add-goal
                Deimos
                    ai-waypoints-once
                        Waypoint path 2
                        89
            modify-variable
                rotation-in-progress(0)
                0

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Rotating a moving warship
None of your 'when' conditions check the value of the variable, do they? You need something to say "Hey, you can't do this unless the variable = 0." Use the arithmetic operator =.

So in the 'and' on your Waypoint 2 event, you need to add

=
(rotation-in-progress)
(0)

 

Offline Colt

  • 28
  • Needs more dakka
    • Steam
Re: Rotating a moving warship
None of your 'when' conditions check the value of the variable, do they? You need something to say "Hey, you can't do this unless the variable = 0." Use the arithmetic operator =.

So in the 'and' on your Waypoint 2 event, you need to add

=
(rotation-in-progress)
(0)

 :yes: BOOYAH! :yes: Got it working!

I tried it with the waypoint 2 event, but to no avail. However, upon using it in the waypoint 1 event I got the following:

-Ship losses turret, begins rotating. Upon finishing rotate it then proceeds to waypoint 1, then waypoint 2.
To fix this, I gave waypoint 2 a higher priority, and made an event that clear's the deimos' goals upon reaching waypoint 2.

Other things that happen:

-No turret lost? Ship stops at waypoint 1
-Turret lost while on way to waypoint 1? Rolls and then goes to waypoint 2

Basically everything is working as intended! Think all I need to do now is to make an event that turns the velocity from 100 to 0 when the ship hasn't received it's waypoint order. Thanks for the help so far guys!

Edit: Found and fixed a mistake that I overlooked. I've changed the has-time-elapsed to an is-event-true for another ship arrival because when I changed the original has-time-elapsed from 15 to 60, I found that that the Deimos would start travelling to waypoint 2 after it finished it's roll BEFORE the initial 60 seconds had finished. For a few minutes there I was terrified  :shaking:
« Last Edit: May 23, 2019, 01:44:51 am by Colt »