Scripting error
Posted: Sun May 20, 2012 12:45 pm
I have the following script for my soldier model. However when compile the level, he cannot shoot or move or die. He just stand there and doing nothing. Someone help me, is there a problem in my script?
{
IDLE [idle] // idle animation
WALK [walk] // walk animation
DIE [die] // die animation
SHOOT [shoot] // shoot animation
MISC1 [slump] // misc1 animation
GROUP [soldier]
HOSTILEPLAYER [true] // hostile to player
HOSTILESAME [false] // hostile to same Pawn group
HEALTHATTRIBUTE [enemy_health] // name of pawns health attribute
HEALTH [100] // initial pawn health
DAMAGEATTRIBUTE [health] // attribute damaged by attack
ALERTTRIGGER [AlertG] // name of alert trigger
DIEHOLD [15] // time corpse still appears
DIEFADE [10] // fadeout time of corpse
FOV [160] // field of view
SIGHTDIST [700] // max distance pawn can see at idle
ALERTSIGHTDIST [900] // max distance pawn can see when alert
YAWSPEED [90]
WALKSPEED [50]
SHOOTRANGE [300] // max distance to start missile attack
PROJECTILE [10mm_shell] // projectile name
FIREBONE [Joint15] // projectile launch bone
OFFSETX [0] // launch offsets
OFFSETY [0]
OFFSETZ [25]
ATTACKDELAY [0.5] // time between shots
FIREDELAY [0.1] // delay after animation starts before projectile launch
SKILL [5] // skill level 1 to 10
LOSTTIME [15] // time to search for enemy before giving up
POINTRADIUS [20] // radius from point when considered there
RUNFUNC [run_start] // monster run to attack function
SHOOTFUNC [shoot_start] // monster missile function
LOSTFUNC [lost_target_start] // monster lost target function
AS_NONE [0]
AS_SHOOT [2]
AS_STRAIGHT [3]
attack_delay [0]
lost_time [0]
back_up [false]
back_time [0]
left_time [0]
back_flag [false]
fire_delay [0]
skill_time [0]
attack_state [0]
Spawn[ () // spawn actor
{
Console(false); //display console
AttributeOrder(HEALTHATTRIBUTE, HEALTH, "Die"); //Set health attribute, ammount of health, and death seen
FindTargetOrder(200,"Alert","health"); //sets vision distance, section called when target is found
SetFOV(360); //set field of vision
HostilePlayer(HOSTILEPLAYER); //Hostile to player
HostileSame(HOSTILESAME); //Hostile to each other
HostileDifferent(false); //Hostile to other pawns
SetGroup(GROUP); // Enemy Group
}]
Idle[ ()
{
// just look around a bit
Rotate(IDLE, YAWSPEED, 0, 100, 0, "");
Delay(IDLE, random(3,5), "");
Rotate(IDLE, YAWSPEED, 0, -200, 0, "");
Delay(IDLE, random(3,5), "");
Align();
NewOrder("Patrol"); // continue to patrol
} ]
Die[ ()
{
AnimateStop("Die",0,""); //Death Animation
FadeOut(2,0); //Fade out actor
Remove(true); //remove pawn after death
}]
Alert[ () // page 126
{
PlayerDistOrder(-800,"LostTarget"); //Distance at which it can detect a target
AnimateStop(Idle,0,""); //play idle animatino when lost
NewOrder("Attack"); //play attack animation when found
}]
Attack[() // page 128
{
RotateToPlayer(Walk,160,false,""); //page 129
FireProjectile("pistol_shell","BIP01 R FOREARM",0,0,0,"health","");
//Delay("hit",1,"");
if(self.player_range>96)
{
MoveForward(WALK,50,50,"");
}
else
{
Delay("hit",1,"");
}
RestartOrder();
}]
LostTarget[ ()
{
BlendToAnimation(IDLE, 1, false, "");
FindTargetOrder(200,"Alert","health");
}]
{
IDLE [idle] // idle animation
WALK [walk] // walk animation
DIE [die] // die animation
SHOOT [shoot] // shoot animation
MISC1 [slump] // misc1 animation
GROUP [soldier]
HOSTILEPLAYER [true] // hostile to player
HOSTILESAME [false] // hostile to same Pawn group
HEALTHATTRIBUTE [enemy_health] // name of pawns health attribute
HEALTH [100] // initial pawn health
DAMAGEATTRIBUTE [health] // attribute damaged by attack
ALERTTRIGGER [AlertG] // name of alert trigger
DIEHOLD [15] // time corpse still appears
DIEFADE [10] // fadeout time of corpse
FOV [160] // field of view
SIGHTDIST [700] // max distance pawn can see at idle
ALERTSIGHTDIST [900] // max distance pawn can see when alert
YAWSPEED [90]
WALKSPEED [50]
SHOOTRANGE [300] // max distance to start missile attack
PROJECTILE [10mm_shell] // projectile name
FIREBONE [Joint15] // projectile launch bone
OFFSETX [0] // launch offsets
OFFSETY [0]
OFFSETZ [25]
ATTACKDELAY [0.5] // time between shots
FIREDELAY [0.1] // delay after animation starts before projectile launch
SKILL [5] // skill level 1 to 10
LOSTTIME [15] // time to search for enemy before giving up
POINTRADIUS [20] // radius from point when considered there
RUNFUNC [run_start] // monster run to attack function
SHOOTFUNC [shoot_start] // monster missile function
LOSTFUNC [lost_target_start] // monster lost target function
AS_NONE [0]
AS_SHOOT [2]
AS_STRAIGHT [3]
attack_delay [0]
lost_time [0]
back_up [false]
back_time [0]
left_time [0]
back_flag [false]
fire_delay [0]
skill_time [0]
attack_state [0]
Spawn[ () // spawn actor
{
Console(false); //display console
AttributeOrder(HEALTHATTRIBUTE, HEALTH, "Die"); //Set health attribute, ammount of health, and death seen
FindTargetOrder(200,"Alert","health"); //sets vision distance, section called when target is found
SetFOV(360); //set field of vision
HostilePlayer(HOSTILEPLAYER); //Hostile to player
HostileSame(HOSTILESAME); //Hostile to each other
HostileDifferent(false); //Hostile to other pawns
SetGroup(GROUP); // Enemy Group
}]
Idle[ ()
{
// just look around a bit
Rotate(IDLE, YAWSPEED, 0, 100, 0, "");
Delay(IDLE, random(3,5), "");
Rotate(IDLE, YAWSPEED, 0, -200, 0, "");
Delay(IDLE, random(3,5), "");
Align();
NewOrder("Patrol"); // continue to patrol
} ]
Die[ ()
{
AnimateStop("Die",0,""); //Death Animation
FadeOut(2,0); //Fade out actor
Remove(true); //remove pawn after death
}]
Alert[ () // page 126
{
PlayerDistOrder(-800,"LostTarget"); //Distance at which it can detect a target
AnimateStop(Idle,0,""); //play idle animatino when lost
NewOrder("Attack"); //play attack animation when found
}]
Attack[() // page 128
{
RotateToPlayer(Walk,160,false,""); //page 129
FireProjectile("pistol_shell","BIP01 R FOREARM",0,0,0,"health","");
//Delay("hit",1,"");
if(self.player_range>96)
{
MoveForward(WALK,50,50,"");
}
else
{
Delay("hit",1,"");
}
RestartOrder();
}]
LostTarget[ ()
{
BlendToAnimation(IDLE, 1, false, "");
FindTargetOrder(200,"Alert","health");
}]