December 22, 2024, 06:34:29

Author Topic: Behavior 4 as a 'holding pattern'  (Read 16211 times)

Offline Keldane

  • Specialist
  • *
  • Posts: 73
  • Karma: 0
    • View Profile
    • http://
Behavior 4 as a 'holding pattern'
« on: May 19, 2010, 05:34:04 »
I've read of using Behavior 4 to create wreck yards, which set me to wondering - how viable is using Behavior 4 to create hordes of ships that 'wait in the wings' until a condition is met (say, the AI fleet falling below a certain number of ships) before becoming active and entering the fray?

Offline The Old Dragon

  • Ensign
  • ***
  • Posts: 362
  • Karma: 6
    • View Profile
    • http://
(No subject)
« Reply #1 on: May 19, 2010, 14:34:55 »
I daresay that's a possibility.  A special race value would probably be best for selection and manipulation of the 'waiting ships'.  The scipting on it though would depend very heavily on the scene.

One problem would be getting coordinates for where the new ships appear...
Better to look the fool by asking, then prove them right with ignorance.

Offline Arparso

  • Administrator
  • Lieutenant
  • *****
  • Posts: 558
  • Karma: 14
  • I can see you...
    • View Profile
    • http://arparso.de/nexus
(No subject)
« Reply #2 on: May 19, 2010, 16:56:19 »
Sounds doable, although it's also possible to get new ships into a mission using CreateShip(). Depending on what you're trying to achieve in your mission, one way could have some benefits the other doesn't.

Offline Keldane

  • Specialist
  • *
  • Posts: 73
  • Karma: 0
    • View Profile
    • http://
(No subject)
« Reply #3 on: May 20, 2010, 00:40:01 »
If you'll pardon the language, I'm going for an "Oh shit, I'm up against all THAT?" response from the player - something to impress upon them just why they should care that particular forces in my mod are allying with one another. While in the first scenario I intend for this to occur in, the player's objective will be to flee, I do intend to use it in an epic 'wave after wave' battle towards the end of the narrative.

Obviously, it would also have its uses in having ships hiding in wreck yards, only to activate when the player passes, too. The player approaches a cluster of wrecks to see if any are salvageable, and is surprised to find that some of them aren't wrecks at all, but are in fact pirates waiting to spring an ambush.

Offline Mularac

  • Lieutenant
  • ***
  • Posts: 531
  • Karma: 11
    • View Profile
(No subject)
« Reply #4 on: May 20, 2010, 01:27:08 »
I beleive that method was also used by the devs in the original campaign, when they shoot the scene where were the combined fleets of Noah, the Gorgs and Vardrags.
Also, you might want to show that impressive fleet to the player in cinama mod, first. Keep in mind that asteroid-ships have no croshairs or lights to call their own, so they can easily be overseen by the player.

Offline Keldane

  • Specialist
  • *
  • Posts: 73
  • Karma: 0
    • View Profile
    • http://
(No subject)
« Reply #5 on: May 20, 2010, 02:24:17 »
I agree on both points, Mularac. I was picturing something along the lines of starting centered on the nav point, having three or four AI ships drop in right in front of the camera, and then have a dramatic sweep down the corridor of waiting ships to the point where the player's ships are moving from.

Offline Arparso

  • Administrator
  • Lieutenant
  • *****
  • Posts: 558
  • Karma: 14
  • I can see you...
    • View Profile
    • http://arparso.de/nexus
(no subject)
« Reply #6 on: May 20, 2010, 10:09:01 »
Actually, "asteroid ships" do have a crosshair. It only appears when being zoomed out quite a bit, though. ;)

The biggest problem with this approach for me is the appearance of ships with behaviour 4: their lights will be turned off and they won't animate or move, which makes them appear dead. That's great for wreckyard-turned-trap missions, but not so useful, if you want to create a menacing enemy fleet in the background. For the player to actually see the ships, you'd have to be near enough to them to recognize them being "dead".

You might be able to work around the lights-off- and no-animation-issue with not assigning a race to the ship. Like explained here, the ship wouldn't turn off its lights or default animation when being not assigned to a race. They'd still not move anywhere, but at least they should look more menacing that way. I believe, there's a way to later assign them the correct race while "activating" them to join the battle.
« Last Edit: December 08, 2010, 12:26:10 by Arparso »

Offline The Old Dragon

  • Ensign
  • ***
  • Posts: 362
  • Karma: 6
    • View Profile
    • http://
(No subject)
« Reply #7 on: May 20, 2010, 14:22:16 »
I think you can change an objects race with the following...

Obj:race:=#race_******;

(Amend red sections with your details)
Better to look the fool by asking, then prove them right with ignorance.

Offline Keldane

  • Specialist
  • *
  • Posts: 73
  • Karma: 0
    • View Profile
    • http://
(No subject)
« Reply #8 on: May 20, 2010, 21:14:16 »
So if I'm not assigning a race to the waiting ships at the start, what would be the best way to figure out which one is the closest to the player's main ship and change its behavior?

Offline Arparso

  • Administrator
  • Lieutenant
  • *****
  • Posts: 558
  • Karma: 14
  • I can see you...
    • View Profile
    • http://arparso.de/nexus
(No subject)
« Reply #9 on: May 20, 2010, 22:18:29 »
Assuming m.playerShip is the player's ship you want to check against, something like that should work:

Code: [Select]
// get new selection and fill it with behaviour-4-ships, but not asteroids
e.inactiveEnemies := GetFreeSel();
Select(e.inactiveEnemies, s.behaviour = 4 & Not(s.class >= 99 & s.class <= 134));

Debug("## Inactive Enemies"); Dump(e.inactiveEnemies);

// pick the one, that's closest to the player's main ship
e.closestEnemy := PickMax(e.inactiveEnemies, 1 / distance(s.this, m.playerShip));
Debug("Closest enemy is", e.closestEnemy);

// clean up
DeleteSelect(e.inactiveEnemies);

When selecting the behaviour-4-ships, you'll want to make sure not to select any asteroids in the scene, so I've included a condition based on the ship's class. Shipclasses 99 to 134 are asteroids in my mod... it may be different in yours, so adjust accordingly.

Offline The Old Dragon

  • Ensign
  • ***
  • Posts: 362
  • Karma: 6
    • View Profile
    • http://
(No subject)
« Reply #10 on: May 21, 2010, 00:03:54 »
As you're talking about asteroids...

For those who modify or write their own tacticstypes.ini, I strongly recommend leaving the asteroids where they are!
During my efforts with the Aurora project, I rearranged and cleared out the tacticstypes.ini which included the shipclass numbers being reassigned. I had quite a few 'anomalies' where asteroid meshes would appear in addition to where the ship mesh was and if I tried to create an asteroid field with the mission editor, then I got an instant CTD.  Even if I created an asteroid field with the normal tacticstypes.ini in a standard mod, then copied the entities section data straight from that mission into the amended tacticstypes.ini mod mission, as soon as I tried to load the mission it was straight back to the desktop.

As always, I tend to suspect a little 'operator error' when I run into these problems, but I also believe that parts of the asteroid side of the game may be hardcoded too.
Better to look the fool by asking, then prove them right with ignorance.

Offline Keldane

  • Specialist
  • *
  • Posts: 73
  • Karma: 0
    • View Profile
    • http://
(No subject)
« Reply #11 on: May 21, 2010, 02:26:03 »
Thanks for that, Arparso! I'll have to look up all the commands you used so that I can properly understand what you did there.

Would it not also be possible to select any fatally damaged ships and convert them to Behavior 4 to clear sufficient space for additional ships to arrive?

Offline The Old Dragon

  • Ensign
  • ***
  • Posts: 362
  • Karma: 6
    • View Profile
    • http://
(No subject)
« Reply #12 on: May 21, 2010, 08:47:34 »
You colud try something like...

Code: [Select]
E.Deadships:=GetFreeSel();
Select(E.Deadships,S.this:behaviour=2);
ExecList(E.Deadships,S.this:Behaviour:=4);
DeleteSelect(E.Deadships);
Better to look the fool by asking, then prove them right with ignorance.

Offline Arparso

  • Administrator
  • Lieutenant
  • *****
  • Posts: 558
  • Karma: 14
  • I can see you...
    • View Profile
    • http://arparso.de/nexus
(No subject)
« Reply #13 on: May 21, 2010, 09:42:33 »
Even shorter: ;)

Code: [Select]
SelectEx(s.behaviour = 2, s.this:behaviour := 4);

Offline Mularac

  • Lieutenant
  • ***
  • Posts: 531
  • Karma: 11
    • View Profile
(No subject)
« Reply #14 on: June 07, 2010, 01:08:20 »
Small addendum: if you are after a true wreckyard, perhaps it would be best if the crosshair in each ship wouldn't appear at all, if you want that all you have to do is set the race_wreck race GUIcolor to 0 0 0 0.
in example:

Code: [Select]
RACE # //race's number
Name "race_wreck"
Civilization # //the number of the cilization this race belongs to
GUIColor 0 0 0 0 // non-existent
RACE