zooloo75 834 Posted June 14, 2013 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 1 Share this post Link to post Share on other sites
sgt_Savage2003 10 Posted June 14, 2013 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
sgt_Savage2003 10 Posted June 17, 2013 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
Johnson11B2P 3 Posted June 17, 2013 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
sgt_Savage2003 10 Posted June 17, 2013 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
Johnson11B2P 3 Posted June 17, 2013 What command did you use for the animation? Share this post Link to post Share on other sites
sgt_Savage2003 10 Posted June 18, 2013 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
Johnson11B2P 3 Posted June 18, 2013 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
sgt_Savage2003 10 Posted June 19, 2013 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
f2k sel 164 Posted June 19, 2013 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
XianGrim 73 Posted September 22, 2014 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
Dariox 10 Posted October 12, 2014 Hi guys, this script no work in multiplAyer, any idea ? Share this post Link to post Share on other sites
duriel 10 Posted October 13, 2014 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
Dariox 10 Posted October 13, 2014 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
duriel 10 Posted October 13, 2014 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
Dariox 10 Posted October 23, 2014 but work fine in MP ? Share this post Link to post Share on other sites
anfo 118 Posted May 13, 2015 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
Wipeout Frankie 0 Posted October 13, 2016 I know this was posted a while back, but it's still relevant and a very simple method. Thank you for putting this together and sharing. Share this post Link to post Share on other sites
D.Medina 0 Posted March 1, 2017 So has anyone made it work in multiplayer? Share this post Link to post Share on other sites
Andres97 17 Posted July 30, 2017 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
AdamAb44 0 Posted September 6, 2017 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
loopdk 92 Posted June 21, 2018 can we get a test mission? Share this post Link to post Share on other sites