Page 1 of 3

Halloween Witch OXP (was: NPC ship attack using missiles)

Posted: Mon Oct 24, 2011 3:45 pm
by Griff
Halloween Witches, V1.5.2:
https://drive.google.com/file/d/15n5SsV ... sp=sharing
Adds a squad of 3 witches near the witchpoint beacon on October the 31st
Thanks to Eric & CommonSenseOTB for their fantastic scripting and Smivs for bugfixing the non appearing pumpkins issue

Image


Original post:
Does anyone know if there's an OXP ship somewhere that only attacks using missiles? I need something like this for a halloween witch oxp, i don't want to give her lasers, i'd rather she just attacked using an unlimited supply of custom missiles shaped like pumpkins


I've got all the objects appearing in game but i'm missing something - she just won't fire any missiles - even if i prod her a few times with a pulse laser :)

WIP version of the oxp here:
http://www.box.net/shared/lmy8yne6dp3ov9z4shlx
Note: this oxp has a script that spawns two of the witches outside the station whenever you launch

Re: OXP Help - NPC ship that attacks only using missiles?

Posted: Mon Oct 24, 2011 4:01 pm
by Smivs
Griff wrote:
unlimited supply of custom missiles shaped like pumpkins
:shock:

Re: OXP Help - NPC ship that attacks only using missiles?

Posted: Mon Oct 24, 2011 4:03 pm
by Fatleaf
The Smivs MkI Hardheaded Missile :P

Re: OXP Help - NPC ship that attacks only using missiles?

Posted: Mon Oct 24, 2011 4:09 pm
by Gimi
:shock: :D :lol: 8)

Can't wait for whatever you have in stock for X-mas, Valentines, Easter and so on.

Re: OXP Help - NPC ship that attacks only using missiles?

Posted: Mon Oct 24, 2011 4:19 pm
by Smivs
Incoming!

Image

Missiles need an equipment key in their 'roles'.
In the witches shipdata, make the

Code: Select all

missile_role = "EQ_griff_pumpkin_missile";
and the pumpkins' shipdata also needs the 'EQ_' , so

Code: Select all

roles = "EQ_griff_pumpkin_missile";

Re: OXP Help - NPC ship that attacks only using missiles?

Posted: Mon Oct 24, 2011 4:39 pm
by Thargoid
The AI command fireMissile (with a suitable target set first), or indeed the equivalent function (with brackets) in JS, is your friend (or black cat) here...

Re: OXP Help - NPC ship that attacks only using missiles?

Posted: Mon Oct 24, 2011 5:08 pm
by Killer Wolf
Back in 1984, i wonder if Bell and Braben ever foresaw something like this in the future of Elite... :-D

Griff, if you use your flickery engine power script, could you paint up the pumpkins to make it looke like they had a candle inside like a jack o'lantern? might look a bit Horsemanish if you see some of them swooping towards you.
oooh - be even better if they explode into pulp when you ECM them :-D

edit
Black cats - sounds familiar. haha, geddit?
anyways - how come you need a script thing to do this? if you design a ship w/ no main gun how come it won't use the weapons it does have, instead? just curious...

Re: OXP Help - NPC ship that attacks only using missiles?

Posted: Mon Oct 24, 2011 5:14 pm
by Griff
Thanks Guys! I've got the pumpkins working now - i think i'll give her a small, weak plasma turret as a main weapon, and she can fire off her pumpkins whenever the mood takes her, plasma bolts look a bit like magic spells, well sort of...
@K_W - she did use her missiles, but seemingly only after you shot at her a bit - i've got the flickery engine effect added in as a glow map on the pumpkin face, i think i'll have a bit of an experiment with wobbling the scale using a vertex shader, see if i can get them squash & stretching like the bouncing pumpkin character in 'Cauldron 2' on the C64.
edit: actually, K_W that's a great idea, maybe if you ECM them they can burst into 4 smaller faster mini-pumpkins

actually, does anyone know if it's possible to modify the players hud on the fly, so that if they get hit by a pumpkin their screen gets obscured by a splat of pumpkin goo?

Re: OXP Help - NPC ship that attacks only using missiles?

Posted: Mon Oct 24, 2011 6:47 pm
by Eric Walch
Thargoid wrote:
The AI command fireMissile (with a suitable target set first), or indeed the equivalent function (with brackets) in JS, is your friend (or black cat) here...
As thargoids says you must explicit fire the missiles in your script, or oolite will decide for you. However just using the AI command fireMissile might give unwanted results for you as oolite will use random missiles in 10% of the cases.

To get full controll define in shipdata:

Code: Select all

max_missiles = 1;
missiles = 0;
that way the ship will be initialized without any missiles. Than in the AI fire a missile with:

Code: Select all

"sendScriptMessage: $fireMissile"
Than in the ship script of your ship (you have to add one) add the lines:

Code: Select all

this.$fireMissile = function ()
{
    this.ship.awardEquipment("EQ_griff_pumpkin_missile");
    this.ship.fireMissile();
}
That will guarantee that only this missile is loaded and than immediately fired. So your bay is empty again and oolites internal code will never be able to fire one unexpected. This code will supply an unlimited amount of missiles as you requested. When you want a limit, just add a counter in above function like:

Code: Select all

this.missiles = 6;

this.$fireMissile = function ()
{
    if (this.missiles > 0)
    {
        this.ship.awardEquipment("EQ_griff_pumpkin_missile");
        this.ship.fireMissile();
        this.missiles--;
    }
}

Re: OXP Help - NPC ship that attacks only using missiles?

Posted: Mon Oct 24, 2011 7:21 pm
by CommonSenseOTB
Griff wrote:
Thanks Guys! I've got the pumpkins working now - i think i'll give her a small, weak plasma turret as a main weapon, and she can fire off her pumpkins whenever the mood takes her, plasma bolts look a bit like magic spells, well sort of...
@K_W - she did use her missiles, but seemingly only after you shot at her a bit - i've got the flickery engine effect added in as a glow map on the pumpkin face, i think i'll have a bit of an experiment with wobbling the scale using a vertex shader, see if i can get them squash & stretching like the bouncing pumpkin character in 'Cauldron 2' on the C64.
edit: actually, K_W that's a great idea, maybe if you ECM them they can burst into 4 smaller faster mini-pumpkins

actually, does anyone know if it's possible to modify the players hud on the fly, so that if they get hit by a pumpkin their screen gets obscured by a splat of pumpkin goo?
Very cool Griff! :lol:

Have you got a picture of the pumpkin goo as it looks like smeared on the viewscreen? I could probably make a script that checks which missile hit you, stores which hud you had, switches to a hud with just the goo on it, and using a timer replaces back the previous hud. Would be fun to try and get it to work over the next couple of days. Maybe find a splat sound for it too! :D

Re: OXP Help - NPC ship that attacks only using missiles?

Posted: Mon Oct 24, 2011 7:26 pm
by DaddyHoggy
Griff wrote:
Thanks Guys! I've got the pumpkins working now - i think i'll give her a small, weak plasma turret as a main weapon, and she can fire off her pumpkins whenever the mood takes her, plasma bolts look a bit like magic spells, well sort of...
@K_W - she did use her missiles, but seemingly only after you shot at her a bit - i've got the flickery engine effect added in as a glow map on the pumpkin face, i think i'll have a bit of an experiment with wobbling the scale using a vertex shader, see if i can get them squash & stretching like the bouncing pumpkin character in 'Cauldron 2' on the C64.
edit: actually, K_W that's a great idea, maybe if you ECM them they can burst into 4 smaller faster mini-pumpkins

actually, does anyone know if it's possible to modify the players hud on the fly, so that if they get hit by a pumpkin their screen gets obscured by a splat of pumpkin goo?
Give her a wand and have the plasma spurt from the tip of the wand....

BTW, just wanted to say - wonderful Griff, really wonderful (or given the celebration more accurately - Terrific)

Re: OXP Help - NPC ship that attacks only using missiles?

Posted: Mon Oct 24, 2011 8:14 pm
by JazHaz
OMG and I thought April was 6 months away :lol:

Re: OXP Help - NPC ship that attacks only using missiles?

Posted: Mon Oct 24, 2011 8:42 pm
by Svengali
Hehehe - cool OXP and nice model/texture work, Griff!
Griff wrote:
actually, does anyone know if it's possible to modify the players hud on the fly, so that if they get hit by a pumpkin their screen gets obscured by a splat of pumpkin goo?
Two possibly ways, I'd think. Either the way CSOTB has suggested or via shader (like the hyperjump in BGS or the overlays in Vector). CSOTBs way will work for all users, so it's probably the better option here.

Re: OXP Help - NPC ship that attacks only using missiles?

Posted: Tue Oct 25, 2011 4:27 am
by CommonSenseOTB
Griff, I've got something that might work. When you have a version for test where the missiles work the way you want them to, then I will attach a script to the pumpkin missile and have a test. You will have to provide a png of the pumpkin goo however for me to install as my test will simply use a test picture only. :D

Re: OXP Help - NPC ship that attacks only using missiles?

Posted: Tue Oct 25, 2011 6:57 am
by Killer Wolf
"she can fire off her pumpkins whenever the mood takes her"
"have the plasma spurt from the tip of the wand"

;-)