2008.05.29, 03:52 AM
Right, so I was playing around with alex's terrorist script (With permission), and it keeps complaining in the console:
Code:
218, SyntaxError: Missing after function body
Between missing and after, I think, is a double space. I imagine this means something I havn't put in yet, or something.
Heres the modifyed script:
Code:
//
// Terrorist Bot Script
// -----------------
//
// Stationary Type
//
// ******************************************************************************** ************
var maxShots;
var currentShots;
var lastHitTick;
var closehitrand;
function construct(obj) {
obj.model.on=true;
obj.model.name="enemy_terrorist1";
obj.model.lit=DIM3_MODEL_LIT_VERTEX;
obj.setting.damage=true;
obj.size.x=1000;
obj.size.z=948;
obj.size.y=3212;
obj.size.weight=250;
obj.radar.on=true;
obj.radar.icon="enemy";
obj.radar.on=true;
obj.radar.motionOnly=true;
obj.radar.on=true;
obj.radar.icon="enemy";
obj.radar.on=true;
// melee time!
obj.melee.strikeBoneTag='barr';
obj.melee.strikePoseName='Hit2.2';
obj.melee.radius=1000;
obj.melee.distance=1000;
obj.melee.damage=20;
obj.melee.force=15;
obj.sight.sideFieldAngle=0;
obj.sight.lookFieldAngle=90;
// obj.sight.sideFieldDivision=1;
// obj.sight.lookFieldDivision=8;
obj.sight.distance=5000;
obj.weapon.add('terrorist_smg');
obj.weapon.add('splatter');
obj.health.maximum=50;
obj.health.start=50;
obj.turnSpeed.motionWalk=6;
obj.turnSpeed.facingWalk=6;
obj.setting.openDoors=false;
obj.setting.ignorePickUpItems=true; // don't pickup the weapons/ammo
}
function spawn(obj) {
obj.watch.start(5000);
}
function watch(obj,subEvent) {
if((!obj.sight.testPlayer)||(!obj.watch.objectIsPlayer)||(subEvent!=DIM3_EVENT_WATCH_OBJECT_NEAR))return;
else {
var rand=utility.random.getInteger(1,10);
obj.event.chain(rand,'standup');
}
if((obj.watch.objectIsPlayer)&&(subEvent!=DIM3_EVENT_WATCH_OBJECT_NEAR)) {
obj.event.clearTimer();
obj.event.clearChain();
}
}
function standup(obj) {
obj.size.x=1000;
obj.size.z=948;
obj.size.y=3212;
obj.radar.on=true;
obj.model.animation.startThenChange('crouchtostand','standing');
obj.event.chain(2,'openfire');
if (obj.position.distanceToPlayer()>3000) {
var closehitrand = utility.random.getInteger(1,4);
if (closehitrand == 1) {
obj.event.chain('meleestrike');
}
if (closehitrand == 2) {
obj.event.chain('meleestrike');
}
if (closehitrand == 3) {
obj.event.chain('meleestrike');
}
if (closehitrand == 4) {
obj.event.chain(2,'openfire');
}
}
function openfire(obj) {
maxShots=utility.random.getInteger(5,20);
currentShots=0;
obj.motionVector.turnToPlayer();
obj.event.startTimer(1,0); // alter refire rate here;
}
function timer(obj) {
obj.model.animation.start('fire');
obj.weapon.fire('terrorist_smg',0);
if (currentShots<maxShots) {
currentShots=currentShots+1;
}
else {
obj.event.clearTimer();
obj.radar.on=false;
obj.model.animation.startThenChange('standtocrouch','crouch');
obj.motionAngle.turnStop();
var rand=utility.random.getInteger(20,60);
obj.event.chain(rand,'standup');
}
}
function damage(obj,tick) {
var health,pauseCount;
health=obj.health.current;
if (health<=0) return;
obj.event.clearChain();
obj.model.lit=DIM3_MODEL_LIT_VERTEX;
switch (obj.hit.hitBoxName) {
case 'Object':
var anim=utility.random.getInteger(1,3);
obj.model.animation.interrupt('flinch'+anim);
pauseCount=4;
break;
default:
var anim=utility.random.getInteger(1,3);
obj.model.animation.interrupt('flinch'+anim);
pauseCount=4;
break;
}
obj.watch.stop();
obj.motionVector.stop();
obj.motionAngle.turnStop();
obj.event.chain(pauseCount,'standup');
}
function die(obj) {
obj.model.animation.startThenChange('dying','dead');
obj.weapon.fire('splatter');
obj.radar.on=false;
obj.setting.contact=false;
obj.setting.suspend=true;
obj.event.clearTimer();
obj.event.clearChain();
obj.radar.on=false;
obj.watch.stop();
}
function meleestrike(obj) {
obj.size.x=0;
obj.size.z=0;
obj.size.y=0;
obj.model.animation.start('Hit');
obj.event.chain(10,'standup');
}
function event(obj,event,subEvent,id,tick) {
switch(event) {
case DIM3_EVENT_CONSTRUCT:
construct(obj);
break;
case DIM3_EVENT_SPAWN:
obj.watch.start(70000);
obj.model.animation.start('crouch');
break;
case DIM3_EVENT_WATCH:
watch(obj,subEvent);
break;
case DIM3_EVENT_TIMER:
timer(obj);
break;
case DIM3_EVENT_DAMAGE:
damage(obj,tick);
break;
case DIM3_EVENT_DIE:
die(obj);
break;
}
}
I don't want anyone thinking I'm good enough to do something like that.