The Zeus Editing Wisdom & Knowledge Base

Post Reply
StRiKeR
Posts: 293
Joined: Sun Jan 17, 2016 5:10 pm
Contact:

The Zeus Editing Wisdom & Knowledge Base

Post by StRiKeR »

Hey everyone,

As an idea from the last DEV meeting I am opening up this thread. It shall serve us as a place to dump and accumulate all kinds of cool tips and tricks for editing missions, be it in the shape of code snippets, whole scripts, cool commands or even neat functions in the editor or Arma in general you have discovered. The purpose is to allow people to browse this place to come up with ideas and inspiration for their own missions or find help for their own editing problems, especially when they are not as familiar with scripting their own solutions. The goal is to come up with a myriad of posts that point at "How to achieve XYZ".

Please make sure your solutions are as self-contained and condensed as possible, i.e. try not to post something like "Using framework X and addon Y together you can achieve Z. Rather try to cut things out and make them able to stand alone if possible.

Please post only one item of knowledge per post, so I can review this thread regularly and add it to the list in the first post for people to easily see. For that purpose it might be good to give your post/item a title.

Please provide atleast basic documentation somewhere for your items, especially with more complex solutions.

For posting code please use the Forum's method of code display. Posting links to files outside is fine too if you can make sure they stay available.

Feel free to discuss and ask about posts and items too. The table of contents I will update should keep the information always in reach.




TABLE OF CONTENTS

[EDEN] Randomised object placement with markers
[SNIPPETS] Event-based respawn
[SCRIPT] Stalking vehicle QRF
[SCRIPT] Vehicle Selection in-game via ACE interaction (Server 2 only)
Cobra.
Posts: 343
Joined: Fri Oct 28, 2016 11:31 am
Location: Sagittarius A*
Contact:

Re: The Zeus Editing Wisdom & Knowledge Base

Post by Cobra. »

Semi-Randomised Spawns.
A simple thing that I didn't even notice till I was working on an EnE mission is that if you If you sync a unit to 2 or more markers using the set random start It will force the unit to spawn at either marker, then you can set the alpha of the market to zero to have it invisible. It's a simple and easy way to have semi-randomised spawning.
[3:33 PM] BOTMEE6: Hey @Cobra! Please don't use bad words!
[3:33 PM] BOTMEE6: Hey, sorry about this but... you got banned from Zeus by MEE6#4876 for 'Too many infractions..'

please do not swear on my christian youth server.
StRiKeR
Posts: 293
Joined: Sun Jan 17, 2016 5:10 pm
Contact:

Event-based respawn

Post by StRiKeR »

Thanks to Dmitry for thinking this up and helping to debug it.

This is set up for the long respawn time/ base respawn method described in the mission making guide by Ben.

If you want to include a more immersive way to include a respawn in your mission, let's say after you have freed POWs or cleared the path for a reinforcement wave to reach you or whatever, here we go. This should be good for very long missions that are otherwise extremely punishing when you die early on in them. It also gives you the option to have the players work for their own reinforcements.

Example for Server #2 (for Server #1 simply remove the ACRE crap from onPlayerKilled.sqf and onPlayerRespawn.sqf):

onPlayerKilled.sqf

Code: Select all

// These parameters for the spectator camera will allow you to only view players of side WEST, will turn the free camera off and will not allow you to view AI
["Initialize", [player, [west], false, false, true, true, true, true, true, true]] call BIS_fnc_EGSpectator;
// Tell ACRE we are now spectating
_handle = [true] call acre_api_fnc_setSpectator;

onPlayerRespawn.sqf

Code: Select all

//Kill the spectator camera
["Terminate"] call BIS_fnc_EGSpectator;
// Tell ACRE we are no longer specating and back in as a player
_handle = [false] call acre_api_fnc_setSpectator;
// Move the player to the respawn marker, this should have technically already been done by Arma's respawn system, but due to a potential delay in how Arma preloads your respawn position the respawn system will otherwise not notice the marker position changing in time.
player setPos (getMarkerPos "respawn_west");

//Any script that you want to use to mess with your respawned players, for example give them different gear
_null = [] execVM "gearforreinforcements.sqf";

Have a Trigger, either with condition this or any other variable you want. This will be the trigger that checks for the event that will cause a respawn for everyone dead up to that point to happen. The position of the trigger will be the position where the players will respawn. You can have as many triggers that facilitate a respawn as you want. Set the trigger to Server Only.

In On Activation put (Do not forget to change the name of the marker if your side is EAST or other)

Code: Select all

"respawn_west" setMarkerPos (getPos thisTrigger);  
[] spawn  
{  
   sleep 2; 1 remoteExec ["setPlayerRespawnTime", ([0,-2] select isDedicated), false];  
    sleep 10;  
    999999 remoteExec ["setPlayerRespawnTime", ([0,-2] select isDedicated), false];
};

In your description.ext add this to your respawn "block", this way the code of onPlayerRespawn.sqf will not be run at mission start

Code: Select all

respawnOnStart = -1;//Dont respawn on start. Don't run respawn script on start.
Also in your description.ext, add setPlayerRespawnTime as a remoteExec exception. This command is whitelisted by default but this way you are safe if BattlEye or someone else ever change their mind.

Code: Select all

class CfgRemoteExec
{         
	// List of script commands allowed to be sent from client via remoteExec
	class Commands
	{
		/*your commands here*/
		class setPlayerRespawnTime { allowedTargets=0; jip=0; } // can target anyone, sending jip is turned off (overrides settings in the Commands class)
	};
};

As with anything, test this on a dedicated server with another person and see if you made it work.


As this is bound to change the dynamic for some missions, I suggest you define some rules in your briefing as to how the respawned players may impact the gameplay.
Questions to consider:
1. Will respawned players have their same roles or no?
Example 1: Bravo SL is in charge after CO died. Former CO respawns as CO. Who is in charge?
Example 2: Bravo SL is in charge after CO died. Former CO respawns as a civvie with an AK. Who is in charge?
2. Are respawned players allowed to communicate any information gathered from the spectator camera?
3. How is leadership organized for respawned players, especially if you reshuffle the roles after a respawn?
Spud
Posts: 89
Joined: Sun Apr 17, 2016 7:46 pm
Contact:

Re: The Zeus Editing Wisdom & Knowledge Base

Post by Spud »

This is a pretty neat vehicle QRF script that Dmitry helped me write.
Pretty much allows you to spawn a number of vehicles at a chosen marker and then stalk a player group

This is the script

Code: Select all

params ["_spawnMarker","_targetMarker",["_size", 3]];

_vehicles = ["X","Y","Z"];

_group = (createGroup WEST);
for "_i" from 1 to _size do
{
    _class = (selectRandom _vehicles);
    _veh = _class createVehicle (getMarkerPos _spawnMarker);
    createVehicleCrew _veh;
	{
        _x setSkill 0.8;
		_x setBehaviour "COMBAT"; 
    } forEach (crew _veh);
    (crew _veh) join _group;
};

_playerGroup = selectRandom ([GrpOPF_CO,GrpOPF_ENG,GrpOPF_H,GrpOPF_A1,GrpOPF_A2,GrpOPF_A3,GrpOPF_B1,GrpOPF_B2,GrpOPF_B3,GrpOPF_C1,GrpOPF_C2,GrpOPF_C3] select {!(isNull _x) && {(count units _x) > 0}});

[_group, _playerGroup, 10, 50, {false}, 1] spawn bis_fnc_stalk;
- Where X,Y,Z are the vehicle class names
- WEST can be changed for the side that you can the AI to be on
- The 2nd to last line, _playerGroup = selectRandom... etc. The following array is the player group names that you want the AI group to stalk, it will choose a random group to stalk from your chosen groups
- The last line is making the QRF stalk the random player group where in the example 10 is the time between waypoints being refreshed and 50 is the placement radius of the waypoint.


This is how you call it, place the following line into the activation line of a trigger

Code: Select all

["My_Marker_Name","Target",X] execVM "MyScript.sqf";
Where "My_Marker_Name" is the name of the marker you want the vehicles to spawn at
"Target" is a marker name that can be placed anywhere on the map, position has no effect
X = Number of vehicles that you want to be spawned
Spud
Posts: 89
Joined: Sun Apr 17, 2016 7:46 pm
Contact:

Re: The Zeus Editing Wisdom & Knowledge Base

Post by Spud »

Vehicle Selection in-game via ace interaction (Server 2 only)

In some of my missions I have added an option for vehicle pilots or ground crews to have the option to choose their vehicle in-game on the fly.
This is very rough and can probably be more efficient, better etc. Feel free to do so if you wish and update this post.

------------------------------------------------------------------------------------------------------------------------------------------------------

To start make a place where you want the vehicle to spawn. A helipad etc. and an object to interact with, e.g. a laptop.

Make the ACE interaction. Should be something like this. The Terms will be explained below.

Code: Select all

_action = ['A','A','\A3\ui_f\data\igui\cfg\simpleTasks\types\B_ca.paa',{_handle = remoteExec ["C", 2];},{ ((_target distance D) < 150) }] call ace_interact_menu_fnc_createAction;
[this, 0, [""ACE_MainActions""], _action] call ace_interact_menu_fnc_addActionToObject;
A)

Code: Select all

_action = ['A','A',
Replace the A with what you want the text you want the interaction to have

B)

Code: Select all

'\A3\ui_f\data\igui\cfg\simpleTasks\types\B_ca.paa'
The B at the end is the image that you want the interaction to have.
You can find these name for images if you look in the 'create task' module and hover over the images in the drop down.

C)

Code: Select all

_handle = remoteExec ["C", 2]
I will touch on this later but in short it is a function name defined in the init. Don't worry about this yet.

D)

Code: Select all

((_target distance D) < 150)
An object with the variable name 'D' placed somewhere near the interaction point
150 is the distance in meters that the interaction will work from the object D

--------------------------------------------------------------------------------------------------------------------------------------------------

Next make a folder for the create vehicle SQF's. I called it 'vS' in this Case.

Inside the folder Make a SQF file and call it anything you like (Avoid using full stops in the name)
This is the file that will create the vehicle and any extras you want to add to the vehicle itself.
Place an object on the map and name it 'Pad1'. In this case I used a snowman because reasons.

Code: Select all

deleteVehicle Pad1;
sleep 0.5;
_obj = "snowman" createVehicle [X,Y,Z];
_obj setVehicleVarName "Pad1";
Pad1 = _obj;
sleep 0.5;

_veh = "E" createVehicle [X,Y,Z];
_veh setVehicleLock "UNLOCKED";

Code: Select all

_obj = "snowman" createVehicle [X,Y,Z];
Where [X,Y,Z] is the position of the object

Code: Select all

_veh = "E" createVehicle [X,Y,Z];
Where 'E' is the vehicle class name and [X,Y,Z] is the position that you want the vehicle to be created.

As an extra you can add custom pylons with the following

Code: Select all

_veh setPylonLoadOut ["pylon1", "F"]; 
_veh setPylonLoadOut ["pylon2", "G"];
Where 'F' and 'G' are the class name of the weapon you wish to add.

----------------------------------------------------------------------------------------------------------------------------------

Next, in your init.sqf place the following

Code: Select all

if isServer then {
	SomeFunction = compile loadFile "vS\SpawnVehicle.sqf";
};
Where 'SomeFunction' is the same 'C' From the first section and 'SpawnVehicle.sqf' is the name of the sqf file that the vehicle creation is done in.

-------------------------------------------------------------------------------------------------------------------------------------

Finally place a trigger at the spawn location of the vehicle, server only, repeatable, with condition

Code: Select all

!alive Pad1;
and activation

Code: Select all

{deleteVehicle _x} forEach nearestObjects [thisTrigger, ["E"], 10];
Where 'E' is the vehicle class name and 10 is the radius around the trigger to delete the vehicle

-----------------------------------------------------------------------------------------------------------------------------------

Special Thanks to: Smolof, Dmitry, Striker

Any questions give me a poke on teamspeak
Tom
Posts: 477
Joined: Sun Jan 17, 2016 9:14 pm
Contact:

Re: The Zeus Editing Wisdom & Knowledge Base

Post by Tom »

Cobra. wrote: Tue Sep 05, 2017 4:48 pm Semi-Randomised Spawns.
A simple thing that I didn't even notice till I was working on an EnE mission is that if you If you sync a unit to 2 or more markers using the set random start It will force the unit to spawn at either marker, then you can set the alpha of the market to zero to have it invisible. It's a simple and easy way to have semi-randomised spawning.
Does this work?
When i check the ai position, the groups are split over all the markers available...
Result: they start vacating the position to reach the squad leader.
StRiKeR
Posts: 293
Joined: Sun Jan 17, 2016 5:10 pm
Contact:

Re: The Zeus Editing Wisdom & Knowledge Base

Post by StRiKeR »

Tom wrote: Fri May 11, 2018 7:53 am
Cobra. wrote: Tue Sep 05, 2017 4:48 pm Semi-Randomised Spawns.
A simple thing that I didn't even notice till I was working on an EnE mission is that if you If you sync a unit to 2 or more markers using the set random start It will force the unit to spawn at either marker, then you can set the alpha of the market to zero to have it invisible. It's a simple and easy way to have semi-randomised spawning.
Does this work?
When i check the ai position, the groups are split over all the markers available...
Result: they start vacating the position to reach the squad leader.
This does work. However you have to consider that grouped AI will always attempt to fall back into formation around their squadleader. If they find themselves away from him, they will move towards him. Either you have to ungroup them or make them forget how to walk by using disableAI "PATH".

It used to be easier in the 2D Editor where you could just set the group to "In Formation" and only link the group leader to the markers, then the entire squad would be neatly spawned randomized as one. Not sure if you can still do that as neatly with Eden.
Tom
Posts: 477
Joined: Sun Jan 17, 2016 9:14 pm
Contact:

Re: The Zeus Editing Wisdom & Knowledge Base

Post by Tom »

You used to be able to sync markers... that’s a feature I’m really really missing now.

What I need:
An enemy group, let’s say 2 squads in upsmon.
The upsmon marker to be moved to a “random” town or hot spot

So that each time we launch the mission we attack a different place.

It used to work with empty markers and then moving the marker to one of those maybe 20 empty markers. But I can’t sync the markers to the upsmon marker.



Moving a group using the random start function just moves each member of that group to one of the random starting locations. So it works, just doesn’t do what I want ;)
Spud
Posts: 89
Joined: Sun Apr 17, 2016 7:46 pm
Contact:

Re: The Zeus Editing Wisdom & Knowledge Base

Post by Spud »

can use the setMarkerPos command to set the position of the marker and use a random array to get the positions of possible locations.

Code: Select all

_pos1 = getMarkerPos "Marker_1";
_pos2 = getMarkerPos "Marker_2";
_pos2 = getMarkerPos "Marker_3";

_Pos = (selectRandom [_pos1,_Pos2,_Pos3]);

"MyMarker" setMarkerPos _Pos;
Drew this up, haven't tested it but it should work fine

We have a discord setup which is perfect for this kind of question
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests