Post Reply 
 
Thread Rating:
  • 6 Votes - 4.83 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Advanced aerial, water start, and dogfighting AI (version 4.21)
2017-11-02, 10:35 PM
Post: #701
RE: Advanced aerial, water start, and dogfighting AI (version 4.21)
So, ya double posting.

IMPORTANT uggg

no matter what I do my crafts seem to become an ICBM and shot for the moon, literally.
Visit this user's website Find all posts by this user
Quote this message in a reply
2017-11-02, 10:53 PM
Post: #702
RE: Advanced aerial, water start, and dogfighting AI (version 4.21)
I think 2.0 broke this--I may have fixed it for personal use but forget what I changed if I did.

Allr andask.
Find all posts by this user
Quote this message in a reply
2017-11-02, 11:14 PM
Post: #703
RE: Advanced aerial, water start, and dogfighting AI (version 4.21)
The sign on GetConstructPitch() was reversed, flip it and should work fine.
Find all posts by this user
Quote this message in a reply
2017-11-03, 03:30 AM
Post: #704
RE: Advanced aerial, water start, and dogfighting AI (version 4.21)
Was curious about this, because I didn't notice any difference in my scripts with the GetConstructPitch fix.

Prior to 2.0, it looked like it always returned a positive value: 0-360.

Afterwards, it was changed to -180 to 180. But I don't believe we will actually ever see an absolute pitch > 90 degrees because the yaw/roll will flip. (And I just tested this with a ship docked to a tractor beam on a spinner and it seemed to hold true.)

Anyway, as was said, TL;DR negate the pitch.

This (inside GetAngleStats):
Code:
Pitch = I:GetConstructPitch()
-- transform pitch into pitch we are familiar with from the game
  if (Pitch > 180) then
    Pitch = 360 - Pitch
  elseif (Pitch>0) then
    Pitch = -Pitch
  end

simply becomes

Code:
Pitch = -I:GetConstructPitch()

My Workshop | My FtD Lua Scripts
Find all posts by this user
Quote this message in a reply
2017-11-09, 03:28 PM
Post: #705
RE: Advanced aerial, water start, and dogfighting AI (version 4.21)
Have only recently stumbled across this ai since it seems perfect for torpedo or divebomber behavior. However i have found two problems beyond the whole inverted pitch thing.

1. The 4.21 version has an error with the flocking script, that only shows up when two or more craft with the lua ai spawn. When you do, the first one flies without problems, the second ones just sits there outputting the following error:
[string "function Update(I)..."]:680: bad argument #1 to 'pairs' (table expected, got string)
stack traceback:
[C]: in function 'pairs'
[string "function Update(I)..."]:680: in function 'NameMatches'
[string "function Update(I)..."]:698: in function 'Flocking'
[string "function Update(I)..."]:276: in function 'TurnTowardsAzimuth'
[string "function Update(I)..."]:790: in function 'NavigateToPoint'
[string "function Update(I)..."]:339: in function 'Cruise'
[string "function Update(I)..."]:855: in function 'Movement'
[string "function Update(I)..."]:872: in function 'Update'
[string "temp buffer"]:74: in function 'RunUpdate'
[string "temp buffer"]:80: in function <[string "temp buffer"]:78>
im guessing that this is just a case of wrong brackets since exchanging them for curly ones seems to fix that.

2. The 4.21 version is missing the "DefaultAngle" option but on both versions it seems like it doesnt really care anyway since the craft just flies along with a 70 deg tilt after the first roll, seriously destabelizing it.

Here both vehicles using it to check if something is wrong with them.


Attached File(s)
.blueprint  RAM Torpedo Bomber- lua.blueprint (Size: 84.94 KB / Downloads: 2)
.blueprint  ROM Dive Bomber lua.blueprint (Size: 88.72 KB / Downloads: 2)
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)