Scripters cove
Moderators: winston, another_commander
Re: Scripters cove
Thank you phkb for the explanation.
Much appreciation to all three of you for your help and guidance.
The gauge is now installed on my Coluber HUD and updating properly. This includes a nicely colored bar and a level measuring background image like those used on all of the other gauges in the Coluber HUD. Have even gotten to the point where most JavaScript Operators and other such stuff are becoming readable without too much consulting of reference material.
One step closer to the Dark Side. <Eats the cookies>
Much appreciation to all three of you for your help and guidance.
The gauge is now installed on my Coluber HUD and updating properly. This includes a nicely colored bar and a level measuring background image like those used on all of the other gauges in the Coluber HUD. Have even gotten to the point where most JavaScript Operators and other such stuff are becoming readable without too much consulting of reference material.
One step closer to the Dark Side. <Eats the cookies>
Humor is the second most subjective thing on the planet
Brevity is the soul of wit and vulgarity is wit's downfall
Good Night and Good Luck - Read You Soon
Brevity is the soul of wit and vulgarity is wit's downfall
Good Night and Good Luck - Read You Soon
- 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
Currently serviceLevel is important only before you want to buy another ship: a maintenance can give better price for your ship.
Over this I attempted to make more sense in my hardcore addon named to ShipVersion, which penalized the player ship by losing all laser weapons when the serviceLevel reached the minimal value, like break off from the damaged hull.
But regardless of my repeated warnings that ShipVersion is designed only for top experienced players who want extra challenges, new players also regularly installed it, then complained about losing weapons "without any notice", so finally I removed this feature.
- 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
Nice work, congrats!
- montana05
- ---- E L I T E ----
- Posts: 1166
- Joined: Mon May 30, 2016 3:54 am
- Location: lurking in The Devils Triangle (G1)
Re: Scripters cove
An interesting observation for laser weapons (excluding turrets) assigned to a subentity of a NPC ship:
When you assign a laser weapon as a subentity the common way (as much as I saw) is to define the laser as which makes sense, once the orientation is correct the front of the subentity should be the target area. Unfortunately the result is not exactly like that. If assigned to the back of the ship this lasers still work as front-lasers and not in the intended way.
Anybody else had a similar observation and are there any ideas how to work around this problem ?
PS:
Assigning the weapons to the ship as multiple lasers is obviously working, you even could keep the subentities as decoration. Problem is that this method doesn't offer different types.
When you assign a laser weapon as a subentity the common way (as much as I saw) is to define the laser as
Code: Select all
"forward_weapon_type" =
Anybody else had a similar observation and are there any ideas how to work around this problem ?
PS:
Assigning the weapons to the ship as multiple lasers is obviously working, you even could keep the subentities as decoration. Problem is that this method doesn't offer different types.
Scars remind us where we've been. They don't have to dictate where we're going.
- montana05
- ---- E L I T E ----
- Posts: 1166
- Joined: Mon May 30, 2016 3:54 am
- Location: lurking in The Devils Triangle (G1)
Re: Scripters cove
While trying to find a work-around I ran into another problem, NPC ships hardly use back-weapons and even less broadsides. Is there any way that you could force or at least raise the chances that they are fired ?
Scars remind us where we've been. They don't have to dictate where we're going.
-
- Quite Grand Sub-Admiral
- Posts: 6683
- Joined: Wed Feb 28, 2007 7:54 am
Re: Scripters cove
Yes there is. Increase their accuracy to above 5. Then the AI will start utilizing the more advanced tactics. Not entirely sure about it, but I don't think you can make it use side lasers for combat.
As for the forward_weapon_type subentities placed aft, have you tried using aft_weapon_type instead?
- montana05
- ---- E L I T E ----
- Posts: 1166
- Joined: Mon May 30, 2016 3:54 am
- Location: lurking in The Devils Triangle (G1)
Re: Scripters cove
The various stages of accuracy I am using already, in this case I guessed 8.50 would be enough, well, I will try to get up to 10.00 to watch the results.another_commander wrote: ↑Sun Feb 03, 2019 8:05 amYes there is. Increase their accuracy to above 5. Then the AI will start utilizing the more advanced tactics. Not entirely sure about it, but I don't think you can make it use side lasers for combat.
My first thought, would be be the most logic. Thats when I run into the second problemanother_commander wrote: ↑Sun Feb 03, 2019 8:05 amAs for the forward_weapon_type subentities placed aft, have you tried using aft_weapon_type instead?
Update:
The easiest way to force a NPC ship to use the rear-lasers for a test is to set the front-lasers to "NONE"
It seems that aft_weapon works as intended, the lasers fire at their own ship.
Conclusio for today, for now I will refrain from using subentities as rear-lasers, instead assigning them to the ship with the multi feature.
Scars remind us where we've been. They don't have to dictate where we're going.
- montana05
- ---- E L I T E ----
- Posts: 1166
- Joined: Mon May 30, 2016 3:54 am
- Location: lurking in The Devils Triangle (G1)
Re: Scripters cove
Another day, another surprise. It seems that self-aiming lasers (is_turret_laser = true;) ignore "weapon_mount_mode" = "multiply"; and/or "weapon_position_". All shots are fired from the center of the ship (0 0 0) so difficult to say if multi is recognized. Well, at least they fire now, once again not exactly as intended.
Scars remind us where we've been. They don't have to dictate where we're going.
- 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 know I should probably know this, but can someone remind me how you calculate the mass-lock distance of a sun or planet?
-
- Quite Grand Sub-Admiral
- Posts: 6683
- Joined: Wed Feb 28, 2007 7:54 am
Re: Scripters cove
Here is the code from PlayerEntity.m:
Code: Select all
Entity<OOStellarBody> *stellar = (Entity<OOStellarBody> *)ent;
if (EXPECT([stellar planetType] != STELLAR_TYPE_MINIATURE))
{
double dist = stellar->zero_distance;
double rad = stellar->collision_radius;
double factor = ([stellar isSun]) ? 2.0 : 4.0;
// plus ensure mass lock when 25 km or less from the surface of small stellar bodies
// dist is a square distance so it needs to be compared to (rad+25000) * (rad+25000)!
if (dist < rad*rad*factor || dist < rad*rad + 50000*rad + 625000000 )
{
massLocked = YES;
}
}
- 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
Thanks, a_c! You know, I looked at that bit of code and somehow completely missing a crucial detail: "dist is a square distance". Note to self: must take more care when reading comments.
- montana05
- ---- E L I T E ----
- Posts: 1166
- Joined: Mon May 30, 2016 3:54 am
- Location: lurking in The Devils Triangle (G1)
Re: Scripters cove
I never saw it before and I never thought its possible until recently I was proofed wrong, thanks to a copy & past glitch. It is possible to assign a subentity to a subentity, for example a flasher to a gun. The catch is that the coordinates are the one from the main entity, same as with other certain assignments like
forward_weapon =
, external weapons assigned to the back of a ship will mainly shoot forward of the ship, not forward of the gun.Scars remind us where we've been. They don't have to dictate where we're going.
-
- ---- E L I T E ----
- Posts: 1248
- Joined: Sat Sep 12, 2009 11:58 pm
- Location: Essex (mainly industrial and occasionally anarchic)
Re: Scripters cove
Dear all
I am after a way of setting a (any) perpendicular course from a celestial object (sun or planet or secondary planet - or, better: a roughly - not exactly, i.e. I want some randomisation. I know how to get the celestial entity - with all its properties, I think - as an element in an array, but I don't know how to get a ship, which is controlled by plist AI + js ship script, to set the desired course away from the entity.
I think phkb might help me with this, but I have leaned on him a lot of already recently, and/but I don't really have the knowledge, or perhaps the mathematical background, to work it out myself. (I did look at relevant pages on the javascript and AI wikis, but I couldn't find anything suitable. I considered trying to use the plist AI method 'performFlee', but I am unsure I can set the flee-from-target to any celestial, as against a ship.)
I am after a way of setting a (any) perpendicular course from a celestial object (sun or planet or secondary planet - or, better: a roughly - not exactly, i.e. I want some randomisation. I know how to get the celestial entity - with all its properties, I think - as an element in an array, but I don't know how to get a ship, which is controlled by plist AI + js ship script, to set the desired course away from the entity.
I think phkb might help me with this, but I have leaned on him a lot of already recently, and/but I don't really have the knowledge, or perhaps the mathematical background, to work it out myself. (I did look at relevant pages on the javascript and AI wikis, but I couldn't find anything suitable. I considered trying to use the plist AI method 'performFlee', but I am unsure I can set the flee-from-target to any celestial, as against a ship.)
- 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
Well, I'm here, so, you know...
This code will set the orientation of a ship to be away from the given planet (entity):
Although if we're trying to get the AI to do something, it might be better to set a waypoint away from the planet and ask the AI to fly towards it:
No randomisation in that position, obviously, but I'll leave that for someone else.
This code will set the orientation of a ship to be away from the given planet (entity):
Code: Select all
// orient the ship so it is facing away from the entity
this.$orientationAwayFromEntity = function $orientationAwayFromEntity(ship, entity) {
ship.orientation = entity.position.subtract(ship.position).direction().rotationTo([0,0,-1]);
}
Code: Select all
// returns a position that's the same distance as between the ship and the entity, but in the opposite direction
this.$positionAwayFromEntity = function $positionAwayFromEntity(ship, entity) {
return Vector3D.interpolate(ship.position, entity.position, -1);
}
-
- ---- E L I T E ----
- Posts: 1248
- Joined: Sat Sep 12, 2009 11:58 pm
- Location: Essex (mainly industrial and occasionally anarchic)
Re: Scripters cove
Thanks! I'll have a go with that code and with the ideas offered elsewhere by rustem.