RF scripting problem
Posted: Tue Mar 18, 2008 10:51 pm
I'm new to this can anyone tell me whats wrong with my script my monster just stands thier and doesn't attack at all and could you also help me get help to do a melee attack.
Spawn[()
{
Console(true);
AttributeOrder("health",20,"Die");
FindTargetOrder(200,"Alert","health");
SetFOV(360);
HostilePlayer(true);
HostileSame(false);
HoostileDifferent(false);
SetGroup("Enemy");
NewOrder("LostTarget");
}]
Alert[()
{
AnimateStop("alert",0,"");
LowLevel("Attack");
}]
LostTarget[()
{
PlayAnimation("idle",false,"");
FindTargetOrder(400,"Alert","health");
}]
Attack[()
{
self.ThinkTime=0.05;
self.yaw_speed=160
UpdateTarget();
if(self.enemy_vis=true)
{
self.ideal_yaw=self.enemy_yaw
ChangeYaw();
if(self.enemy_range>128)
{
SetHoldAtEnd(true);
Animate("attack");
self.think="Walk";
return 0;
}
else
{
TC=self.time;
Animate("attack");
self.think="Stand";
return 0;
}
}
}]
Walk[()
{
self.ThinkTime=0.05;
if(self.health=0)
{
HighLevel("Die");
return 0;
}
if(self.enemy_vis=true)
{
self.ideal_yaw=self.enemy_yaw
ChangeYaw();
}
else
{
SetHoldAtEnd(false);
HighLevel("LostTarget");
return 0;
}
if(self.animate_at_end=false)
{
if(walkmove(sled.ideal_yaw,50)=false)
{
if(random(1,10)>5)
{
ForceLeft(10);
}
else
{
ForceRight(10);
}
}
}
else
{
SetHoldAtEnd(false);
FireProjectile("sword","HandL",0,0,0,"health");
self.think="Attack";
return 0;
}
}]
Stand[()
{
self.ThinkTime=0.05;
if(self.health=0)
{
HighLevel("Die");
return 0;
}
if(self.enemy_vis=true)
{
self.ideal_yaw=self.enemy_yaw;
ChangYaw();
}
else
{
HighLevel("LostTarget");
return 0;
}
if(self.time>TC+1)
{
FireProjectile("sword","HandL",0,0,0,"health");
self.think="Attack";
return 0;
}
}]
Die[()
{
RestartOrder();
Spawn[()
{
Console(true);
AttributeOrder("health",20,"Die");
FindTargetOrder(200,"Alert","health");
SetFOV(360);
HostilePlayer(true);
HostileSame(false);
HoostileDifferent(false);
SetGroup("Enemy");
NewOrder("LostTarget");
}]
Alert[()
{
AnimateStop("alert",0,"");
LowLevel("Attack");
}]
LostTarget[()
{
PlayAnimation("idle",false,"");
FindTargetOrder(400,"Alert","health");
}]
Attack[()
{
self.ThinkTime=0.05;
self.yaw_speed=160
UpdateTarget();
if(self.enemy_vis=true)
{
self.ideal_yaw=self.enemy_yaw
ChangeYaw();
if(self.enemy_range>128)
{
SetHoldAtEnd(true);
Animate("attack");
self.think="Walk";
return 0;
}
else
{
TC=self.time;
Animate("attack");
self.think="Stand";
return 0;
}
}
}]
Walk[()
{
self.ThinkTime=0.05;
if(self.health=0)
{
HighLevel("Die");
return 0;
}
if(self.enemy_vis=true)
{
self.ideal_yaw=self.enemy_yaw
ChangeYaw();
}
else
{
SetHoldAtEnd(false);
HighLevel("LostTarget");
return 0;
}
if(self.animate_at_end=false)
{
if(walkmove(sled.ideal_yaw,50)=false)
{
if(random(1,10)>5)
{
ForceLeft(10);
}
else
{
ForceRight(10);
}
}
}
else
{
SetHoldAtEnd(false);
FireProjectile("sword","HandL",0,0,0,"health");
self.think="Attack";
return 0;
}
}]
Stand[()
{
self.ThinkTime=0.05;
if(self.health=0)
{
HighLevel("Die");
return 0;
}
if(self.enemy_vis=true)
{
self.ideal_yaw=self.enemy_yaw;
ChangYaw();
}
else
{
HighLevel("LostTarget");
return 0;
}
if(self.time>TC+1)
{
FireProjectile("sword","HandL",0,0,0,"health");
self.think="Attack";
return 0;
}
}]
Die[()
{
RestartOrder();