is it possible to use the "allowOfferShip" function to make a ship only available for purchase at one station/system?
Is it possible to control the appearance of subents? eg, if i had a station w/ a couple of sub ent ships docked outside, could a script/whatever randomly make one or more of them disappear so the station always looked different?
TIA
Conditional Stuff
Moderators: winston, another_commander
- Killer Wolf
- ---- E L I T E ----
- Posts: 2278
- Joined: Tue Jan 02, 2007 12:38 pm
Re: Conditional Stuff
At one system - yes:Killer Wolf wrote: ↑Thu Sep 21, 2023 7:58 amis it possible to use the "allowOfferShip" function to make a ship only available for purchase at one station/system?
Code: Select all
this.allowOfferShip = function(shipkey) {
if(galaxyNumber === 0 && system.ID === 7) // Lave
return true;
else
return false;
}
shipSpawned
event.You can let them all appear and then remove the ones you don't need. But adding back removed subentities is quite troublesome and in some cases it can be easier instead of removing to hide a subentity inside the main entity if it is big enough.Killer Wolf wrote: ↑Thu Sep 21, 2023 7:58 amIs it possible to control the appearance of subents? eg, if i had a station w/ a couple of sub ent ships docked outside, could a script/whatever randomly make one or more of them disappear so the station always looked different?
TIA
Here is how to remove some subentities on the station's spawn:
Code: Select all
this.shipSpawned = function() {
var subEntities = this.ship.subEntities;
var i = subEntities.length;
while(i--) {
if(Math.random() < 0.1) // 10% chance each subentity to be removed
subEntities[i].remove();
}
}
- 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: Conditional Stuff
You can do it, but you have to add all of them back at once, and then go through the list again and remove the ones you don't want.
To restore all subentities use:
Code: Select all
mystation.restoreSubEntities();
- Killer Wolf
- ---- E L I T E ----
- Posts: 2278
- Joined: Tue Jan 02, 2007 12:38 pm
Re: Conditional Stuff
Much obliged, i'll check those out. i don't really need to add things back, i was thinking of having some subent ships/whatever hanging about in random order just to add colour - you might see one thing, or several, or none if a random scripty thing can zap them. i'll try a bit play wehn i've finished the models.
Re: Conditional Stuff
Could/can you just 'add' ships with somekind of nullai?
Calculating the rotating position will be perhaps a bit difficult but Thargoid's yah-board position was calculated from the towing ship...
Calculating the rotating position will be perhaps a bit difficult but Thargoid's yah-board position was calculated from the towing ship...
- Killer Wolf
- ---- E L I T E ----
- Posts: 2278
- Joined: Tue Jan 02, 2007 12:38 pm
Re: Conditional Stuff
Not sure i could do it accurately. The only spawn script i have is the one that sticks a station some specified distance along a line from witchpoint-sun etc etc. Rotation isn't a problem but accuracy is. Would be far easier to define the items as part of the model and either spawn or spawn-kill them.