Page 1 of 2

First OXP (Crybaby)

Posted: Thu May 03, 2012 6:18 pm
by Dr.Tripsa
I'm embarking on my first OXP (it's intentional involved so I can wrap my head around certain concepts while working on it) the basis is as follows

1. creates a new equipment (perhaps missile or bomb type?) EDIT : most likely pylon mounted missile type
2. when launched the device emits an SOS or registers as a bigger threat than the owner.
3. should take cargo space, to limit number of uses. 1 use = 1 ton EDIT : Pylon mount takes care of this
EDIT 4. Possible to make this equip unavailable at standard stations, as it would in theory be using an illegal transponder?

can some of you nice folks point me in the right places to look at for where to begin here?

Re: First OXP (Crybaby)

Posted: Thu May 03, 2012 6:32 pm
by SandJ
Dr.Tripsa wrote:
1. creates a new equipment (perhaps missile or bomb type?)
3. should take cargo space, to limit number of uses.
If it is on a pylon, then that limits the number of uses.
Dr.Tripsa wrote:
3. should take cargo space, to limit number of uses.
Was it your intention to limits its number to just one - if you make it equipment that should have that effect.
Dr.Tripsa wrote:
2. when launched the device emits an SOS
3. 1 use = 1 ton
That is very heavy for a radio beacon.

The Cargo Shepherd might be a good example of a piece of pylon-mounted equipment.

Re: First OXP (Crybaby)

Posted: Thu May 03, 2012 6:36 pm
by cim
Dr.Tripsa wrote:
I'm embarking on my first OXP (it's intentional involved so I can wrap my head around certain concepts while working on it) the basis is as follows

1. creates a new equipment (perhaps missile or bomb type?)
2. when launched the device emits an SOS or registers as a bigger threat than the owner.
3. should take cargo space, to limit number of uses. 1 use = 1 ton

can some of you nice folks point me in the right places to look at for where to begin here?
Overall OXP information: [wiki]OXP_howto[/wiki]
Scripting reference: [wiki]Oolite_JavaScript_object_model[/wiki]

New equipment is defined in [wiki]equipment.plist[/wiki]. Making the equipment itself take up cargo space is impossible, but you could make it consume 1t of Minerals/Alloys/Narcotics from the hold when used. Alternatively, if you make it a missile or a mine, it'll take up a pylon slot in place of a normal missile, which easily restricts how many can be carried at once.

Point 2 requires messing around with the AIs of nearby ships - see [wiki]OXP_howto_AI[/wiki] for AI coding, and the Ship object in the Javascript reference for how to adjust some of the parameters used.

Good luck!

Re: First OXP (Crybaby)

Posted: Mon Jan 21, 2013 7:40 pm
by Dr.Tripsa
Finally beginning work on this,

equipment.plist

Code: Select all

(
	(
	8, 
	1000, 
	"Crybaby Transponder", 
	"EQ_CRY_BABY_MINE", 
	"Cry, baby, cry. Make your momma sigh. Emergency beacon.", 
		{
		"available_to_all" = true;
		"requires_empty_pylon" = true;
		}
        // unneeded?  "script" = "CrybabyLaunch.js";
	)
)
CrybabyAI.plist

Code: Select all

{
	GLOBAL = {
	ENTER = ("commsMessageByUnpiloted: Crying!!", broadcastDistressMessage); 
	EXIT = (); 
	UPDATE = (broadcastDistressMessage, "pauseAI: 8"); 
       // Thanks to Eric Walch!
	}; 	
}
shipdata.plist

Code: Select all

{
	crybaby_transponder = {
                "like_ship" = "barrel";
                //THANKS!! to Wyvern_Mommy for that!
		ai_type = "CrybabyAI.plist";		
		unpiloted = yes;
                "roles" = EQ_CRY_BABY_MINE crybaby_transponder";
	};

}
CrybabyLaunch.js <= TBD, may be unneeded...

The above should be enough to register it as equipment available to players in tech level 9 worlds, for 100CR as a single use "mine". The AI -should- be simple enough to keep it doing nothing but spamming for help, which is the idea.

When used it should free itself from a pylon (making it single use) by default as a "_MINE".

Any help at this point would be appreciated :S

Re: First OXP (Crybaby)

Posted: Mon Jan 21, 2013 8:19 pm
by Eric Walch
This UPDATE needs a pause to become:

Code: Select all

UPDATE = (broadcastDistressMessage, "pauseAI: 8"); 
Without pause, it is broadcasted 4 times every second. That is a bit overuse of cpu time. Specially because identical messages are suppressed and not visible at all.

One problem will be that the beacon needs a primary aggressor that is already targeting the beacon in attack mode. If not present, broadcastDistressMessage will do nothing. :(

EDIT: This behaviour is different that written in the wiki were it is suggested that you can set a primary target that will become the "aggressor". I looked it up, and the wiki was correct up to Oolite 1.74. In 1.76 there already needed to be an explicit primary aggressor. Probably to prevent buggy behaviour where a viper went after an unwanted primary target. (Going to edit the wiki now....)

Re: First OXP (Crybaby)

Posted: Mon Jan 21, 2013 8:33 pm
by Dr.Tripsa
thanks for that Eric, fixing...

the lack of aggressor being a factor is irksome, mayby I should use another "like_ship" instead and see if I can give it some cargo , perhaps gold, as bait?

Almost there, reworked into a tasty floating cargo... that explodes if scooped by npc, only one problem now...

it launches at an extreme rate of speed (injectors needed just to catch it!) HELP!

Re: First OXP (Crybaby)

Posted: Tue Jan 22, 2013 3:21 am
by Dr.Tripsa
UPDATE!

Crybaby is almost ready, It's had to change a bit...
Credit due to Wyvern_Mommy for the booby-trap concept!

Code: Select all

The Crybaby EDM (Extreme Defensive Measures) Mine
----------------------------------------------------
Deployed like a mine, appears as a cargo canister...
Silently waits while monitoring transponder codes and cross referencing these with GalCops Database.
(there is much debate as to if its access to this database is legal)
When it detects a known pirate within 200m, a Quirium/Hydrogen explosion is triggered.

Effective Range: 1/2Km (500)
Effective Energy: 5Keu (5000)
So before I release this I need input...

How much should it cost?
What tech level do you suggest?
What do you think of the Detection/damage range?

Re: First OXP (Crybaby)

Posted: Tue Jan 22, 2013 7:54 am
by cim
If you're using the AI command dealEnergyDamageWithinDesiredRange for the explosion, the damage formula is:

Code: Select all

(Energy * Effective Range) / (6.76 * Actual Range * Actual Range)
So, at 200m, this would do:

Code: Select all

(5000 * 500) / (6.76 * 200 * 200) = 9 points of damage
For comparison, a pulse laser hit does 16, and a missile does around 250. In that case, the explosion probably needs either a lot more power or a little more range.

If you're using the JS method dealEnergyDamage then the damage formula is simpler, though the mine will require Oolite 1.77 or later.

Code: Select all

Energy (within effective range)
(Energy * Effective Range) / (Actual Range * Actual Range) (outside effective range)
It would therefore do 5000 damage to the target, enough to destroy a Behemoth twice. At the edge of scanner range, it will still do around 2 points of damage. In this case, you can probably reduce the power substantially (just set it to the amount of damage you want the mine to do to its target, in fact)

Re: First OXP (Crybaby)

Posted: Tue Jan 22, 2013 4:43 pm
by Dr.Tripsa
thank you for this cim, I wasn't aware of the constants there... I'll recalculate based on those figures :)

Re: First OXP (Crybaby)

Posted: Tue Jan 22, 2013 10:18 pm
by Dr.Tripsa
UPDATE:

took cim's advice and revised to dealEnergyDamage, this caps max damage at 256 within 1/2Km of the blast.

Re: First OXP (Crybaby)

Posted: Tue Jan 22, 2013 10:41 pm
by Rorschachhamster
Dr.Tripsa wrote:
...
(there is much debate as to if its access to this database is legal)
When it detects a known pirate within 200m, a Quirium/Hydrogen explosion is triggered.
Food for thought:
If you are an offender using it... BOOM? :lol:
Does it just register OTHER pirates? :?:

Re: First OXP (Crybaby)

Posted: Tue Jan 22, 2013 11:32 pm
by Dr.Tripsa
Rorschachhamster wrote:
Dr.Tripsa wrote:
...
(there is much debate as to if its access to this database is legal)
When it detects a known pirate within 200m, a Quirium/Hydrogen explosion is triggered.
Food for thought:
If you are an offender using it... BOOM? :lol:
Does it just register OTHER pirates? :?:
Hmm fair point, I could do that, or just make it unavailable to players with an offender status...

For the moment, until I ponder this a bit more I've added
"requires_clean" = yes;
to the equipment.plist for this.

Test Version available, at tech level 9 systems, with clean status.. for 100CR

http://dl.dropbox.com/u/9855374/Crybaby ... .0.oxp.zip

Re: First OXP (Crybaby)

Posted: Wed Jan 23, 2013 7:35 am
by Diziet Sma
Dr.Tripsa wrote:
Test Version available, at tech level 9 systems, with clean status.. for 100CR
Very cheap, for a WMD.. :mrgreen:

Re: First OXP (Crybaby)

Posted: Wed Jan 23, 2013 3:50 pm
by Dr.Tripsa
Less WMD than you might think, it only has an effective blast radius of 1/2 Km (by contrast the scanner display is what .. 10Km radius? ) additionally it is only activated by the presence of a pirate (entity.hasRole("pirate")) within 1/5 Km.


The reason for the test release is so people can give feedback on pricing/availability after playing with it a bit :)

Re: First OXP (Crybaby)

Posted: Wed Jan 23, 2013 4:08 pm
by Eric Walch
Dr.Tripsa wrote:
it is only activated by the presence of a pirate (entity.hasRole("pirate")) within 1/5 Km.
Not true as this tests if a "pirate" role is among the possible roles for that ship, that may be added as a trader at the moment. You probably need: (entity.primaryRole == "pirate")