Jump to content
zooloo75

[Script] - Moving Target

Recommended Posts

Download the script

Yesterday I received a request to make a function that makes a moving target. I was busy developing my mission, but being the nice guy that I am, I took 10 mins out of my routine to help him out. I then read some posts on the forums a few minutes ago to see that other people wanted to find out how to make a target move. So I present to you, a function that makes a target move.

It's simple, but it should help those in need :)

To use this, execVM the sqf, then add this line replacing "targetObject" with the target's name.

[targetObject,((direction targetObject) + 90),10,0.1,3] spawn fn_MovingTarget; //target,direction,distance to move, speed, pause time

  • Haha 1

Share this post


Link to post
Share on other sites

Any way you can help me out with the moving pop up targets and the steel targets that where seen in the E3 stage Demo., I have searched every known thread on this topic. But since they are For A2 most of the scripting will not work for me . Iam New to Coding.

Thanks Zooloo75

And I did Add you as a friend on steam Iam seabourne740.

Share this post


Link to post
Share on other sites

To use this, execVM the sqf, then add this line replacing "targetObject" with the target's name.

[targetObject,((direction targetObject) + 90),10,0.1,3] spawn fn_MovingTarget;

I have the execVM.sqf in my init.sqf, how and where do I add the above code to the moving target.sqf

Share this post


Link to post
Share on other sites
I have the execVM.sqf in my init.sqf, how and where do I add the above code to the moving target.sqf

[targetObject,((direction targetObject) + 90),10,0.1,3] spawn fn_MovingTarget;

targetObject refers to the object/unit you want to be the moving target. So in the editor you could make multiple moving targets for example. moveT00, moveT01

To get this to work you would basically replace targetObject with the global variables moveT00, moveT01.

[moveT00,((direction moveT00) + 90),10,0.1,3] spawn fn_MovingTarget;

[moveT01,((direction moveT01) + 90),10,0.1,3] spawn fn_MovingTarget;

You could put those two lines anywhere as long as they are placed after the execVM.sqf. If these are called and the function hasn't been read by the mission you would get an error. Another way is if you put a unit

down in the editor, in the initialization box put this line in.

[this,((direction this) + 90),10,0.1,3] spawn fn_MovingTarget;

Share this post


Link to post
Share on other sites

Thanks Johnson will have to give it a try. also Why I have your attention do you know how to make the steel oval targets go down? I have tried setting them to no health and shooting them and i get nothing. Also I have tried the animate command (trec 0) but I still get nothing.

Any help would be praised.

Share this post


Link to post
Share on other sites

Sorry I dont know off hand will have to look. If you know of the one that works yet me know.

---------- Post added at 09:38 PM ---------- Previous post was at 08:43 PM ----------

Johnson I put this in the init of the target I want to make moveable, but Iam getting coding errors.

[this,((direction this) + 90),10,0.1,3] spawn fn_MovingTarget; 

Iam getting

 Type script, Nothing Expected

If some one can help.

Share this post


Link to post
Share on other sites

ah my bad I forgot to add this. In the init box you have to put null = [this,((direction this) + 90),10,0.1,3] spawn fn_MovingTarget;

Sorry about that.

Share this post


Link to post
Share on other sites
ah my bad I forgot to add this. In the init box you have to put null = [this,((direction this) + 90),10,0.1,3] spawn fn_MovingTarget;

Sorry about that.

Still no luck with this, I don't know what iam doing wrong here.

I did stop getting error codes.

Share this post


Link to post
Share on other sites

first you need to start the function null=[] execvm "MovingTarget.sqf";

Then you need to pass the variables to the function.

You may need to delay these as functions take a second to start.

Try placing them in a trigger and you will need to pass the name of the target

on act

null=[targ1,((direction targ1) + 90),10,0.1,.3] spawn fn_MovingTarget;

Share this post


Link to post
Share on other sites
first you need to start the function null=[] execvm "MovingTarget.sqf";

Then you need to pass the variables to the function.

You may need to delay these as functions take a second to start.

Try placing them in a trigger and you will need to pass the name of the target

on act

null=[targ1,((direction targ1) + 90),10,0.1,.3] spawn fn_MovingTarget;

Hey Guys, I used this method and got this to work 100% in the editor. Thanks so much F2k Sel.

One problem I'm having is that this only works inside the editor or SP. Soon as I get into MP or load it up on my groups Dedicated box, it skips around on the track. Its not fluid anymore.

Thoughts?

Share this post


Link to post
Share on other sites

Hi guys, this script no work in multiplAyer, any idea ?

Share this post


Link to post
Share on other sites

I can not start it, I put movingtarget.sqf in the folder mission, in init. I included this null = [] execVM "MovingTarget.sqf"; then in the pop up I inserted the string "[this, ((direction this) + 90), 10,0.1,3] spawnwn fn_MovingTarget," but it gives me the error "missing"

Share this post


Link to post
Share on other sites

insert i a trigger null=[targ1,((direction targ1end) + 90),10,0.1,.3] spawn fn_MovingTarget;

Share this post


Link to post
Share on other sites

THx Dariox now still works... I saw now that there was a point before 3, removing it I have solved the mystery.

Share this post


Link to post
Share on other sites

I know this is an old thread, but the information is still relevant to me and maybe others. I can't get it to work. Can anybody verify?

Share this post


Link to post
Share on other sites

Tried it in Dedi, the target skips sections of the rails, anyone got it to work?

Share this post


Link to post
Share on other sites

Hello, tried it with the execVM as f2k sel said.
 

On 19. 6. 2013 at 4:45 AM, f2k sel said:

first you need to start the function null=[] execvm "MovingTarget.sqf";

Then you need to pass the variables to the function.

You may need to delay these as functions take a second to start.

Try placing them in a trigger and you will need to pass the name of the target

on act

 


null=[targ1,((direction targ1) + 90),10,0.1,.3] spawn fn_MovingTarget;
 

 

 

Even though it´s not working for me. Anyone has thoughts about possible issues?

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

×