Author Topic: Ai Woes  (Read 2047 times)

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
Ai Woes
« on: September 12, 2009, 08:15:15 PM »
Does anyone have any ideas on spawning some AI scouts and making them annoyingly run amok through your base?  I tried spawning some Scouts after about 5 marks and putting them in a group, but OP2 crashes.
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

Offline Hidiot

  • Hero Member
  • *****
  • Posts: 1018
Ai Woes
« Reply #1 on: September 13, 2009, 03:36:48 AM »
Curious...

I have created units (lots of them, in for-s) and immediately given them an order and it worked, so I assume putting them in a group should also work without problems.

I guess that, well... the code you wrote for that part might be relevant?
"Nothing from nowhere, I'm no one at all"

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Ai Woes
« Reply #2 on: September 13, 2009, 02:28:10 PM »
Yeah, these problems are usually a little easier to diagnose if you post some code.
 

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
Ai Woes
« Reply #3 on: September 13, 2009, 08:25:11 PM »
Yes, except, like I said, I never got past spawning the scouts, so my code is basically:
Code: [Select]
//This occurs after a five-mark delay:
TethysGame::CreateUnit(Unit1, mapScout, ...);
AIScouts.TakeUnit(Unit1);

Attempting to add the Scouts to the group was what caused the crash, so I decided not to waste my time writing code I couldn't use.

I'm glad I was able to use a little exploit I discovered to automate arbitrarily spawned AI combat units!

Edit: Never mind.  I found out what was wrong: a stupid typo...

Off-topic edit: HAX!  I got missions objectives in a saved game to not crash somehow.  I must research how I did it though.  I think it involves updating the mission objective list by completing an objective, or possibly by adding a new one.  I'll get back to you as soon as I can...
« Last Edit: September 14, 2009, 05:39:33 PM by Sirbomber »
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Ai Woes
« Reply #4 on: September 16, 2009, 12:55:18 AM »
That sounds like something Eddy-B once posted about. I think the group needs more initialization before it can accept units. I vaguely remember something about setting a rect. I suppose the units need somewhere to hang out around when they're added to a group.