euly 0 Posted June 21, 2014 Hey, I'm trying to have a unit spawn at a number of different locations with a few objects around him, such as a camp fire. I've created triggers at his spawn locations to make a variable true if the unit is present. I put the variable in the objects' Condition of Presence, but that obviously does not work. Can anyone tell me what I'm doing wrong? Share this post Link to post Share on other sites
IT07 10 Posted June 22, 2014 You are actually not doing anything wrong. It is rather a stupid design flaw of ArmA 3. I shall explain: object condition is checked ONCE really really early at the start of the mission. It would be impossible to set a condition for those objects because the condition check for objects is so early. What you can try though (I have made a random car spawn system with this) is let all objects spawn, but when a certain condition is met or not met, you can make a trigger delete all of the not-needed stuff with deleteVehicle nameOfObjectHere; Share this post Link to post Share on other sites
euly 0 Posted June 22, 2014 You are actually not doing anything wrong. It is rather a stupid design flaw of ArmA 3.I shall explain: object condition is checked ONCE really really early at the start of the mission. It would be impossible to set a condition for those objects because the condition check for objects is so early. What you can try though (I have made a random car spawn system with this) is let all objects spawn, but when a certain condition is met or not met, you can make a trigger delete all of the not-needed stuff with deleteVehicle nameOfObjectHere; Thank you for the response. I wound up deleting the objects, just like you said. I wonder if the condition could work if the trigger and the unit were up at the top of the mission.sqm and the objects were close to the bottom. That is, if the mission.sqm is read from top to bottom. Share this post Link to post Share on other sites
IndeedPete 1038 Posted June 22, 2014 Hm, I'm not sure, this is just a guess. But could it be working together with CfgFunctions? I.e. a function that calculates some stuff related to your condition of presence and has been set to run pre-init. Share this post Link to post Share on other sites
IT07 10 Posted June 22, 2014 (edited) I should help you out a little bit more: Let's say you have 3 spawn points that are randomly selected, and after the player is spawned on one of them, you want to delete the rest Here's how you do it: Create 3 triggers and build the spawn place and whatever you want to be at the spawn place. Give all of those objects a name. (make the names really obvious, it will save you a lot of brainwork, I promise) Then you need to make sure that it (whatever selects the random spawnpoint) can run a little script for each spawn point. It should be able to run this little script if player spawns on place 1: playerSpawnedOnOne = true; Do the same for the other spawn point scripts: // for spawn place 2 playerSpawnedOnTwo = true; // for spawn place 3 playerSpawnedOnThree = true; Now you can setup the triggers: for trigger 1, use this condition: playerSpawnedOnOne; (this will check if playerSpawnedOnOne is true) Do this for the other triggers too. (playerSpawnedOnTwo for trigger 2 and so on.....) What we currently have is 3 triggers that will activate when a player spawns on the spawn point that belongs to that trigger :) Now we only have to do the last part of scripting: make sure that if trigger 1 becomes active, it will delete all of the objects that belong to spawn point 2 and 3. And of course, same counts for the other triggers. (2 deletes objects for 1 and 3, 3 deletes objects for 2 and 1) For this, you can do the following: put all of the names for the objects belonging to each point in an array and attach a variable to it: objectsForOne = ["someFireplace", "aTent", "canOfBeans", "emptyMag", "someOtherCrap"]; (put the above in some script that runs as early as possible. (preferably in a script being loaded with preproccessfilelinenumbers) Do the same thing for the other points. (you can put the rest one line below the others) Then, for trigger 1, put this in it's ON ACT field: deleteVehicle objectsForTwo; deleteVehicle objectsForThree; This will keep the on act field very clean instead of putting all of the object names in the on act field :) Do the correct thing for the other triggers as well. Now you should have a solid system running like it should :) You might need to test it though. all of the above code is out of the top of my head so there might be something in there you know ;) Anyways, I hope this was clear enough to you. Good luck! Edited June 22, 2014 by IT07 fixed another typo xD Share this post Link to post Share on other sites
euly 0 Posted July 1, 2014 I should help you out a little bit more:Let's say you have 3 spawn points that are randomly selected, and after the player is spawned on one of them, you want to delete the rest Here's how you do it: Create 3 triggers and build the spawn place and whatever you want to be at the spawn place. Give all of those objects a name. (make the names really obvious, it will save you a lot of brainwork, I promise) Then you need to make sure that it (whatever selects the random spawnpoint) can run a little script for each spawn point. It should be able to run this little script if player spawns on place 1: playerSpawnedOnOne = true; Do the same for the other spawn point scripts: // for spawn place 2 playerSpawnedOnTwo = true; // for spawn place 3 playerSpawnedOnThree = true; Now you can setup the triggers: for trigger 1, use this condition: playerSpawnedOnOne; (this will check if playerSpawnedOnOne is true) Do this for the other triggers too. (playerSpawnedOnTwo for trigger 2 and so on.....) What we currently have is 3 triggers that will activate when a player spawns on the spawn point that belongs to that trigger :) Now we only have to do the last part of scripting: make sure that if trigger 1 becomes active, it will delete all of the objects that belong to spawn point 2 and 3. And of course, same counts for the other triggers. (2 deletes objects for 1 and 3, 3 deletes objects for 2 and 1) For this, you can do the following: put all of the names for the objects belonging to each point in an array and attach a variable to it: objectsForOne = ["someFireplace", "aTent", "canOfBeans", "emptyMag", "someOtherCrap"]; (put the above in some script that runs as early as possible. (preferably in a script being loaded with preproccessfilelinenumbers) Do the same thing for the other points. (you can put the rest one line below the others) Then, for trigger 1, put this in it's ON ACT field: deleteVehicle objectsForTwo; deleteVehicle objectsForThree; This will keep the on act field very clean instead of putting all of the object names in the on act field :) Do the correct thing for the other triggers as well. Now you should have a solid system running like it should :) You might need to test it though. all of the above code is out of the top of my head so there might be something in there you know ;) Anyways, I hope this was clear enough to you. Good luck! Thank you for your help IT07 Share this post Link to post Share on other sites
Larrow 2823 Posted July 2, 2014 (edited) If the objects you want to spawn are always the same and in the same location relative to the spawned unit a slightly easier way maybe to use a composition. Create a composition of the items using BIS_fnc_objectsGrabber. Place your unit at one of the possible locations and group it with several markers denoting the other possible locations, this will spawn it in at a random location. Then in the units init use BIS_fnc_objectsMapper to spawn in your saved composition at the units location. Heres a quick composition to use for testing [ getPosATL this, getDir this, [ ["Box_NATO_Wps_F",[1.19312,1.625,-4.76837e-007],305,1,0.00985553,[0.000147092,-3.19202e-005],"","",true,false], ["Box_NATO_Wps_F",[-2.01184,-2.06836,-4.76837e-007],305,1,0.00980748,[0.000219573,8.48886e-006],"","",true,false], ["Land_Sleeping_bag_F",[1.88403,-1.39258,0],305,1,0,[0,0],"","",true,false], ["Land_Campfire_F",[-2.50562,1.53369,0],305,1,0,[0,0],"","",true,false] ]] call BIS_fnc_objectsMapper Just group the unit with several markers for a random spawn location and place the above in the units init. Edited July 2, 2014 by Larrow Share this post Link to post Share on other sites