Sign up Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
Zombiewski

Registered:
Posts: 1
Reply with quote  #1 
I've just started script for my first mission, and I'm trying to have AI ships travel to a certain point.  I'd like to have several fleets of ships throughout the map, all travelling on their way until interrupted by the players.

Can you change the attributes of multiple objects in one tab, like this?
<clear_ai name=”KR01” name=”KR02” name=”KR03” name=”KR04” name=”KR05”/>

Or would it be easier to do it by fleetnumber?  <clear_ai fleetnumber=”1”/>

Or does each ship need its own AI stack?  And does it matter where in the script the AI stack is?

<!--- add 5 enemy ships near player’s start -->

<create type ="enemy" raceKeys="Kralien enemy" name="KR01" hullKeys="small" x="75000" y="0" z="49900" angle="120" fleetnumber="1"/>

<clear_ai name="KR01"/>

<add_ai type="TARGET_THROTTLE" name="KR01" targetName="ALIEN OUTPOST A" throttle=”200”/>

<add_ai type="CHASE_ANGER" name="KR01"/>

<add_ai type=”TRY_TO_BECOME_LEADER”/>

<create type ="enemy" raceKeys="Kralien enemy" name="KR02" hullKeys="small" x="75000" y="0" z="50000" angle="120" fleetnumber="1"/>

<clear_ai name="KR02"/>

<add_ai type="TARGET_THROTTLE" name="KR02" targetName="ALIEN OUTPOST A" throttle=”200”/>

<add_ai type="CHASE_ANGER" name="KR02"/>

<create type ="enemy" raceKeys="Kralien enemy" name="KR03" hullKeys="small" x="75000" y="0" z="50100" angle="120" fleetnumber="1"/>

<clear_ai name="KR03"/>

<add_ai type="TARGET_THROTTLE" name="KR03" targetName="ALIEN OUTPOST A" throttle=”200”/>

<add_ai type="CHASE_ANGER" name="KR03"/>

<create type ="enemy" raceKeys="Kralien enemy" name="KR04" hullKeys="small" x="75000" y="0" z="50200" angle="120" fleetnumber="1"/>

<clear_ai name="KR04"/>

<add_ai type="TARGET_THROTTLE" name="KR01" targetName="ALIEN OUTPOST A" throttle=”200”/>

<add_ai type="CHASE_ANGER" name="KR04"/>

<create type ="enemy" raceKeys="Kralien enemy" name="KR05" hullKeys="small" x="75000" y="0" z="50300" angle="120" fleetnumber="1"/>

<clear_ai name="KR05"/>

<add_ai type="TARGET_THROTTLE" name="KR01" targetName="ALIEN OUTPOST A" throttle=”200”/>

<add_ai type="CHASE_ANGER" name="KR05"/>

<add_ai type="CHASE_STATION" name="KR02" targetName="OUTPOST ALPHA"/>

Mike Substelny

Avatar / Picture

Administrator
Registered:
Posts: 2,404
Reply with quote  #2 
No matter what you do you must set the AI stack of every ship individually. Each ship will require multiple lines of code to clear and rebuild its AI stacks.

You *could* save a few lines of code by setting each fleet so that only one ship ever tries to become the leader, then set that leader ship to pursue the point in question. But then you might not like the behavior of the fleets when their leaders are destroyed.

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

Registered:
Posts: 1,141
Reply with quote  #3 
Mike, there is a way to spawn ships and rename them after. Is it possible to set some kind of random naming code in the script? That way, all ships could be spawned with the same name. The first ship spawned could have the ai set and then the ship renamed randomly. Repeat over and over and eventually all ships would have particular AI set. It does depend on being able to use a random generator to set the name. It would work even if the ship was just an integer and the letter was dropped.... come to think of it, I wonder if you could use a randomly set variable, and name the ship after that variable... ooo ideas springing up now.
__________________
Fleet Captain Xavier Wise - TSN Sabre
Link to TSN RP Community website
ryleyra

Registered:
Posts: 3,009
Reply with quote  #4 
Quote:
Originally Posted by Xavier Wise
Mike, there is a way to spawn ships and rename them after. Is it possible to set some kind of random naming code in the script? That way, all ships could be spawned with the same name. The first ship spawned could have the ai set and then the ship renamed randomly. Repeat over and over and eventually all ships would have particular AI set. It does depend on being able to use a random generator to set the name. It would work even if the ship was just an integer and the letter was dropped.... come to think of it, I wonder if you could use a randomly set variable, and name the ship after that variable... ooo ideas springing up now.


Variables can only be used as numeric values, unfortunately. I've thought of that, and there's no way to do it. (You can't assign a variable to any string property, the variable name is taken literally) I guess the best you can do is make them LOOK random, but the same names will appear every time you run the script.

It would be really useful to be able to rename ships. Particularly if you could rename them randomly. Alternately, maybe a ship could be assigned an ID, which could be used to refer to it instead of its name. This could actually be a way to get around the multiship problem, since player ships could be given static IDs based on their slot number, and then you wouldn't have to have preset names.

I realize Thom is busy, but this could be a big help.

Arrew

Avatar / Picture

Registered:
Posts: 2,737
Reply with quote  #5 
Doesn't the change ship text also let you change name, but to specific name not random?

Though I'be never used it.
Mike Substelny

Avatar / Picture

Administrator
Registered:
Posts: 2,404
Reply with quote  #6 
Quote:
Originally Posted by Xavier Wise
Mike, there is a way to spawn ships and rename them after. Is it possible to set some kind of random naming code in the script? That way, all ships could be spawned with the same name. The first ship spawned could have the ai set and then the ship renamed randomly. Repeat over and over and eventually all ships would have particular AI set. It does depend on being able to use a random generator to set the name. It would work even if the ship was just an integer and the letter was dropped.... come to think of it, I wonder if you could use a randomly set variable, and name the ship after that variable... ooo ideas springing up now.


You can create a ship with a random name simply by leaving out the name. But then the script can never address that ship to change or check any of its parameters.

You cannot change the name of a named object. You could destroy the object and create a new one with a different name, but that doesn't accomplish what you want.

The only exception is when you use the GM selection. If the GM selects an object then you can do anything you want to it without knowing its name.

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

Avatar / Picture

Administrator
Registered:
Posts: 2,404
Reply with quote  #7 
Quote:
Originally Posted by Arrew
Doesn't the change ship text also let you change name, but to specific name not random? Though I'be never used it.


Sadly, the change_ship_text command requires <name> as one of its parameters so the name cannot be changed by that command.

__________________
"The Admiralty had demanded six ships; the economists offered four; and we finally compromised on eight."
- Winston Churchill
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.