Jump to content
Sign in to follow this  
pvtcharry

AI shooting script

Recommended Posts

Hello guys! I can't get this Script get to workd. Everytime I use it via trigger it give an error that [ is missing. I couldn't really figure out what the exact problem is. Furthermore I tried to use the first script in the Initline of an unit. It worked very well. But when i tried to use it via trigger (changed the variables) wether the soldier shot nor did I get an error.

Thanks in advance

 null=this spawn
 {
     _this dotarget t1;
     sleep 2;
     while {alive t1 and alive _this} do
     {
         sleep 0.3;
         gl action ["useweapon",vehicle _this,_this,0];
     }
 }
 
 "uns_nva3mg" createUnit [getMarkerPos "Spawn",chef, "lal=this;"];  
 "uns_nva3mg" createUnit
 [
     getMarkerPos "Spawn",chef,
        "
         lal=this;
         null=this spawn
         {
         lal dotarget t1;
         sleep 2;
         while {alive t1 and alive lal} do
         {
         sleep 0.3;
         gl action ["useweapon",vehicle lal,lal,0];
     "
 ];

Share this post


Link to post
Share on other sites

You're missing two closing brackets in the second last line, if my eyes aren't tricking me.

null=this spawn
{
_this dotarget t1;
sleep 2;
while {alive t1 and alive _this} do
{
sleep 0.3;
gl action ["useweapon",vehicle _this,_this,0];
}
}

"uns_nva3mg" createUnit [getMarkerPos "Spawn",chef, "lal=this;"]; 
"uns_nva3mg" createUnit
[
getMarkerPos "Spawn",chef,
"
lal=this;
null=this spawn
{
lal dotarget t1;
sleep 2;
while {alive t1 and alive lal} do
{
sleep 0.3;
gl action ["useweapon",vehicle lal,lal,0];
};
};
"
];

Cheers

  • Like 1

Share this post


Link to post
Share on other sites

You're missing two closing brackets in the second last line, if my eyes aren't tricking me.

null=this spawn
{
_this dotarget t1;
sleep 2;
while {alive t1 and alive _this} do
{
sleep 0.3;
gl action ["useweapon",vehicle _this,_this,0];
}
}

"uns_nva3mg" createUnit [getMarkerPos "Spawn",chef, "lal=this;"]; 
"uns_nva3mg" createUnit
[
getMarkerPos "Spawn",chef,
"
lal=this;
null=this spawn
{
lal dotarget t1;
sleep 2;
while {alive t1 and alive lal} do
{
sleep 0.3;
gl action ["useweapon",vehicle lal,lal,0];
};
};
"
];

Cheers

Thanks Grumpy but it didn't solve the problem.... It says "On Activation: missing ;"

Share this post


Link to post
Share on other sites

Add semicolons after the closing brackets in the upper part of your snippet.

And get a sqf editor, helps a ton finding errors like that.

 

Cheers

  • Like 1

Share this post


Link to post
Share on other sites

Add semicolons after the closing brackets in the upper part of your snippet.

And get a sqf editor, helps a ton finding errors like that.

 

Cheers

Gosh how couldn't i see that?? Thank you very much mate and also thanks for the editor advice! Have a good one

  • Like 1

Share this post


Link to post
Share on other sites

So this script basically targets a specific enemy who spawns on a marker and then a gun is created?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×