RF scripting problem

Topics regarding Scripting with Reality Factory
Post Reply
SSFlame
Posts: 13
Joined: Mon Mar 17, 2008 10:26 pm

RF scripting problem

Post by SSFlame » 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();

User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA
Contact:

Re: RF scripting problem

Post by darksmaster923 » Wed Mar 19, 2008 3:47 am

hi and welcome to the forums!
one thing wrong is that the die order is not closed
you have

Code: Select all

Die[()
{
RestartOrder();
you should have

Code: Select all

Die[()
{
RestartOrder();
} ]
also since you have console(true); look in the left hand corner of the screen and tell us what it says if the problem persists. if there is no text, then the script is not running and there is a different error. and make sure the entity in the editor is properly set up.
Herp derp.

User avatar
bernie
RF Moderator
Posts: 1249
Joined: Tue Nov 15, 2005 10:07 am
Location: Ireland

Re: RF scripting problem

Post by bernie » Wed Mar 19, 2008 11:52 am

There should also be a script opening bracket
at the beginning of the script like so:-

{
Spawn[()
{
etc.....


and a script closing bracket at the end + 2 linefeeds (blank lines) after it:-

Die[()
{
RestartOrder();
} ]

}//end script

The two linefeeds go here.

I don't know why you need the linefeeds at the end of the script and most times it will work without but sometimes it won't.
The opening and closing brackets are vital, the script won't run at all without them.

SSFlame
Posts: 13
Joined: Mon Mar 17, 2008 10:26 pm

Re: RF scripting problem

Post by SSFlame » Sat Mar 22, 2008 12:05 am

yah i tried those suggestions and all the monster does is play his idle animation he still just stands thier doing nothing could you help me figure out what the problem is

Post Reply