Scripters cove
Moderators: winston, another_commander
Re: Scripters cove
I believe it does still work, but will confirm later on and give it a severe thrashing if it doesn't...
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Re: Scripters cove
Moveable subentities are also used in
- BuoyRepair.oxp, were the buoy "unfolds" after station launch and "fold" before docking.
- Dredgers.oxp, were the dock is closed but opens up on launch or docking requests.
- BuoyRepair.oxp, were the buoy "unfolds" after station launch and "fold" before docking.
- Dredgers.oxp, were the dock is closed but opens up on launch or docking requests.
UPS-Courier & DeepSpacePirates & others at the box and some older versions
- Rorschachhamster
- ---- E L I T E ----
- Posts: 274
- Joined: Sun Aug 05, 2012 11:46 pm
- Contact:
Re: Scripters cove
The black monk gunships have moveable cannons, that point into the direction of a target. Could help, too.
- 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: Scripters cove
No, that's just simple ball turrets.Rorschachhamster wrote:The black monk gunships have moveable cannons, that point into the direction of a target. Could help, too.
- Rorschachhamster
- ---- E L I T E ----
- Posts: 274
- Joined: Sun Aug 05, 2012 11:46 pm
- Contact:
Re: Scripters cove
Oh. OK.Commander McLane wrote:No, that's just simple ball turrets.Rorschachhamster wrote:The black monk gunships have moveable cannons, that point into the direction of a target. Could help, too.
I just thought: "Well, could you make ball turrets that don't shoot?". Would be nifty for navigational arrays, that follow the target...
Re: Scripters cove
Thanks everyone for your great tips!! I'll definitely check them out!!
忍 knowing that enough is enough, you'll always have enough.
Running Oolite 1.77 on Ubuntu Linux 12.04 LTS
Running Oolite 1.77 on Ubuntu Linux 12.04 LTS
Re: Scripters cove
This can attract surprising amounts of unwanted attention, as I discovered that even unarmed stations that target other ships can be "viewed" and treated as a hostile.Rorschachhamster wrote:Oh. OK.Commander McLane wrote:No, that's just simple ball turrets.Rorschachhamster wrote:The black monk gunships have moveable cannons, that point into the direction of a target. Could help, too.
I just thought: "Well, could you make ball turrets that don't shoot?". Would be nifty for navigational arrays, that follow the target...
Re: Scripters cove
Fixed in r5634. Porcupine captains everywhere now can engage in combat without a few thousand in repair bills for their engine casings...cim wrote:But I'm inclined to think this is a bug: those rare ships that have both frangible subents and shields should obviously have the shields cover the subents too.
Re: Scripters cove
Great! But how can I get that newest version? I've tried "oolite-update", but it didn't seem to work (subentities are still hit before the shields)...cim wrote:Fixed in r5634. Porcupine captains everywhere now can engage in combat without a few thousand in repair bills for their engine casings...cim wrote:But I'm inclined to think this is a bug: those rare ships that have both frangible subents and shields should obviously have the shields cover the subents too.
忍 knowing that enough is enough, you'll always have enough.
Running Oolite 1.77 on Ubuntu Linux 12.04 LTS
Running Oolite 1.77 on Ubuntu Linux 12.04 LTS
HowTo change event handler functions in subentities?
Another question:
related with this question and the above bug I came up with the idea to build a "Subentity Repair System", similar to Thargoids awesome repair bots oxp. But I'm unable to find out when a subentity is destroyed...
I've tried overriding (extending?) the players.ship.subentities' "shipDied" and "shipBeingAttacked"-functions, but my modifications seemingly have no effect. Here is my main oxp's startup-function, which shows how I tried to achieve it:
I'm getting no messages / log-entries when a subentity is being attacked or destroyed...
So here my question How can I run code when a subentity has been destroyed?
related with this question and the above bug I came up with the idea to build a "Subentity Repair System", similar to Thargoids awesome repair bots oxp. But I'm unable to find out when a subentity is destroyed...
I've tried overriding (extending?) the players.ship.subentities' "shipDied" and "shipBeingAttacked"-functions, but my modifications seemingly have no effect. Here is my main oxp's startup-function, which shows how I tried to achieve it:
Code: Select all
// startup - called when OXP is loaded (on game start, load game,...)
this.startUp = function () {
// setup "subentity died" functions
$log("startup:", "running startUp...");
var x=0;
for (x=0; x < player.ship.subEntities.length; x++) {
$log("SubentityModified:", "setting up subEnt: " + player.ship.subEntities[x]);
$log("SubentityModified:", "player.ship.subEntities[x].shipBeingAttacked b4: " + player.ship.subEntities[x].shipBeingAttacked); // returns undef (as expected)
player.ship.subEntities[x].shipBeingAttacked = function(whom) {
message = this + " being attacked!";
log("SmellySubEnt", message);
player.consoleMessage(message, 1);
}
$log("SubentityModified:", "player.ship.subEntities[x].shipBeingAttacked: " + player.ship.subEntities[x].shipBeingAttacked); // returns the above function => seems it worked
player.ship.subEntities[x].shipDied = function(whom, why) {
message = this + " died!!";
player.commsMessage(message, 3);
log("SmellySubEnt", message);
player.consoleMessage(message, 1);
}
}
}
So here my question How can I run code when a subentity has been destroyed?
忍 knowing that enough is enough, you'll always have enough.
Running Oolite 1.77 on Ubuntu Linux 12.04 LTS
Running Oolite 1.77 on Ubuntu Linux 12.04 LTS
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Re: HowTo change event handler functions in subentities?
Try:GGShinobi wrote:I'm getting no messages / log-entries when a subentity is being attacked or destroyed...
So here my question How can I run code when a subentity has been destroyed?
Code: Select all
player.ship.subEntities[x].script.shipDied = function(whom, why) {
message = this + " died!!";
player.commsMessage(message, 3);
log("SmellySubEnt", message);
player.consoleMessage(message, 1);
}
ship.script
, not the ship
itself. And you
UPS-Courier & DeepSpacePirates & others at the box and some older versions
Re: Scripters cove
You can either wait until we release 1.77.1 and thenGGShinobi wrote:Great! But how can I get that newest version? I've tried "oolite-update", but it didn't seem to work (subentities are still hit before the shields)...
oolite-update
will work, or you can download a nightly build (links in a sticky thread at the top of the forum for your OS), or you can build Oolite from SVN yourself.As we are currently in a "fixing bugs" part of the release cycle, you should be fairly safe using the nightly version. Once 1.78 is released we will move back to the "creating bugs" part of the release cycle and you should switch back to using official releases.
Re: HowTo change event handler functions in subentities?
Oooh man! *slaps his face* Eric Walch, thanks a million times! This works like charm!!Eric Walch wrote:Try:GGShinobi wrote:So here my question How can I run code when a subentity has been destroyed?You must add the code to theCode: Select all
player.ship.subEntities[x].script.shipDied = function(whom, why) { var message = this + " died!!"; player.commsMessage(message, 3); log("SmellySubEnt", message); player.consoleMessage(message, 1); }
ship.script
, not theship
itself.
Yeah, I actually already found this out "the hard way" before I read your post, but thanks anyway!Eric Walch wrote:And youprobablymust not only use the code on startUp, but also on restoration of the subs.
cim, thank you very much for the info. It's good to know - but now that my "Ship Entity Repair System" is about to become reality, I'll stick with 1.77, because the buggy behaviour is actually good for testingcim wrote:You can either wait until we release 1.77.1 and thenGGShinobi wrote:Great! But how can I get that newest version? I've tried "oolite-update", but it didn't seem to work (subentities are still hit before the shields)...oolite-update
will work, or you can download a nightly build (links in a sticky thread at the top of the forum for your OS), or you can build Oolite from SVN yourself.
As we are currently in a "fixing bugs" part of the release cycle, you should be fairly safe using the nightly version. Once 1.78 is released we will move back to the "creating bugs" part of the release cycle and you should switch back to using official releases.
忍 knowing that enough is enough, you'll always have enough.
Running Oolite 1.77 on Ubuntu Linux 12.04 LTS
Running Oolite 1.77 on Ubuntu Linux 12.04 LTS
Re: Possibilities of ship scripting
Excuse me, kind sir, in the fine ship, I've got two more questions!cim wrote:Surround would be easier, and a Visual Effect is probably the easiest way to do that. Again, frame callbacks to position and orient.GGShinobi wrote:
- it is possible to replace the ship/surround it with a comet tail when it activates the jump drive, so that it looks like a real comet?
- Is it possible to create Visual Effects which are "transparent" from within (so I can see through the comet effect when looking out of the cockpit) but appear "solid" from the outside? If so, how?
- Can Visual Effects also be used as the model that is shown on the mission screen?
忍 knowing that enough is enough, you'll always have enough.
Running Oolite 1.77 on Ubuntu Linux 12.04 LTS
Running Oolite 1.77 on Ubuntu Linux 12.04 LTS
Re: Possibilities of ship scripting
1) Yes. All models are transparent from the inside, unless you've built them inside-out. So as long as the model's shape is purely convex and the internal camera positions are inside the model (and the external ones outside it) you'll be fine.GGShinobi wrote:
- Is it possible to create Visual Effects which are "transparent" from within (so I can see through the comet effect when looking out of the cockpit) but appear "solid" from the outside? If so, how?
- Can Visual Effects also be used as the model that is shown on the mission screen?
2) No, but in that context you don't need to worry about such things as collisions, so you can just use a ship with the same model.