WitchSpace ship populating
Moderators: winston, another_commander
- Killer Wolf
- ---- E L I T E ----
- Posts: 2278
- Joined: Tue Jan 02, 2007 12:38 pm
WitchSpace ship populating
dunno if this *is* a scripty thing.
my new Vampire variant, the Spectre, is a NPC-only military ship that is purely a bug-killer designed for Damage, Inc. How do i give it a role that will amke sure it only appears 95% of the time (say) when you're in WS? A few might be seen in systems, but given the name etc, i want them to be somewhat urban-legendy.
would it have to be a script thing?
my new Vampire variant, the Spectre, is a NPC-only military ship that is purely a bug-killer designed for Damage, Inc. How do i give it a role that will amke sure it only appears 95% of the time (say) when you're in WS? A few might be seen in systems, but given the name etc, i want them to be somewhat urban-legendy.
would it have to be a script thing?
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
Yes, it is a script thing.
In your spawning script, make sure that you have a condition that says
This will only be true in interstellar space, so everything after this condition is only executed if the player is in interstellar space.
If you, on the other hand, want to spawn a ship only in normal space, you have to insert the opposite condition
'!' means "not" in JS-syntax.
It's the same as the "planet_number equal -1" in legacy scripting.
In your spawning script, make sure that you have a condition that says
Code: Select all
if(system.isInterstellarSpace)
If you, on the other hand, want to spawn a ship only in normal space, you have to insert the opposite condition
Code: Select all
if(!system.isInterstellarSpace)
It's the same as the "planet_number equal -1" in legacy scripting.
Also, if you want them to show up 95% of the time, just have a line like:
Code: Select all
if(Math.random() < .95)
Dream as if you'll live forever
Live as if you'll die tomorrow
Live as if you'll die tomorrow
And to combine the two:
Code: Select all
this.shipWillExitWitchspace = function() {
if(system.isInterstellarSpace && Math.random() < .95) {
// spawn the ship!
...
}
...
}
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
- Killer Wolf
- ---- E L I T E ----
- Posts: 2278
- Joined: Tue Jan 02, 2007 12:38 pm
- Killer Wolf
- ---- E L I T E ----
- Posts: 2278
- Joined: Tue Jan 02, 2007 12:38 pm
Re: WitchSpace ship populating
Right, it's not working
was using my standard script that uses addsystemships, log said it had, nowt appeared. reading wiki, it seemed that command would stick em somewhere in the normal spacelanes, which might not work properly in Witchspace?
finally tried spawn, which wiki says adds them "near the ship". well, i can't see them! again, log says they've been added, but there's nowt on my scanner.
what am i doing wrong?
as a sideline, i have wasps in witchspace - great allies for fighting thargs, but those buggers zip around and hoover up alien items like it was free jam, there's never any left for me! >:-/
was using my standard script that uses addsystemships, log said it had, nowt appeared. reading wiki, it seemed that command would stick em somewhere in the normal spacelanes, which might not work properly in Witchspace?
finally tried spawn, which wiki says adds them "near the ship". well, i can't see them! again, log says they've been added, but there's nowt on my scanner.
what am i doing wrong?
as a sideline, i have wasps in witchspace - great allies for fighting thargs, but those buggers zip around and hoover up alien items like it was free jam, there's never any left for me! >:-/
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
Re: WitchSpace ship populating
Can you post the exact snippet from your script? I think that would make a diagnosis much easier.
Re: WitchSpace ship populating
Of course they do - bringing me back my robot fighters and some profit Why d'ya think I programmed them that wayKiller Wolf wrote:as a sideline, i have wasps in witchspace - great allies for fighting thargs, but those buggers zip around and hoover up alien items like it was free jam, there's never any left for me! >:-/
As McLane says, post some script and we'll take a look...
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- Cody
- Sharp Shooter Spam Assassin
- Posts: 16081
- Joined: Sat Jul 04, 2009 9:31 pm
- Location: The Lizard's Claw
- Contact:
Re: WitchSpace ship populating
A daft thought, KW… which version of Oolite are you using for testing this?
I ask as some screenshots that you posted recently were using dev version 1.74.0.3424, which is quite old… could this be a reason why your script isn’t working?
I ask as some screenshots that you posted recently were using dev version 1.74.0.3424, which is quite old… could this be a reason why your script isn’t working?
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
And any survivors, their debts I will certainly pay. There's always a way!
- Killer Wolf
- ---- E L I T E ----
- Posts: 2278
- Joined: Tue Jan 02, 2007 12:38 pm
Re: WitchSpace ship populating
it is that version, i've not updated yet. i'll grab the new version and try it tonight before i stick my code snippet up. i thought "spawn" was pretty basic and old as commands go, and it is actually spawing, just not around the ship :-/
cheers
cheers
- Cody
- Sharp Shooter Spam Assassin
- Posts: 16081
- Joined: Sat Jul 04, 2009 9:31 pm
- Location: The Lizard's Claw
- Contact:
Re: WitchSpace ship populating
It’s not so much that… it’s whether snippets of code, as from Kaks above, might not work in the older version.Killer Wolf wrote:i thought "spawn" was pretty basic and old as commands go, and it is actually spawing, just not around the ship :-/
(But I don’t really know what I’m talking about, of course).
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
And any survivors, their debts I will certainly pay. There's always a way!
-
- Quite Grand Sub-Admiral
- Posts: 6682
- Joined: Wed Feb 28, 2007 7:54 am
Re: WitchSpace ship populating
If you are developing OXPs, it is recommended that you test them with the latest official version and trunk too. This is especially important now that we have switched the JS engine between releases. It may be quite disappointing going through a big effort to make a killer-script OXP, only to find out that it fails to work with the version of the game that's about to become official soon.
Re: WitchSpace ship populating
Not to mention having to upgrade the back-catalogue (again)...
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- DaddyHoggy
- Intergalactic Spam Assassin
- Posts: 8515
- Joined: Tue Dec 05, 2006 9:43 pm
- Location: Newbury, UK
- Contact:
Re: WitchSpace ship populating
Explains the choice of avatar....Thargoid wrote:Not to mention having to upgrade the back-catalogue (again)...
Oolite Life is now revealed hereSelezen wrote:Apparently I was having a DaddyHoggy moment.
- Killer Wolf
- ---- E L I T E ----
- Posts: 2278
- Joined: Tue Jan 02, 2007 12:38 pm
Re: WitchSpace ship populating
LOL, alright, i think the machine's just trying to annoy me again.
currently, i have two scripts relevant to this post. My Cobra MkIV OXP runs this :
this is my standard testy thing to gen up some craft when i launch so i can see what they look like. Currently, the Cobras have a pirate AI so you get a bit of a barney when you launch. this works. i had the same script for the Spectres, and it worked too.
as per this thread, i produced this for the Witchspace thing :
i used "spawn" because the "system.legacy_addSystemShips" bit didn't work : well, the log said it worked, but i'll be buggered if i know where the Spectres were spawning :-/
so anyway, i've d/l'd the current trunk, #4053. and there's some oddness. when i hit Witchspace, there's some Thargoids, my Nest, and now, my cluster of Cobras appears here too! And...the Spectres didn't, though they're still genned, according to the log. Seeing the Cobra script worked (it shouldn't have, it uses launch, not WS exit as a trigger), i changed the Spectre script to use system.legacy_addSystemShips again instead of spawn, cos if it works for the Cobras, it'll work for the Spectres too, right? Wrong. Still genned up, still nowhere to be seen.
in further tests, i did a clean jump to Zaonce. as soon as i arrived, the Cobra script ran and genned up the ships right beside me. This hasn't happened before and it only seems to have happened once but at the same time i'm 90% sure i got a flying-in-reverse ship, cos a viper appeared at great speed and his engine plume was on the wrong side for his direction of travel; sadly, those Cobra pilots took my attention before i could confirm fully.
after that, i tried taking the isInterstellaspace thing out, it still didn't work.
aside from that, Griff's OXP has caused a couple log entries :
shader.load.fullModeFailed]: ----- WARNING: Could not build shader griff_normalmap_ships.vertex/griff_cobra_mk1_r_channel_decals.fragment in full complexity mode, trying simple mode.
[shader.load.fallbackSuccess]: Simple mode fallback successful.
[shader.link.failure]: ***** ERROR: GLSL shader program linking failed for griff_normalmap_ships.vertex/griff_cobra_mk1_r_channel_decals.fragment:
>>>>> GLSL log:
Fragment shader(s) failed to link, vertex shader(s) failed to link.
ERROR: error(#277) Symbol 'gl_TexCoord[0]' usage doesn't match between two stages
ERROR: error(#277) Symbol 'gl_TexCoord[0]' usage doesn't match between two stages
[shader.load.fullModeFailed]: ----- WARNING: Could not build shader griff_normalmap_ships.vertex/griff_cobra_mk1_r_channel_decals.fragment in full complexity mode, trying simple mode.
[shader.load.fallbackSuccess]: Simple mode fallback successful.
[loading.complete]: ========== Loading complete. ==========
currently, i have two scripts relevant to this post. My Cobra MkIV OXP runs this :
Code: Select all
// Configuration -- customize here
this.role = "c4";
this.count = 8;
// Standard attributes
this.name = "Spawn-" + this.role;
this.author = "Jens Ayton";
this.copyright = "This script is hereby placed in the public domain.";
this.version = "1.0.1";
this.description = "Script to make several ships of a given role appear outside the station upon launching."
this.shipWillLaunchFromStation = function()
{
system.legacy_addSystemShips(this.role, this.count, 1.0);
log("testscript.spawn", "Generated " + this.count + " " + this.role + " for testing purposes.");
}
as per this thread, i produced this for the Witchspace thing :
Code: Select all
// Configuration -- customize here
this.role = "spectre";
this.count = 8;
// Standard attributes
this.name = "Spawn-" + this.role;
this.author = "Jens Ayton";
this.copyright = "This script is hereby placed in the public domain.";
this.version = "1.0.1";
this.description = "Script to make several ships of a given role appear outside the station upon launching."
this.shipWillExitWitchspace = function()
{
if(system.isInterstellarSpace && Math.random() < .95)
{
spawn: this.role, this.count;
log("testscript.spawn", "Generated " + this.count + " " + this.role + " for testing purposes.");
}
}
so anyway, i've d/l'd the current trunk, #4053. and there's some oddness. when i hit Witchspace, there's some Thargoids, my Nest, and now, my cluster of Cobras appears here too! And...the Spectres didn't, though they're still genned, according to the log. Seeing the Cobra script worked (it shouldn't have, it uses launch, not WS exit as a trigger), i changed the Spectre script to use system.legacy_addSystemShips again instead of spawn, cos if it works for the Cobras, it'll work for the Spectres too, right? Wrong. Still genned up, still nowhere to be seen.
in further tests, i did a clean jump to Zaonce. as soon as i arrived, the Cobra script ran and genned up the ships right beside me. This hasn't happened before and it only seems to have happened once but at the same time i'm 90% sure i got a flying-in-reverse ship, cos a viper appeared at great speed and his engine plume was on the wrong side for his direction of travel; sadly, those Cobra pilots took my attention before i could confirm fully.
after that, i tried taking the isInterstellaspace thing out, it still didn't work.
aside from that, Griff's OXP has caused a couple log entries :
shader.load.fullModeFailed]: ----- WARNING: Could not build shader griff_normalmap_ships.vertex/griff_cobra_mk1_r_channel_decals.fragment in full complexity mode, trying simple mode.
[shader.load.fallbackSuccess]: Simple mode fallback successful.
[shader.link.failure]: ***** ERROR: GLSL shader program linking failed for griff_normalmap_ships.vertex/griff_cobra_mk1_r_channel_decals.fragment:
>>>>> GLSL log:
Fragment shader(s) failed to link, vertex shader(s) failed to link.
ERROR: error(#277) Symbol 'gl_TexCoord[0]' usage doesn't match between two stages
ERROR: error(#277) Symbol 'gl_TexCoord[0]' usage doesn't match between two stages
[shader.load.fullModeFailed]: ----- WARNING: Could not build shader griff_normalmap_ships.vertex/griff_cobra_mk1_r_channel_decals.fragment in full complexity mode, trying simple mode.
[shader.load.fallbackSuccess]: Simple mode fallback successful.
[loading.complete]: ========== Loading complete. ==========