shuko 59 Posted December 18, 2009 (edited) I don't know if there are that many people who will find this useful, but if it helps even just one, it's worth sharing. With this script you can quite easily move multiple objects from A to B without the objects loosing relative positions to each other. That's all it does, basically saves you from doing all the "setpos select 0 + 1.7" stuff. New, range based, version. Left the older version available as well, because name based move might be handy in a crowded areas. SHK_moveObjects Author: Shuko (miika.jarvinen@pp3.inet.fi, shuko@quakenet) Version 0.31 Moves set of objects from A to B, retaining the direction and distance from a point of reference. Parameters: 0: Object or Position Anchor, point of origin. 1: Object or Position Center position to which objects are move around. 2: Number Range in meters to search for objects. 3: Array or String Optional. Type of objects to search for. 4: Number or Object Optional. Direction adjustment. Affects position of objects, not the dir they will be facing. 5: Number or Object Optional. Direction the objects will be facing after they are moved. Examples: nul = [gl1,gl2,50] execvm "shk_moveobjects.sqf" nul = [start,destination,100,"Man"] execvm "shk_moveobjects.sqf" nul = [[3243,5234,0],gl2,50,["Man","Car"]] execvm "shk_moveobjects.sqf" nul = [gl1,gl2,50,[],gl2] execvm "shk_moveobjects.sqf" nul = [gl1,gl2,50,[],45] execvm "shk_moveobjects.sqf" nul = [gl1,gl2,50,[],45,270] execvm "shk_moveobjects.sqf" SHK_moveobjects.sqf SHK_moveobjects.rar Using parameters 4 and 5 WWQyGZuF4O0 ------------------------------------------------------------------- SHK_moveobjects_old.sqf SHK_moveobjects_old.rar 6MVGsFy6W8A Edited December 6, 2010 by Shuko Share this post Link to post Share on other sites
shuko 59 Posted August 10, 2010 New, range based, version. Left the older version available as well, because name based move might be handy in a crowded areas. Hopefully youtube processes the video without acting up about codecs or whatever. :) Share this post Link to post Share on other sites
wiggum2 31 Posted August 10, 2010 Very usefully for me, thanks ! Share this post Link to post Share on other sites
IndeedPete 1038 Posted August 10, 2010 Great, will try to use it! Share this post Link to post Share on other sites
Nielsen 10 Posted August 10, 2010 This is a great idea. It is nice not having to create DOC's just to move objects relative to each other. Thanks man! Share this post Link to post Share on other sites
CaptainBravo 0 Posted September 13, 2010 excellent script! How can you make it random between 3 locations so the 4 objects will show next to one of 3 Hpads? Share this post Link to post Share on other sites
shuko 59 Posted September 13, 2010 (edited) excellent script! How can you make it random between 3 locations so the 4 objects will show next to one of 3 Hpads? First randomly select one of the 3 hpads. Then pass that one to this script. Something like this, didn't test it though: if isserver then { _pads = [hpad1,hpad2,hpad3]; _dest = _pads select (floor (random count _pads)); [start,_dest,100] execvm "shk_moveobjects.sqf" }; Edited September 13, 2010 by Shuko Share this post Link to post Share on other sites
CaptainBravo 0 Posted September 13, 2010 Thanks shk. I have tried it quick but no luck as nothing moved. A simple demo mission will be highly appreciated by those who lack the scripting gene! :) Share this post Link to post Share on other sites
kylania 568 Posted September 13, 2010 Example Mission The player and objects comprising a scud site are placed in the editor on the airfield along with a invis hpad called siteObjects. Three other invis hpads are placed in various areas around the map. Using this code in the init.sqf will move the whole group of objects to one of the other hpads randomly: if isServer then { _pads = [hpad1,hpad2,hpad3]; _dest = _pads select (floor (random count _pads)); [siteObjects, _dest, 25] execVM "shk_moveobjects.sqf"; }; Share this post Link to post Share on other sites
CaptainBravo 0 Posted September 13, 2010 Example MissionThe player and objects comprising a scud site are placed in the editor on the airfield along with a invis hpad called siteObjects. Three other invis hpads are placed in various areas around the map. Using this code in the init.sqf will move the whole group of objects to one of the other hpads randomly: if isServer then { _pads = [hpad1,hpad2,hpad3]; _dest = _pads select (floor (random count _pads)); [siteObjects, _dest, 25] execVM "shk_moveobjects.sqf"; }; Thanks kylania for your quick response. That is what I was looking for. I like your site by the way, great demo missions! Share this post Link to post Share on other sites
VanhA-ICON 11 Posted September 16, 2010 This is just so simple and brilliant at the same time. This solved my problem in a WIP mission to magically have a roadblock with units in a place that was empty before. (without having to create them) Kiitos! :bounce3: Share this post Link to post Share on other sites
mcvittees 0 Posted December 2, 2010 This is just what I needed - thanks Kylania and Shk! Share this post Link to post Share on other sites
shuko 59 Posted December 6, 2010 Version 0.3 Added two new, optional, parameters. They can be used to adjust the direction and facing of moved objects. 4: Number or Object Optional. Direction adjustment. Affects position of objects, not the dir they will be facing. 5: Number or Object Optional. Direction the objects will be facing after they are moved. Using the parameters 4 and 5 ---------- Post added at 01:46 PM ---------- Previous post was at 12:03 PM ---------- Uploaded 0.31, tiny tweak to make sure the original facing of object is kept after move if no facing parameter is given. As always, tell me if you find a bug or if something weird is happening with the script. Share this post Link to post Share on other sites
chiefredcloud 10 Posted December 6, 2010 I'm confused .... which in itself is not unusual .... but .... when I clink on the link in Armaholick I get a file called SHK_insurgentmortar instead of SHK_moveobjects. Is this right? Share this post Link to post Share on other sites
shuko 59 Posted December 6, 2010 No it's not. The first message in this thread always has the correct and latest version. Share this post Link to post Share on other sites
Guest Posted December 6, 2010 Sorry, we linked wrong in the Armaholic news but its fixed now :) Thanks for the headsup shk! Share this post Link to post Share on other sites
kdjac 19 Posted December 6, 2010 Being a lucky idiot i managed to make this work with a officer popping up in 10 random places and becoming an objective with a small crew gaurding him. Made a mission a lot better than i thought i could as i used Fallujah. Excellent script now im trying to make it move a FOB to an airport after the airport is cleared of enemies. :) Share this post Link to post Share on other sites
Skagget 11 Posted December 24, 2010 Is there away to random choose a set of objects done. Its kind of reversed what kylania made hehe. What works with kylania addons script is that one object set can be in a random place of three. Lets say: a pack of soldiers coudl either be in place 1, place 2 or place 3. What I want is that a pack of random three objects could spawn on space 1. So say three diffrent camps, packs of cars etc can be spawned in an area. So if you visit named area you could either see pack 1 or pack 2 or pack 3 in that one place. So in kylania script words; siteObjects1 siteObjects2 siteObjects3 random hpad. Meaning you dont know what kind of objects you meet when you replay the mission. Why I want this to work with SHK-script is that I really like how easy you can set up a object group, say a camp and move it around on invisH :) Share this post Link to post Share on other sites
shuko 59 Posted December 24, 2010 Doesn't require any modification to the script. Just randomly decide which objects to spawn, after that run the move. Share this post Link to post Share on other sites
Skagget 11 Posted December 25, 2010 Doesn't require any modification to the script. Just randomly decide which objects to spawn, after that run the move. Yeah that much I do understand :) Im more into graphic design then codes so slowly getting the hang of this.. The code that needs to be altered is the one from Kylania: if isServer then { _pads = [hpad1,hpad2,hpad3]; _dest = _pads select (floor (random count _pads)); [siteObjects, _dest, 25] execVM "shk_moveobjects.sqf"; }; So in that text the variable "_pads" is where the object will turn up and the first line sets up the actual names of the places of the invicH. The next line is the variable of where "_dest" and that is the "_pads" and "select" I guess is used as "take it" kinda command.. and what I have been reading on the wiki part of commands the "floor" is a sort of random command that is best to use, so floor+random count is to randomize "_pads" and then the object "siteObjects" is in SHKs call command with "_dest" and 25area and a execVM part.. So I get the hang of that part.. sorta hehe :) ahumm.. the part is how to change it to random the object part instead of destination part in that script. I would like it to go for, but I know that wount work if isServer then { _obj = [obj1,obj2,obj3]; _obj = _obj select (floor (random count _obj)); [obj, place, 25] execVM "shk_moveobjects.sqf"; }; The actual "_dest" is set, I know where it is its a known invicH called "place". So I dont need to random the destination of it, just what kind of object set that will end up there random from (in this case) three invicH. Lets say the first object invicH contains a soldier, the next a tank, and the next nothing. So upton enter the area you will either meet a soldier, a tank or just be lucky to not meet anything. Share this post Link to post Share on other sites
shuko 59 Posted December 25, 2010 So, you have created three invisible helipads? Placed the wanted units on top of them? if isServer then { _pads = [hpad1,hpad2,hpad3]; _pad = _pads select (floor (random count _pads)); [_pad, place, 25] execVM "shk_moveobjects.sqf"; }; Share this post Link to post Share on other sites
Skagget 11 Posted December 25, 2010 (edited) So, you have created three invisible helipads? Placed the wanted units on top of them? Thats right, three pads containing units of choice. And one pad that one of the three will end up as per random. ( units ) ( units ) ( units ) -- random of them end up at -- > ( place ) So I guess your version of code is what Im looking for :) your core script is perfect and many thanks for sharing it :) EDIT: It works like a charm the way you put the code in post above, so thanks :) Edited December 25, 2010 by trick99 Share this post Link to post Share on other sites
kdjac 19 Posted January 10, 2011 Little question about this (version .20) I have 5 opfor playable soliders and an AA launcher grouped, 2 playable US soldiers and an ammo box grouped. In the editor they all randomly spawn fine but on a dedicated server they spawn in one place only but the AA and Ammo randomly move around :confused: is the correct way to use it? (Kinda modified it but siteobjects is Opfor and siteobjects1 is US) if isserver then { _pads = [hpad1,hpad2,hpad3,hpad4,hpad5,hpad6,hpad7,hpad8,hpad9]; _dest = _pads select (floor (random count _pads)); [siteObjects,_dest,25] execvm "shk_moveobjects.sqf"; _pads = [hpad12,hpad13]; _dest = _pads select (floor (random count _pads)); [siteObjects1,_dest,25] execvm "shk_moveobjects.sqf"; }; cheers Share this post Link to post Share on other sites
shuko 59 Posted January 11, 2011 So, basically, AA and box moves correctly but the playable units dont? Share this post Link to post Share on other sites
kdjac 19 Posted January 11, 2011 So, basically, AA and box moves correctly but the playable units dont? Pretty much that, but in the editor everything moves. Share this post Link to post Share on other sites