Built In Escorts For Player Ships

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

User avatar
mandoman
---- E L I T E ----
---- E L I T E ----
Posts: 1375
Joined: Thu Apr 28, 2011 3:17 pm

Re: Built In Escorts For Player Ships

Post by mandoman »

I'm not doing any more to it till someone tells me what I'm doing wrong, since I don't seem to be solving the problem. Any advice?
Mandotech Industries Wiki Page.

http://wiki.alioth.net/index.php/User:Mandoman
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Built In Escorts For Player Ships

Post by cim »

If this.ship isn't defined, then that suggests this isn't being set up properly as a ship script.

Make sure that the script file is:
- not listed in your world-scripts.plist (or it will try to apply it to the player's ship, rather than the Solarwing)
- listed in your shipdata.plist entry for that ship with

Code: Select all

script = "yourScriptFile.js"
This line

Code: Select all

this.ship.group.leader = (SunBird);
should be removed. Provided the ship is appearing as an escort, this will be correctly set up for you.

Of course, if it's appearing as a ship that's not an escort at any time, that could break the current code. Replace

Code: Select all

if (worldScripts["Escort Formations Randomiser"]) {
with

Code: Select all

if (worldScripts["Escort Formations Randomiser"] && this.ship.group && this.ship.group.leader) {
to check for that properly (sorry, I should have noticed that one earlier)
User avatar
mandoman
---- E L I T E ----
---- E L I T E ----
Posts: 1375
Joined: Thu Apr 28, 2011 3:17 pm

Re: Built In Escorts For Player Ships

Post by mandoman »

Sorry? Cim, I'm just grateful for your help. I'll make the changes, and report back. Thanks. :)
Mandotech Industries Wiki Page.

http://wiki.alioth.net/index.php/User:Mandoman
User avatar
mandoman
---- E L I T E ----
---- E L I T E ----
Posts: 1375
Joined: Thu Apr 28, 2011 3:17 pm

Re: Built In Escorts For Player Ships

Post by mandoman »

So if the java script for a non-player ship is in the shipdata.plist, there shouldn't be a world-scrpts.plist? I thought all .js were to be listed in world-scripts.plist. So if the java script for a ship isn't meant for the player version, there shouldn't be a world-scripts.plist? Sorry, it's kind of confusing.
Mandotech Industries Wiki Page.

http://wiki.alioth.net/index.php/User:Mandoman
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: Built In Escorts For Player Ships

Post by Smivs »

No. Ship-scripts are specified in the shipdata.plist of the ship/s to which they apply. World-scripts are listed in the worldscripts.plist (which is in the Config folder). All the actual scripts themselves go in the Scripts folder together.
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: Built In Escorts For Player Ships

Post by Eric Walch »

I have actually no clue what people are trying to do here. At several places it is written that players can't have escorts. So if you want to simulate them, you have to do it with special AI and shipscripts and not by manipulating escort positions. They are ignored anyway for the player.
User avatar
mandoman
---- E L I T E ----
---- E L I T E ----
Posts: 1375
Joined: Thu Apr 28, 2011 3:17 pm

Re: Built In Escorts For Player Ships

Post by mandoman »

Smivs wrote:
No. Ship-scripts are specified in the shipdata.plist of the ship/s to which they apply. World-scripts are listed in the worldscripts.plist (which is in the Config folder). All the actual scripts themselves go in the Scripts folder together.
That's the way I had it set up, Smivs, but it was generating the error reports I showed from Latest.log. I took away the world-scripts.plist from the Config folder, and the error messages stopped. However, I left the scripts = "solarwing-escort_formation.js" line in the shipdata entry for the SolarWing-escort. All the scripts mentioned in shipdata.plist are in a folder labeled "Scripts". So, you are saying that I indeed do need to have a world-scripts.plist in the Config folder for all scripts mentioned in shipdata.plist? Cim seemed to be saying that doing so would make it apply to the player ship, which isn't what I intend.
Eric Walch wrote:
I have actually no clue what people are trying to do here. At several places it is written that players can't have escorts. So if you want to simulate them, you have to do it with special AI and shipscripts and not by manipulating escort positions. They are ignored anyway for the player.
Yeah, sorry Eric, I had already given up on the escorts for player ships, but was just trying to figure out how to use Cim's escort-formations.oxp for my own NPC ships, as he is saying can be done in the ReadMe file.
Mandotech Industries Wiki Page.

http://wiki.alioth.net/index.php/User:Mandoman
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: Built In Escorts For Player Ships

Post by Smivs »

mandoman wrote:
So, you are saying that I indeed do need to have a world-scripts.plist in the Config folder for all scripts mentioned in shipdata.plist?
No.
A script listed in the shipdata.plist is a ship-script. This is to make NPCs do things or to make things happen in respect to that ship, for example make it spawn an escape capsule if it is taking damage. This is a ship-script and is therefore NOT listed in the world-scripts.plist in the Config folder.
A world-script is one that has more general effects, such as spawning ships when you exit witchspace. These (world-scripts) are the ones that must be listed in the world-scripts.plist.
All the scripts (both ship-scripts AND world-scripts) go in the OXP's Scripts folder together.
If I understand what you are looking for, as Eric pointed out, your escorts will need a ship-script to work and an AI. The actual ship-script would go in the Scripts folder and would be a function of the shipdata.plist for the escort ship (and is NOT listed in the world-scripts.plist becaue it is a ship-script, not a world-script).
You will probably also need a world-script to spawn the escort ships. As it is a world-script, this WOULD need to be listed in the world-scripts.plist.

Ha, just noticed you've decided against the 'escorts for the player' option.
If you just want your NPCs to have the Escort Formations from cim's OXP, surely all you need is cim's OXP installed as well?
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
mandoman
---- E L I T E ----
---- E L I T E ----
Posts: 1375
Joined: Thu Apr 28, 2011 3:17 pm

Re: Built In Escorts For Player Ships

Post by mandoman »

Smivs, yeah, that's how I have it now. The only scripts for the SolarWing were the original one written by Tricky, and the one cim helped me slap together for escort formations. Both are for NPC ships, so I took world-scripts.plist out, and only have the two scripts in the Scripts folder. I spotted a SolarWing in the game last night, and started following it to see how it behaved. The intended AI is suppose to make it a patrolling Bounty Hunter, attacking offenders for the bounty on them. It didn't attack even one. It just flew out to the Witch Space Beacon, and then turned around and flew back to the station. That might have something to do with the world-scripts.plist not having been removed yet, though, as the solarwingAI.plist uses the solarwing.js to control it's actions toward Offender ships. I'm going to have to find another SolarWing and follow it around to see if anything changed in it's behavior. It's kind of interesting watching something like that, even if it doesn't do exactly what you intended. :D
Mandotech Industries Wiki Page.

http://wiki.alioth.net/index.php/User:Mandoman
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: Built In Escorts For Player Ships

Post by Smivs »

mandoman wrote:
Smivs, yeah, that's how I have it now. The only scripts for the SolarWing were the original one written by Tricky, and the one cim helped me slap together for escort formations. Both are for NPC ships, so I took world-scripts.plist out, and only have the two scripts in the Scripts folder.
Are you sure that's right? The script for Escort Formations OXP is a world-script, so I'm guessing the one cim did for you is as well. That might be worth checking.
mandoman wrote:
I spotted a SolarWing in the game last night, and started following it to see how it behaved. The intended AI is suppose to make it a patrolling Bounty Hunter, attacking offenders for the bounty on them. It didn't attack even one. It just flew out to the Witch Space Beacon, and then turned around and flew back to the station. That might have something to do with the world-scripts.plist not having been removed yet, though, as the solarwingAI.plist uses the solarwing.js to control it's actions toward Offender ships. I'm going to have to find another SolarWing and follow it around to see if anything changed in it's behavior. It's kind of interesting watching something like that, even if it doesn't do exactly what you intended. :D
I had a similar problem with my Contractor AI/script recently, now sorted out, but yes it is fascinating watching NPC behaviour, and also slightly annoying when they don't do what you want them to. If it is working you should find a pretty immediate effect , so it sounds like something is still wrong there.
From what you've said, the solarwing.js is a ship-script (listed in the shipdata.plist) so yes it should not be mentioned in the world-scripts.plist. However, as I said above, the 'formation' script probably is a world-script, and if so it must be listed in a world-scripts.plist otherwise it won't work.
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
mandoman
---- E L I T E ----
---- E L I T E ----
Posts: 1375
Joined: Thu Apr 28, 2011 3:17 pm

Re: Built In Escorts For Player Ships

Post by mandoman »

Okay, I think I see what you mean. If the script I assign an NPC ship is controlled, or affected by an oxp, or core script, that makes it one to be in the world-scripts.plist? I know I'm slow at this, but I sure do appreciate the help. Like you said, it's really fun to watch a ship I've created behave in the way I wanted.
Mandotech Industries Wiki Page.

http://wiki.alioth.net/index.php/User:Mandoman
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: Built In Escorts For Player Ships

Post by Smivs »

mandoman wrote:
Okay, I think I see what you mean. If the script I assign an NPC ship is controlled, or affected by an oxp, or core script, that makes it one to be in the world-scripts.plist?
No it's nothing to do with other scripts. A ship-script is one attached to a specific ship and is called from the shipdata.plist. A world-script is more general and is called from the world-scripts.plist.
If you want a simple example of the relationship take a look at my silly Space Pizza OXP.
It has one world-script (which controls the spawning of the pizzas and visitor centres, and the mission screens and the 'stages' as you visit each one) and is called from the world-scripts.plist.
It also has a ship-script attached to the visitor centres (called from the shipdata.plist) and this controls the flashing neon signs on the visitor centre.
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Built In Escorts For Player Ships

Post by cim »

mandoman wrote:
as the solarwingAI.plist uses the solarwing.js to control it's actions toward Offender ships.
Ah! It's already got a ship script. That explains things.

In that case, just put the this.shipSpawned function in at the bottom of the solarwing.js script Tricky gave you, and you can get rid of the second file entirely.

(Of course, if it's a patrolling bounty hunter with a custom AI, it probably isn't part of an escort group, so you won't see any changes in that role - but if you use the same ship elsewhere as an escort, it will work there)
Post Reply