Boulders from asteroids question(s)
Moderators: winston, another_commander
- Smivs
- Retired Assassin
- Posts: 8408
- Joined: Tue Feb 09, 2010 11:31 am
- Location: Lost in space
- Contact:
Boulders from asteroids question(s)
I'm baffled
For an OXP idea I'm working on, I have an asteroid as a sub-entity of a ship - the idea is it's a space wreck and the asteroid has hit the ship at low speed and the ship is now 'crunched' onto the asteroid. So far so good. However I want to be able to salvage stuff from the ship by destroying it. Again so far so good. The problem is that sometimes the asteroid breaks into boulders during this and sometimes it doesn't. I would like to guarantee that the asteroid breaks into about 4-5 boulders every time.
The weird thing is, I tried increasing the 'likely cargo' to 100 to generate boulders on the destruction of the asteroid, and this works very well....except the 100 boulders appear about 10 000Km from the original asteroid.
Any thoughts/ideas?
For an OXP idea I'm working on, I have an asteroid as a sub-entity of a ship - the idea is it's a space wreck and the asteroid has hit the ship at low speed and the ship is now 'crunched' onto the asteroid. So far so good. However I want to be able to salvage stuff from the ship by destroying it. Again so far so good. The problem is that sometimes the asteroid breaks into boulders during this and sometimes it doesn't. I would like to guarantee that the asteroid breaks into about 4-5 boulders every time.
The weird thing is, I tried increasing the 'likely cargo' to 100 to generate boulders on the destruction of the asteroid, and this works very well....except the 100 boulders appear about 10 000Km from the original asteroid.
Any thoughts/ideas?
Commander Smivs, the friendliest Gourd this side of Riedquat.
Re: Boulders from asteroids question(s)
Have the asteroid entity not have boulders at all in the game-sense (it's one of the shipdata keys iirc), but on shipDied just have it spawn the boulders by script instead.
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- 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: Boulders from asteroids question(s)
That would be the
no_boulders
key, which should be set to yes
.Re: Boulders from asteroids question(s)
Dat's der pebble...
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- Smivs
- Retired Assassin
- Posts: 8408
- Joined: Tue Feb 09, 2010 11:31 am
- Location: Lost in space
- Contact:
Re: Boulders from asteroids question(s)
Thanks chaps.
@Thargoid, I tried that but they seem to appear some distance from where the asteroid was, as opposed to the 'normal' formation of boulders that replace the asteroid in exactly the same position.
@McLane, if I set "no_boulders" = yes; won't that give me no boulders? I want the boulders. I'll try "no_boulders" = no; and see what happens.
@Thargoid, I tried that but they seem to appear some distance from where the asteroid was, as opposed to the 'normal' formation of boulders that replace the asteroid in exactly the same position.
@McLane, if I set "no_boulders" = yes; won't that give me no boulders? I want the boulders. I'll try "no_boulders" = no; and see what happens.
Commander Smivs, the friendliest Gourd this side of Riedquat.
- Okti
- ---- E L I T E ----
- Posts: 700
- Joined: Sun Sep 26, 2010 1:51 pm
- Location: A GH shop, near witchpoint to Oresrati in Galaxy 8
Re: Boulders from asteroids question(s)
Hi Smivs,
Try spawn function for the ship.shipDied event handler. That might help.
Try spawn function for the ship.shipDied event handler. That might help.
- 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: Boulders from asteroids question(s)
'Yes' is the default, and does not guarantee boulders. Only 'no' guarantees that there will be none.Smivs wrote:Thanks chaps.
@Thargoid, I tried that but they seem to appear some distance from where the asteroid was, as opposed to the 'normal' formation of boulders that replace the asteroid in exactly the same position.
@McLane, if I set "no_boulders" = yes; won't that give me no boulders? I want the boulders. I'll try "no_boulders" = no; and see what happens.
Setting it to 'no' only enables you to spawn them in another way, without worrying that the populator would interfere.
About the distance (10000 m, not km): please post the code snippet, then we can see if there is some error, or slip of logic, in it.
- Smivs
- Retired Assassin
- Posts: 8408
- Joined: Tue Feb 09, 2010 11:31 am
- Location: Lost in space
- Contact:
Re: Boulders from asteroids question(s)
It's mostly a C&P from the core shipdata.plist.
I've just given it a custom .dat and texture, and increased the energy to 600 to try and make it more durable. Ideally I'd like between 5 and 10 boulders when it 'goes'. I'm hitting it with military lasers which is probably not helping.
Oddly I cannot now reproduce the hundred boulders thing. It just explodes and leaves nothing anywhere.
On a related note, can sub-entities spawn items as a death action?
Code: Select all
"wreck_asteroid" =
{
ai_type = "dumbAI.plist";
bounty = 10;
cargo_type = "CARGO_NOT_CARGO";
energy_recharge_rate = 0;
density = 5;
forward_weapon_type = "WEAPON_NONE";
has_ecm = no;
has_escape_pod = no;
has_scoop = no;
max_energy = 600;
max_flight_pitch = 0.1;
max_flight_roll = 0.1;
max_flight_speed = 0;
missiles = 0;
model = "wreck_asteroid.dat";
name = "Asteroid";
roles = "asteroid";
scan_class = "CLASS_ROCK";
smooth = yes;
thrust = 0;
unpiloted = yes;
weapon_energy = 0;
materials =
{
"rock_SS.png" =
{
shininess = 2;
specular_color = (0.1, 0.1, 0.1, 1.0);
};
};
likely_cargo = 100;
debris_role = "boulder";
heat_insulation = 5;
};
Oddly I cannot now reproduce the hundred boulders thing. It just explodes and leaves nothing anywhere.
On a related note, can sub-entities spawn items as a death action?
Commander Smivs, the friendliest Gourd this side of Riedquat.
- 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: Boulders from asteroids question(s)
Thargoid wrote:Have the asteroid entity not have boulders at all in the game-sense (it's one of the shipdata keys iirc), but on shipDied just have it spawn the boulders by script instead.
Can you post the script where you tried to create the boulders inside theSmivs wrote:@Thargoid, I tried that.
this.shipDied
event handler? The shipdata are not really helpful for that (except for seeing that it's already missing the script
key which is needed to activate the script in the first place.- Smivs
- Retired Assassin
- Posts: 8408
- Joined: Tue Feb 09, 2010 11:31 am
- Location: Lost in space
- Contact:
Re: Boulders from asteroids question(s)
I removed the script key when it didn't work.
The script key in the shipdata.plist was
and the script (called "spacewreck_boulders.js") was
I thought I'd start with one boulder, to keep it simple and I don't know how to script more than one anyway. That would have been my next question
The asteroid is a sub-entity, and I haven't been able to spawn anything as a death action from a sub-ent. Is this relevant?
The script key in the shipdata.plist was
Code: Select all
script = "spacewreck_boulders.js";
Code: Select all
this.shipDied = function ()
{
this.ship.spawn("boulder");
};
The asteroid is a sub-entity, and I haven't been able to spawn anything as a death action from a sub-ent. Is this relevant?
Commander Smivs, the friendliest Gourd this side of Riedquat.
- 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: Boulders from asteroids question(s)
It's all in the manual. What you want isSmivs wrote:I thought I'd start with one boulder, to keep it simple and I don't know how to script more than one anyway. That would have been my next question
this.ship.spawn("boulder", <number>);
.Perhaps it is. I'm not sure whether a subentity can spawn something. Perhaps it can't. Alternatively you could make the main entity spawn the boulders.Smivs wrote:The asteroid is a sub-entity, and I haven't been able to spawn anything as a death action from a sub-ent. Is this relevant?
this.ship.owner.spawn("boulder", <number>);
- Smivs
- Retired Assassin
- Posts: 8408
- Joined: Tue Feb 09, 2010 11:31 am
- Location: Lost in space
- Contact:
Re: Boulders from asteroids question(s)
I did try this the other way round, with the ship being a sub-ent of the asteroid, and found it couldn't spawn anything, so it seems that sub-ents can't spawn stuff.
I'll certainly try "this.ship.owner.spawn("boulder", <number>);" , although it might have to wait till the morning now.
I assume that goes in the sub-ents part of shipdata, yes?.
I'll certainly try "this.ship.owner.spawn("boulder", <number>);" , although it might have to wait till the morning now.
I assume that goes in the sub-ents part of shipdata, yes?.
Commander Smivs, the friendliest Gourd this side of Riedquat.
- 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: Boulders from asteroids question(s)
It has nothing to do with the sub-ents part of the shipdata, not even with shipdata at all. It's a JS-script, only a tiny variation of your JS-script. You are only supposed to add 'owner.' and a comma plus a number (less than 64).Smivs wrote:I did try this the other way round, with the ship being a sub-ent of the asteroid, and found it couldn't spawn anything, so it seems that sub-ents can't spawn stuff.
I'll certainly try "this.ship.owner.spawn("boulder", <number>);" , although it might have to wait till the morning now.
I assume that goes in the sub-ents part of shipdata, yes?.
Re: Boulders from asteroids question(s)
Try replacing with
That will add 10 boulders within 500m of the ships current position (or in this case the position it held when it died).
For exact details of what's done there, see the wiki.[/color]
Code: Select all
this.ship.spawn("boulder");
Code: Select all
system.addShips("boulder", 10, this.ship.position, 500);
For exact details of what's done there, see the wiki.[/color]
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- Smivs
- Retired Assassin
- Posts: 8408
- Joined: Tue Feb 09, 2010 11:31 am
- Location: Lost in space
- Contact:
Re: Boulders from asteroids question(s)
Thanks, both. I now have boulders, and am a happy fellow
You know I spent most of yesterday looking at various Wiki pages, and you still managed to find things I hadn't found.
Am I the only person who finds the js sections almost impossible to navigate? Is there an index page or something I've missed?
You know I spent most of yesterday looking at various Wiki pages, and you still managed to find things I hadn't found.
Am I the only person who finds the js sections almost impossible to navigate? Is there an index page or something I've missed?
Last edited by Smivs on Mon Mar 07, 2011 9:28 am, edited 1 time in total.
Commander Smivs, the friendliest Gourd this side of Riedquat.