Jump to content
kalthramis

Manipulate preplaced objects?

Recommended Posts

Is it possible to manipulate objects placed by hand in the editor, but in-game as Zeus? I primarily want to know for the virtual ammo box system. So if I placed an ammo box in the editor, could I move it around as Zeus?

Thanks!

Edited by Kalthramis

Share this post


Link to post
Share on other sites

How do I 'sync' it, and how do I do that properly?

Edit: Went and tried to figure it out since you mentioned it, and I got it! Thanks a ton! :)

Edited by Kalthramis

Share this post


Link to post
Share on other sites

Ok, so two and a half hours later of testing I figured it out.

Place an "Add Editable Object" module and then sync it with the Zeus Game Master and any editor-placed object. Double click the "Add Editable Object" and in the Zeus box, add the name of the Zeus that will be controlling it. For me my Zeus is called bis_curator.

Now you can use the Ammo box with VAS included. Plus any other item that you want to add a script to.

Share this post


Link to post
Share on other sites

If you plan to add many units i suggest the use of a trigger. At Trigger Activation choose Anybody or only one side. Past in n the "In Act. Box"

{zeus addCuratorEditableObjects [[_x],true]} forEach thislist

Zeus is the name of the Mastermodul. You can create one big trigger for all units or create several small triggers.

Share this post


Link to post
Share on other sites
....Info here......

Now you can use the Ammo box with VAS included.

Thanks for the info, I found is you are playing as Zeus you probably should not use the Virtual ammobox as it will create a unit of you - although invincible by all accounts.

VAS by default acts to change the player uniform, Zeus acts exactly like the name says - remote control (I have seen the command to disconnect from UAV in the scroll wheel) - so using VAS on a remote unit will change uniform on the player's unit. I have seen mention of a script to change VAS to act on AI units, it will work in this case, but then why would you remote control a guy and need to change weapons?

Share this post


Link to post
Share on other sites
Thanks for the info, I found is you are playing as Zeus you probably should not use the Virtual ammobox as it will create a unit of you - although invincible by all accounts.

VAS by default acts to change the player uniform, Zeus acts exactly like the name says - remote control (I have seen the command to disconnect from UAV in the scroll wheel) - so using VAS on a remote unit will change uniform on the player's unit. I have seen mention of a script to change VAS to act on AI units, it will work in this case, but then why would you remote control a guy and need to change weapons?

Since VAS saves the loadout to your player profile (.Arma3Profile) and since Zeus is a vitual entity with no body, you can't use VAS as Zeus. That being said, you can still scroll wheel to access the box but you can't edit your inventory from it. For that you'd need to place the items yourself or a normal box.

I've played a few missions that has required the Zeus's RC unit to have to change weapons for the sake of immersion and some roleplay.

Share this post


Link to post
Share on other sites
If you plan to add many units i suggest the use of a trigger. At Trigger Activation choose Anybody or only one side. Past in n the "In Act. Box"
{zeus addCuratorEditableObjects [[_x],true]} forEach thislist

Zeus is the name of the Mastermodul. You can create one big trigger for all units or create several small triggers.

Thanks! This is much easier than linking every unit to the curator. However, this seems not to work in "Preview" in the Editor. Do you know why?

Share this post


Link to post
Share on other sites
Thanks! This is much easier than linking every unit to the curator. However, this seems not to work in "Preview" in the Editor. Do you know why?

I have this in my init.sqf

//-------------------------------------------View-Units---------------------------------------------------------------------

while {true} do {

{

if (side _x == west) then

{

Curator addCuratorEditableObjects [[_x],true];

CuratorModerator addCuratorEditableObjects [[_x],true];

};

if (side _x == east) then

{

Curator addCuratorEditableObjects [[_x],true];

CuratorModerator addCuratorEditableObjects [[_x],true];

};

if (side _x == independent) then

{

Curator addCuratorEditableObjects [[_x],true];

CuratorModerator addCuratorEditableObjects [[_x],true];

};

if (side _x == civilian) then

{

Curator addCuratorEditableObjects [[_x],true];

CuratorModerator addCuratorEditableObjects [[_x],true];

};

}foreach allUnits;

};

I have 2 Zeus's, Curator and CuratorModerator.

Share this post


Link to post
Share on other sites

That's a great idea, definitely using this, much easier than having them all linked up to addeditableobject modules.

Although is the while {true} loop necessary?

Wouldn't that just keep it running forever?

Seems to work just as well if you take that out and just have the foreach loop, but I might be missing something.

Share this post


Link to post
Share on other sites

I initially had to use this to allow my "CuratorModerator" to see and edit objects placed by "Curator" as it didn't work at that time. I haven't had any issues with it since then, so I've just left it as is.

Share this post


Link to post
Share on other sites
Thanks! This is much easier than linking every unit to the curator. However, this seems not to work in "Preview" in the Editor. Do you know why?

This doesn`t work in my mission. The name of the gamemaster module is "bis_curator". I`ve added the trigger with activation "anybody" and past in the activation box:

{bis_curator addCuratorEditableObjects [[_x],true]} forEach thislist

Trying this mission in preview mode or on hosted multiplayer doesn`t work. I`ve tried to sync the trigger with my gamemaster module (or not), without success.

Did i missed something?

Share this post


Link to post
Share on other sites
This doesn`t work in my mission. The name of the gamemaster module is "bis_curator". I`ve added the trigger with activation "anybody" and past in the activation box:

{bis_curator addCuratorEditableObjects [[_x],true]} forEach thislist

Trying this mission in preview mode or on hosted multiplayer doesn`t work. I`ve tried to sync the trigger with my gamemaster module (or not), without success.

Did i missed something?

Think you need to use the name of the player that is controlling your Zeus Game Master Module

Share this post


Link to post
Share on other sites

How would one force any AI created by scripts (EoS/CoS, AI Spawn Script Pack, etc) to be controllable by Zeus since they are generally not in mission at start for you to synch with the module.

I'm guessing you might be able to add something into the script, but then if the Zeus slot is not being controlled, would it screw up anything?

Share this post


Link to post
Share on other sites
How would one force any AI created by scripts (EoS/CoS, AI Spawn Script Pack, etc) to be controllable by Zeus since they are generally not in mission at start for you to synch with the module.

I'm guessing you might be able to add something into the script, but then if the Zeus slot is not being controlled, would it screw up anything?

See my post above.

"while {true} do" makes it loop and adds any unit that isn't synced to Zeus.

Share this post


Link to post
Share on other sites

I've written up a script that I call in the init field of the Zeus Virtual Entity that will allow all pre-placed objects in a mission as well as any script spawned AI to be controlled by Zeus, but I've run into a problem. For some reason when the script is running, if the Zeus player brings up the map, their A3 client crashes. The script seems to work correctly otherwise, but does anyone have any idea why this script would cause a crash on map open?

{zCurator addCuratorEditableObjects [[_x],true]} foreach (allMissionObjects "");

{zCurator addCuratorEditableObjects [[_x],true]} foreach allMapMarkers;

{zCurator addCuratorEditableObjects [[_x],true]} foreach allGroups;

while {true} do {

sleep 10;

{ 
if (side _x == west) then 
{ 
zCurator addCuratorEditableObjects [[_x],true];
}; 

if (side _x == east) then 
{ 
zCurator addCuratorEditableObjects [[_x],true];
}; 

if (side _x == independent) then 
{ 
zCurator addCuratorEditableObjects [[_x],true];
};

if (side _x == civilian) then 
{ 
zCurator addCuratorEditableObjects [[_x],true];
};

}foreach allUnits;

};

Note: zCurator is the name of my Game Master module.

Edited by MBCB

Share this post


Link to post
Share on other sites

I'm willing to bet it has something to do with the

"{zCurator addCuratorEditableObjects [[_x],true]} foreach allMapMarkers;"
Have you tried it without this line? Does it still crash?

Share this post


Link to post
Share on other sites

No, after a bit of testing, it's definitely being caused by the first item that adds everything already on the map into curator control.

{zCurator addCuratorEditableObjects [[_x],true]} foreach (allMissionObjects "");

Also, the crash will not occur if I run a Preview on my local machine. But if I run the mission on a Dedicated server, take the Zeus slot and then open the map, it crashes at that point.

Now I just need to figure out why it's doing it, and how to get around it.

Edited by MBCB

Share this post


Link to post
Share on other sites

I've sorta figured it out. Instead of adding allMissionObjects, I just add all vehicles and allUnits at the start and that pretty much gives me what I want. Here's the current script I'm calling from the Zeus Virtual Entity Init.

if (!isServer) exitWith{};

{zCurator addCuratorEditableObjects [[_x],true]} foreach vehicles;

{zCurator addCuratorEditableObjects [[_x],true]} foreach (allMissionObjects "Man");

while {true} do {

sleep 30;

{ 
if (side _x == west) then 
{ 
zCurator addCuratorEditableObjects [[_x],true];
}; 

if (side _x == east) then 
{ 
zCurator addCuratorEditableObjects [[_x],true];
}; 

if (side _x == independent) then 
{ 
zCurator addCuratorEditableObjects [[_x],true];
};

if (side _x == civilian) then 
{ 
zCurator addCuratorEditableObjects [[_x],true];
};

}foreach allUnits;

};

Share this post


Link to post
Share on other sites

Worked like a charm MBCB. And thx for everyone else input.

Share this post


Link to post
Share on other sites

An old thread, I know, so my apologies for that.

Just wanted to state that you can't put a sleep in a while loop, as it will give errors in your .rpt files. What I did to solve that is this:

if (!isServer) exitWith{};

{zCurator addCuratorEditableObjects [[_x],true]} foreach vehicles;

{zCurator addCuratorEditableObjects [[_x],true]} foreach (allMissionObjects "Man");

delayTimer = time;
delay = 30;
if ( (time - delayTimer ) > delay) then 
{
while {true} do {

{ 
   if (side _x == west) then 
   { 
   zCurator addCuratorEditableObjects [[_x],true];
   }; 

   if (side _x == east) then 
   { 
   zCurator addCuratorEditableObjects [[_x],true];
   }; 

   if (side _x == independent) then 
   { 
   zCurator addCuratorEditableObjects [[_x],true];
   };

   if (side _x == civilian) then 
   { 
   zCurator addCuratorEditableObjects [[_x],true];
   };

   }foreach allUnits;

   delayTimer = time;
};

Be sure to add the following to your init.sqf

delay = 0;
delayTimer = 0;

I am by no means a scripter, so any comments / improvements are welcome.

Share this post


Link to post
Share on other sites
Just wanted to state that you can't put a sleep in a while loop, as it will give errors in your .rpt files. What I did to solve that is this:

Only reason a sleep wouldn't work in a loop is because it's needs to be put into a scheduled environment (via the spawn command):

if (!isServer) exitWith{};

{zCurator addCuratorEditableObjects [[_x],true]} foreach vehicles;

{zCurator addCuratorEditableObjects [[_x],true]} foreach (allMissionObjects "Man");

0 = [] spawn
{
while {true} do 
{
	sleep 30;

	{ 
		if (side _x == west) then 
		{ 
			zCurator addCuratorEditableObjects [[_x],true];
		}; 

		if (side _x == east) then 
		{ 
			zCurator addCuratorEditableObjects [[_x],true];
		}; 

		if (side _x == independent) then 
		{ 
			zCurator addCuratorEditableObjects [[_x],true];
		};

		if (side _x == civilian) then 
		{ 
			zCurator addCuratorEditableObjects [[_x],true];
		};

	} foreach allUnits;
};  
};

If that still doesn't seem to solve it, post the errors please :).

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

×