Scripters cove
Moderators: winston, another_commander
- Rorschachhamster
- ---- E L I T E ----
- Posts: 274
- Joined: Sun Aug 05, 2012 11:46 pm
- Contact:
Re: Scripters cove
Is there an easy way to change the escort_ship from the shipdata.plist, or assign the role of a certain escort, in the this.shipSpawned function?
- Amah
- ---- E L I T E ----
- Posts: 486
- Joined: Tue Aug 28, 2012 8:05 pm
- Location: aboard the Laenina Crowne - Yasen-N class space freighter
- Contact:
Re: Scripters cove
Hmmh, do you want a certain shiptype like only sidewinders?
escort_roles = (
{ role = "[sidewinder-escort]"; min = -2; max = 4; },
);
escort_roles = (
{ role = "[sidewinder-escort]"; min = -2; max = 4; },
);
Amah
- about Amah: wiki
- noshaders versions of Griff's extra, alternate ships and accessories: discussion, wiki
- ocpc - customize the player ship: discussion, oxp repository
Re: Scripters cove
If you want to do something about the escorts after the ship has been spawned, you need to remove the possible spawned escorts and replace them with new ones.
- Rorschachhamster
- ---- E L I T E ----
- Posts: 274
- Joined: Sun Aug 05, 2012 11:46 pm
- Contact:
Re: Scripters cove
No, that's not it, I wanted to do that in script, not in the .plist, because of reasons...Amah wrote:Hmmh, do you want a certain shiptype like only sidewinders?
escort_roles = (
{ role = "[sidewinder-escort]"; min = -2; max = 4; },
);
spara wrote:If you want to do something about the escorts after the ship has been spawned, you need to remove the possible spawned escorts and replace them with new ones.
Thanks, that gave me an idea: Maybe I should get rid of the escorts in the shipdata.plist and add them in the script that spawns the ship, instead of the script that fires when the ship is spawned... Maybe...
- phkb
- Impressively Grand Sub-Admiral
- Posts: 4830
- Joined: Tue Jan 21, 2014 10:37 pm
- Location: Writing more OXPs, because the world needs more OXPs.
Re: Scripters cove
I do a lot of this escort adding type stuff in Station Dock Control. The biggest issue I faced was how to add escorts to launching ships. I had to set timers to wait until the mothership had really launched before adding escorts to it.
- Rorschachhamster
- ---- E L I T E ----
- Posts: 274
- Joined: Sun Aug 05, 2012 11:46 pm
- Contact:
Re: Scripters cove
Thanks, I took a look at your code, and I know now what to do... I think...phkb wrote:I do a lot of this escort adding type stuff in Station Dock Control. The biggest issue I faced was how to add escorts to launching ships. I had to set timers to wait until the mothership had really launched before adding escorts to it.
- Rorschachhamster
- ---- E L I T E ----
- Posts: 274
- Joined: Sun Aug 05, 2012 11:46 pm
- Contact:
Re: Scripters cove
No, I don't.
So, the escortGroup of a ship is a ship group, isn't it? Shouldn#t I be able to add a ship to it via addShip?
So, the escortGroup of a ship is a ship group, isn't it? Shouldn#t I be able to add a ship to it via addShip?
Code: Select all
motherShip.escortGroup.addShip(otherShip);
- phkb
- Impressively Grand Sub-Admiral
- Posts: 4830
- Joined: Tue Jan 21, 2014 10:37 pm
- Location: Writing more OXPs, because the world needs more OXPs.
Re: Scripters cove
No, escorts are handled differently. You need something like:
Code: Select all
var returnValue = escortShip.offerToEscort(motherShip);
- phkb
- Impressively Grand Sub-Admiral
- Posts: 4830
- Joined: Tue Jan 21, 2014 10:37 pm
- Location: Writing more OXPs, because the world needs more OXPs.
Re: Scripters cove
If I have an equipment key, is there any way I can find out if it's available for purchase at the current docked station? Without going to the F3 screen and eyeballing it, I mean.
- Norby
- ---- E L I T E ----
- Posts: 2577
- Joined: Mon May 20, 2013 9:53 pm
- Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
- Contact:
Re: Scripters cove
There is no general way, but if it is in your OXP then you can set a variable in a worldScript within a condition script when allowAwardEquipment return true. In the case of others you can only roughly mimic the decision by comparing the techlevel, checking if it is already installed, copy the functions from condition scripts of all OXPs and update at every change of the original, etc.phkb wrote:If I have an equipment key, is there any way I can find out if it's available for purchase at the current docked station? Without going to the F3 screen and eyeballing it, I mean.
-
- ---- E L I T E ----
- Posts: 591
- Joined: Sun Jul 12, 2015 2:30 pm
- Location: Bavaria, Germany
- Contact:
Re: Scripters cove
If there are two (or more) OXPs containing a "shipSpawned" function, let's say, one for naming the ship and one for adjusting other properties (weapons, equipment, textures), is there any way to control which of the functions is called first? Is the calling sequence determined by the installation order of the OXPs or by something else, or is it completely random?
I want to create an OXP defining "company freighters" having different textures and other properties. I also want these ships to have special names based on company-specific naming schemes. So far, so good, but what about the OXP "Random Ship Names"? Luckily its "shipSpawned" function actually checks if the ship already has a name, but that would only be useful if my "shipSpawned" function is called first. In the other case, my OXP would have to rename a ship that already has been given a name. This would work of course, but it wouldn't be very elegant from a programmers perspective (and the name would be 'wasted', i.e. deleted from the name lists of Random Ship Names).
I want to create an OXP defining "company freighters" having different textures and other properties. I also want these ships to have special names based on company-specific naming schemes. So far, so good, but what about the OXP "Random Ship Names"? Luckily its "shipSpawned" function actually checks if the ship already has a name, but that would only be useful if my "shipSpawned" function is called first. In the other case, my OXP would have to rename a ship that already has been given a name. This would work of course, but it wouldn't be very elegant from a programmers perspective (and the name would be 'wasted', i.e. deleted from the name lists of Random Ship Names).
"You wouldn't kill me just for a few credits, would you?" – "No, I'll do it just for the fun!"
- Norby
- ---- E L I T E ----
- Posts: 2577
- Joined: Mon May 20, 2013 9:53 pm
- Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
- Contact:
Re: Scripters cove
Unfortunately is not, only the manually installed OXPs comes later than managed OXZs. The order between packages in the same folder is determined by the filesystem, in Windows this is the order of installation but random under Linux.Fritz wrote:is there any way to control which of the functions is called first?
-
- ---- E L I T E ----
- Posts: 591
- Joined: Sun Jul 12, 2015 2:30 pm
- Location: Bavaria, Germany
- Contact:
Re: Scripters cove
Thank you! I'll try to program it so that it should work in either case.
Probably it's impossible to make every OXP work (and test it) with very other OXP, but is there a simple and recommended method to check if a certain OXP is installed?
Probably it's impossible to make every OXP work (and test it) with very other OXP, but is there a simple and recommended method to check if a certain OXP is installed?
"You wouldn't kill me just for a few credits, would you?" – "No, I'll do it just for the fun!"
- Norby
- ---- E L I T E ----
- Posts: 2577
- Joined: Mon May 20, 2013 9:53 pm
- Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
- Contact:
Re: Scripters cove
Only those which contain a worldscript:Fritz wrote:a simple and recommended method to check if a certain OXP is installed?
Code: Select all
if( worldScripts["name"] )
-
- ---- E L I T E ----
- Posts: 591
- Joined: Sun Jul 12, 2015 2:30 pm
- Location: Bavaria, Germany
- Contact:
Re: Scripters cove
True... my own player-ship OXP doesn't have a script. Is it "officially" recommended to supply a dummy script containing nothing else than this.name or would this create unnecessary overhead?
"You wouldn't kill me just for a few credits, would you?" – "No, I'll do it just for the fun!"