Author Topic: remove-goal  (Read 5548 times)

0 Members and 1 Guest are viewing this topic.

Offline FUBAR-BDHR

  • Self-Propelled Trouble Magnet
  • 212
  • Master Drunk
    • 165th Beer Drinking Hell Raisers
You could use the same 2 events and make them when-argument any-of with the wings listed. 
No-one ever listens to Zathras. Quite mad, they say. It is good that Zathras does not mind. He's even grown to like it. Oh yes. -Zathras

  
But each friendly wing has a separate enemy target.  How can I cram argument lists for BOTH friendly wings and enemy ships into one event?

It's a 30 on 30 rumble with cap-ships respawning the fighters, so 15 wings maximally at any time, to be exact.  The key is to keep AI fighters from trying to engage their targets while still too close to the cap ships, in which case they get raked with flak fire and other nastiness.

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
So each wing only has two fighters?

 

30+30=60

60/15=4

15 wings, 4 fighters apiece. 

7 friendly wings and 8 enemy just to make it a bit more challenging, so technically it's a 28 on 32 rumble  ;)

 
kara: The ai_remove_ship_goal exists, however, I couldn't find the equivalent for orders given to a wing.
STRONGTEA. Why can't the x86 be sane?

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq

30+30=60

60/15=4

15 wings, 4 fighters apiece. 

7 friendly wings and 8 enemy just to make it a bit more challenging, so technically it's a 28 on 32 rumble  ;)

Sorry, misread your post.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
kara: The ai_remove_ship_goal exists, however, I couldn't find the equivalent for orders given to a wing.

Yeah. I know. Goober says that he never got around to actually making the SEXP work. With the wing function missing it will take a little longer than 4-5 minutes but it should be possible.
« Last Edit: May 13, 2009, 02:40:22 am by karajorma »
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 
kara: Shall I take a crack at this one?
STRONGTEA. Why can't the x86 be sane?

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Feel free. When you're done, post a diff (just that fix) and I'll commit it for you.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Thanks guys

 
See attached diff:

Notes (There's always a caveat!):

1) This will remove the first instance of a specified goal, and only the goal found using ai_mode. Probably not quite what you're after (kara - could you please check if there's a way around this - I'm not sure that there is)
2) I'm not a FREDder, and I'm not sure how to actually go about testing this (but I'm learning, slowly!)
3) This needs a _complete_ review by someone who knows the ai system better than I do

This is quite a bit more complex than I thought it would be.
The patch does the following:
1) remove-goal now calls either ai_remove_ship_goal_sexp or ai_remove_wing_goal_sexp
2) Those functions call ai_remove_ship_goal_sexp which performs the following steps
 a) Parameter check
 b) Map the sexp to the AI_GOAL* structure, including checking for wings in GOAL_CHASE and GOAL_GUARD (_WINGS)
 c) Find the index of the goal in the aip->goals structure using ai_find_goal_index
 d) Remove the goal using ai_remove_ship_goal

There's also a potential buffer overflow fixed in the called function ai_get_goal_ship_name

oh, and most importantly: ENJOY


[attachment deleted by ninja]
STRONGTEA. Why can't the x86 be sane?

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Downloaded. I'll take a look at this tonight.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 
Ignore the change to ai.cpp - I don't think there is a problem there (wasn't sure about the order of operations with the postfix operator)
STRONGTEA. Why can't the x86 be sane?

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Damn. I forgot about this. I'll look at it in a little bit. And I agree with you about the ai.h change. It is unnecessary.
« Last Edit: May 21, 2009, 08:55:34 am by karajorma »
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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