Sign up Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
13Clocks

Registered:
Posts: 27
Reply with quote  #1 
I apologise if this is a newbie question, but here goes.  How do I make two AI-controlled ships fight each other?  Specifically, I'm trying to write a mission where the player ship gets way in over its head with a very powerful enemy, but an even stronger ship appears out of nowhere and saves them.  I'd like this to happen fairly automatically, and I'd like anyone who's watching to actually see beams being fired between the two ships, torpedoes if possible, shields, damage, et cetera, rather than just the new ship appearing and the old one exploding.  Is that something you can do with the current mission-scripting options?  Thanks.
Xavier Wise

Registered:
Posts: 1,038
Reply with quote  #2 
It's relatively straightforward to do. All ships have a side value. If you want two ships to appear as enemies to the player, but fight each other, just set them to different side values, e.g. 4 and 5. When you add AI, have commands to attack AI ships added in the right place and you're sorted. I can probaby send over AI code to add if you explain what behaviour you want the ship to do e.g. attack the enemy AI vessel, unless the player is in range x, etc.
__________________
Fleet Captain Xavier Wise - TSN Sabre
Link to TSN RP Community website
ryleyra

Registered:
Posts: 2,870
Reply with quote  #3 
Just remember that 1 is the normal enemy side value, and 2 is the normal player side value. Any number from 3 on will work fine, and you can have sides 1 and 3 fight each other if you want.
Mike Substelny

Avatar / Picture

Administrator
Registered:
Posts: 2,115
Reply with quote  #4 
You can make the enemy side 1, the player side 2, and the "savior" side 3. Just remember to build the savior's brain stack so that it is only interested in the enemy.
__________________
"The Admiralty had demanded six ships; the economists offered four; and we finally compromised on eight."
- Winston Churchill
Menbailee

Registered:
Posts: 48
Reply with quote  #5 
Is it possible to have two ships appear as *friendly* to the player and have one shoot the other?  Issuing an attack order to two ships on Side 2 just results in an amusing game of bumper cars, as far as I can see when testing.
Mike Substelny

Avatar / Picture

Administrator
Registered:
Posts: 2,115
Reply with quote  #6 
I think it's impossible to get an AI ship to shoot at a target with the same sideValue.

Nevertheless, your script can change one ship's sideValue for one one second. That ought to be enough time to get off a shot. After a second change it back to sideValue = 2.

I like the story possibilities here, but frankly I don't think having a friendly ship fire a shot is that important. Players won't see the shot unless they looking at it on the mian viewer at the right moment. In my experience players in my scripts see less than 10% of the stuff I put on the main viewer. They spend 90% of their time looking at Long Range Scan and the other 10% of the time they are usually facing the wrong direction.

My suggestion for simulating the moment of the friendly-fire attack:
  1. Have your script take a chunk out of TargetShip's shields to simulate a hit.
  2. Have TargetShip send a message to Communications "Artemis! FiringShip just opened fire on TargetShip! Please help us!"
This will achieve everything you want except for a visual beam blast on the main viewer, and more crews never see those anyway.

__________________
"The Admiralty had demanded six ships; the economists offered four; and we finally compromised on eight."
- Winston Churchill
Menbailee

Registered:
Posts: 48
Reply with quote  #7 
My crew uses the main view screen a little more because our tactical officer thinks it's pretty, but nevertheless just scripting some hails and shield loss sounds like the best way to go.  Thanks!
GinZ

Registered:
Posts: 1
Reply with quote  #8 
What if I want crew of Artemis to decide which side to pick in ongoing fight?
Reading the wiki I came under impression that setting sideValue to 0 should result in a neutral ship, similar to ship that have surrendered, but that did not work for me. Any ship or station with sideValue other than two appears red and starts attacking player ship.
Is there a way to produce surrendered ship and then change it's brain stack?
Also on related note, is it possible to change player ship's sideValue?
Mike Substelny

Avatar / Picture

Administrator
Registered:
Posts: 2,115
Reply with quote  #9 
It is easy for a script to change a player ship's SideValue.

You can set the hasSurrendered property of an AI ship. I have never tried writing to the brain stack of a surrendered ship, though.

Any time two AI ships shoot at each other, at least one of them will appear red on the players' displays.

__________________
"The Admiralty had demanded six ships; the economists offered four; and we finally compromised on eight."
- Winston Churchill
ryleyra

Registered:
Posts: 2,870
Reply with quote  #10 
Quote:
Originally Posted by Mike Substelny

You can set the hasSurrendered property of an AI ship. I have never tried writing to the brain stack of a surrendered ship, though.


I'm not sure, but I think I did try messing with the AI. IIRC, the "hasSurrendered" state overrides it. You may be able to change the destination of the ship with the targetX and targetZ property, but I haven't tried that.

Since the ship will say in its brain stack status that it has surrendered and thus will ignore certain AI commands, I suspect there's only a handful of commands, if any, that will still work. It should also be noted that PROCEED_TO_EXIT is ignored by enemy ships. They don't respond to exitPointX and exitPointY and PROCEED_TO_EXIT doesn't direct them to targetX and targetZ.

Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.