Jump to content
Sign in to follow this  
strike0277

JIP confusion

Recommended Posts

I've searched to forums and am unable to find a straight forward answer as to how to implement Join in progress into my MP missions. What I would like to do is the following:

Have players beable to join in progress like in the Evo maps. where you don't have a bunch of AI bodies standing around waiting to be filled. They'll have a list of options to take as far as unit is concerned, IE Rifleman, Medic ect..ect.

If any one could please help.

Thanks

Share this post


Link to post
Share on other sites
Just add playable slots and turn off the AI.

Cool, didn't realize it was that easy. Thanks a bunch Kylania !

Share this post


Link to post
Share on other sites

How do I turn off AI? When I load my mission,I need to press "Disable AI",to remove AI from my Team.

Share this post


Link to post
Share on other sites

or go into description.ext

If you don't have any create it and drop it in the main mission root.

then edit this:

disabledAI   = true;

Share this post


Link to post
Share on other sites

:threadjacked:

To further this, does anybody know how to disable the AI while in-game? for example I have a TvT mission with some AI thrown in as extra sport... is there anyway I can call via trigger/radio to disable the AI mid-game? without the use of naming the AI.

Share this post


Link to post
Share on other sites

You can use deletevehicle to delete all (non-player) units, however I'm not sure what will happen to JIP if you decide to do that.

The best way to handle AI units that show/disappear is using disabledAI=1; in description.ext and then spawning in script and/or placing in editor non-playable AI to do with them as you wish. Having playable AI in a mission is a good way to make things hard on you as a mission maker, scripting-wise.

As for JIP compatibility, remember the game is JIP-compatible, you just need to make sure you don't write any scripts that break JIP compatibility (aka, make all scripts run the same way and with no bugs for both JIP and non-JIP, and you'll be fine).

Share this post


Link to post
Share on other sites
;1961056']:threadjacked:

To further this' date=' does anybody know how to disable the AI while in-game? for example I have a TvT mission with some AI thrown in as extra sport... is there anyway I can call via trigger/radio to disable the AI mid-game? without the use of naming the AI.[/quote']

i dont think you can disable the AI or delete them in/from playable slots in the middle of a mission/game.

you can however teleport them away and hide them from view and disable them until a player is controlling them.

asuming all units on map is playable, and all that is not a player will be "disabled":

place this in init.sqf:

disable_all_AI = false;
{
_idx = _x addMPEventHandler ["MPRespawn", {Null = (_this select 0) execVM "disableAi.sqf";}];
_null = _x execVM "disableAi.sqf";
} foreach playableUnits;

create a marker named hideaway somewhere out of the action area, here we will hide AI units.

also make a marker at the respawn area, called start, here we will move the "hidden" units to after a player is controlling them.

save this below as disableAI.sqf

waitUntil {!isNull _this};
while {alive _this} do {
waitUntil {sleep 1; !alive _this OR disable_all_AI};
if (!isPlayer _this AND alive _this) then {
	_this setPos (getMarkerPos "hideaway");
	_this setCaptive true;
	_nic = [nil, _this, "per", rHideObject, true] call RE;
	_this enableSimulation false;
	_this allowDammage false;

	waitUntil {isPlayer _this[b] OR !disable_all_AI[/b]};
	_this setPos (getMarkerPos "start");
	_this enableSimulation true;
	_nic = [nil, _this, "per", rHideObject, false] call RE;
	_this setCaptive false;
	_this allowDammage true;
};
};

now the theory is that the units that are not player will be moved to the marker, invicible, invincible, captive and freezed once you do this in a trigger or a script:

disable_all_AI = true;
publicVariable "disable_all_AI";

it will wait for the unit to be a player then move the player to a marker called start, rename marker to for example respawn_west etc if thats already in use, and change in the script.

the respawnEventhandlers will properly start the script again if unit respawns, and then the previous one will end.

edit:

you can also disable it again if its based on player count, note i added a variable check to the above disableAi.sqf( its highlighted):

disable_all_AI = false;
publicVariable "disable_all_AI";

anywho, its untested and theory.

Edited by Demonized
edit:

Share this post


Link to post
Share on other sites

The AI in question that I want to have the ability to delete whenever needed are set to non-playable so there wont be a player joining them issue, with the above way would I also be able to call it via trigger, say if the AI are too much for the opposing players I can delete them via radio.

Just a little information about the mission itself, it has no respawn, one life only played in mercenary, and there are 6 players on each side WEST/EAST with about 35 non-playable AI on both sides.

Regardless of the above thanks for taking the time to create a script :)

Share this post


Link to post
Share on other sites

If mission has no respawn, then deleting (or at least killing) the playable AI units will make it impossible to join into them from that point on.

Share this post


Link to post
Share on other sites

The playable AI will only ever be played by players, the 6 vs 6, if the full amount of players are not around then there player will be disabled before the mission is started ;)

Share this post


Link to post
Share on other sites
;1961256']The AI in question that I want to have the ability to delete whenever needed are set to non-playable so there wont be a player joining them issue' date=' with the above way would I also be able to call it via trigger, say if the AI are too much for the opposing players I can delete them via radio.

[i']Just a little information about the mission itself, it has no respawn, one life only played in mercenary, and there are 6 players on each side WEST/EAST with about 35 non-playable AI on both sides.[/i]

Regardless of the above thanks for taking the time to create a script :)

:) for the deletion of non playable AI, simply use deleteVehicle as posted above by galzohar.

place this in a trigger condition:

({isPlayer _x} count playableUnits) >= 5

and this in on act:

{if (isServer AND !isPlayer _x) then {deleteVehicle _x}} foreach allUnits;

now once there is 5 players or more all the AI willl be deleted.

adjust 5 to be whatever appropriate.

alternatively use a variable as in my previous post and use that as condition instead.

Share this post


Link to post
Share on other sites

One thing to keep in mind, though, is that if you have disabledAI=1 AND respawn=BIRD, then anyone JIPing will become a bird (and start spectator script if you use ACE).

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
Sign in to follow this  

×