2008.05.11, 09:44 AM
First, here is a cruise rocket, similar to the long range homing missles in EV Override. On launch it is supposed to play the "Launch" animation and then goes into the "IdleAni" animation. It should be homing on "Bot" types.
The rocket spawns and flys and all, there are no error messages. But 1) the "Launch" animation is maybe not played. That animation is in the Cruise Rocket model, it's 1,5 sec long and produces red particles. Same particle works for ship engines, so that's not the problem. Later it does not go into the "IdleAni" which produces a grey trail particle. That one again works on other particles.
2) It does not home on "Bot" types. In my test map there is a Rocket Turret which is a Bot, which works. Don't know why it does not home in on it. If I make the Cruise Rocket home on "Objects" I can hurt myself, maybe that's a sign that it works in general.
The rocket spawns and flys and all, there are no error messages. But 1) the "Launch" animation is maybe not played. That animation is in the Cruise Rocket model, it's 1,5 sec long and produces red particles. Same particle works for ship engines, so that's not the problem. Later it does not go into the "IdleAni" which produces a grey trail particle. That one again works on other particles.
2) It does not home on "Bot" types. In my test map there is a Rocket Turret which is a Bot, which works. Don't know why it does not home in on it. If I make the Cruise Rocket home on "Objects" I can hurt myself, maybe that's a sign that it works in general.
Code:
// ***********************************************************
//
// Projectile: Cruise Rocket
//
// ***********************************************************
function Construct(proj)
{
// models
proj.model.on=true;
proj.model.name="CruiseRocket";
proj.model.rotate.z=10;
// hit scan type projectile
proj.setting.hitScan=false;
// light
proj.model.light.on=true;
proj.model.light.intensity=2800;
proj.model.lightColor.red=1;
proj.model.lightColor.green=0.2;
proj.model.lightColor.blue=0;
// speed
proj.speed.maxHitScanDistance=200000;
proj.speed.speed=180;
proj.speed.deceleration=0;
proj.speed.decelerationWait=0;
proj.size.weight=0;
proj.size.x=143; // 83; // ;
proj.size.z=485; // 1032; // 153; // ;
proj.size.y=143; // 143; // ;
// the damage
proj.action.damage=300;
proj.action.autoHitTick=24000;
proj.action.collision=true;
proj.melee.strikeBoneTag='cent';
proj.melee.strikePoseName='Idle';
proj.melee.radius=2500;
proj.melee.damage=15;
proj.melee.force=40;
proj.melee.lifeTick=500;
// no decal
}
function Hit(proj)
{
// spawn.particle(proj.position.x,proj.position.z,proj.position.y,'Yellow Cannon Hit');
proj.melee.spawnFromProjectileBone();
proj.model.animation.start('Explosion');
proj.action.destroy();
}
//
// projectile spawn
//
function Timer(proj,tick)
{
// is it locked on?
if (lockId!=-1) {
proj.action.seek(lockId,10,15);
return;
}
// find something to lock on
if (!map.setting.multiplayer) {
lockId=map.object.nearest(proj.position.x,proj.position.z,proj.position.y,null,'Bot',null,null,0,20000);
}
else {
lockId=map.object.nearestRemotePlayer(proj.position.x,proj.position.z,proj.position.y,null,null,null,0,20000);
}
}
function Spawn(proj)
{
proj.model.animation.startThenChange('Launch','IdleAni');
// proj.model.animation.start('IdleAni');
spawn.particle(proj.origin.x,proj.origin.z,proj.origin.y,'Small Dark Smoke Ring');
// sound.play('Alien1_Cannon',proj.position.x,proj.position.z,proj.position.y,1.25);
}
//
// events
//
function event(proj,mainEvent,subEvent,eventId,tick)
{
switch (mainEvent) {
case DIM3_EVENT_CONSTRUCT:
Construct(proj);
return;
case DIM3_EVENT_TIMER:
missileTimer(proj,tick);
return;
case DIM3_EVENT_HIT:
Hit(proj);
return;
case DIM3_EVENT_SPAWN:
Spawn(proj);
return;
}
}