Jump to content


  • Content Count

  • Joined

  • Last visited

  • Medals

Posts posted by meatball

  1. Does anyone know of a way to allow players to get into ammo crates and such if they are set as enemies to Civilians?

    For example, NATO player can get into NATO crates without a problem, but as soon as you do:

    west setfriend [civilian,0];

    NATO players can no longer get into NATO crates...

  2. Ah, excellent. Followup question then, part of the function will check the distance and depending on the distance, the target will attempt to run away. Setting up waypoints to a point in a direction away from the player isn't too hard, but I'm limited to Limited, Normal and Full speeds (seems to be no real difference between normal/full to me). I would like the target to try to sprint away as well, but I can't figure out how to coordinate a move command with the sprint animation (Animation "AmovPercMevaSnonWnonDf").

    Any idea how I can force the unit to actually sprint from point A to point B?

  3. I'm working on a function I can repeatedly call that can check to see which player is the closest to a target. Here's what I have so far and haven't been able to get it working:

    mb_fnc_findNearest = {
    private ["_target","_nearestUnit"];
    _target = _this select 0;
    _nearestUnitTemp = playableunits call BIS_fnc_selectRandom;
    _nearestUnitDist = _nearestUnitTemp distance _target;
    {if (_target distance _x < _nearestUnitDist) then {_nearestUnit = _x;_nearestUnitDist = _target distance _x};
    } foreach playableunits;

    Anyone have any idea what I'm screwing up here? This function will run pretty often, so any ideas where it can be more efficient would be appreciated as well. Thanks in advance!

  4. I really like the idea you have of using a function to set waypoint and then recalling that function to set the next one when the units reach the first waypoint. Definitely seems like it'll ease up on resources needed for the AI as opposed to some sort of loop. Doesn't fully help me though since I need the AI to act individually and not as a single group and I'll probably have over the 144 limit. Not sure why they haven't changed it, but I can kinda see why since if you have 2-3 per group with 144 groups you can pretty quickly overload a machine.

  5. So, here's the basics of what I'm looking to do. I want to have individual civilian faction AI act randomly, moving about, doing idle animation, etc. in a mission. It is a MP mission, so there may be a _lot_ of AI scattered across the server. This is a MP mission where the players will likely be scattered. Even with AI spawning/caching, there's likely to be a lot of civilians moving around and spawned at the same time. I've tried a bunch of different things, but have run into some challenges:

    1) If I spawn multiple AI into one group, there doesn't appear to be any way to force them to behave / move individually. Even if I command them separately, they'll always return into some sort of formation. I also can't assign each AI to it's own group, because with the 144 limit of groups/side, I run out of groups when AI is being spawned all around.

    2) I can't seem to figure out a way to make 'playMove' and 'doMove' work well together. I'd like random animations so somethings the unit is walking, sometimes running, etc, but the doMove seems to just force the unit into a default 'walk' move.

    3) setDir does not do a smooth turning animation/transition, it just slaps the unit the direction. If I'd like the unit to occasionally switch to a random direction, is there any way to make that a smooth turn?

    Anyone have any thoughts on any of these?

    To put it all in perspective, let's just say hypothetically, I want a big city to have 150+ AI, all moving about individually, doing different animations including walking, running, standing idle, etc. What would be a good way to handle that?

  6. Ah, perfect. I dug around the functions and finally came up with the following function that you can call:

    [0,1,2] call bis_fnc_setppeffecttemplate;

    Where the Parameters are:

    0: STRING - template class [Options: "NONE", "EastWind","RealisBrown","BlackandWhite","Mediterranean"]

    1 (Optional): NUMBER - commit time in seconds (default: 0)

    2 (Optional): BOOL - true for global execution (default: true)

    Thanks for pointing me in the right direction!

    Edit: Not sure why it's putting a space in "Mediterranean" up above, but there shouldn't be one, it's all one word.

  7. Hmm, that doesn't work either. It did change it so the score incremented positively when a Civilian was taken out, but then all the Civilians start attacking each other as well.

    It did lead me to setFriend, which also worked partially. Once again, if I did something like "WEST setFriend [CIVILIAN,0];" the score incremented positively when you shoot the civilian AI units, but...you no longer can get into NATO crates for some reason.

  8. Anyone know if there's any simple way to completely disable all keyboard/mouse input from the player other than basic Forward, Back, Left, Right Movement and mouselooks. Don't want the player to be able to open up any interfaces like maps, GPS, diary, inventory, or have any access to addactions to pick things up, etc. Additionally, I'd like to be able to bring the control all back when needed.

    Anyone have a simple script that can handle that?

  9. I dug through the thread and did some searching, but didn't find what I was looking for. Basically I'm just looking to tweak the skin tone of some AI models. I don't even mind if all the AI have the same face/skin, I just want to change the skin color. There a simple way to do that without using an addon and just through script? I _think_ I can setObjectTexture on the unit when it's spawned, but I'm not sure where to find the skin textures in the first place and how to configure the mission to use them.

    Any help would be mucho appreciato. :)

  10. Hey Bob/all - QQ. I basically want to create a custom faction that will consist of foot units from all of the factions. I know I can add all the unit class names into factions 5, 6 or 7's _InfPool array in UnitPools.sqf and then reference that custom faction for the faction variable in the EOS call, but how do I handle the "UNIT SIDE" variable in the call?

    I'm pretty sure if I use a UNIT SIDE that doesn't match one of the models, it'll break the call. I don't care if the units spawn without any gear, I just want to use a single EOS call to pull from one of the custom infantry pools that contain class names from across multiple factions.

  11. Here's what I threw together so far, but it still needs a ton of work. The animations don't seem to be working right and I can't seem to get the zombie to actually start sprinting when within the chase distance. I still need to figure out adding sounds and changing the zombie skin tone. If anyone has any suggestions/thoughts or any of those or any way to make the script better, let me know.

    // Zombie Init v 0.1 - By Meatball
    // Save file in root mission folder as 'zombieInit.sqf'
    // Call Script in AI Unit's Init field with the following:
    //    nul = [this] execVM "zombieInit.sqf";
    _zombieName = _this select 0;
    _viewDistance = 100; // Distance at which the zombie will do various animations, but not notice the player.
    _investigateDistance = 50; // Distance at which a zombie will start investigating/closing on player
    _chaseDistance = 25;  // Distance at which a zombie will start chasing the player.
    _attackDistance = 2;  // Distance at which a zombie will 'attack' player
    _attackDamage = 0.15;  // Damage done every time a zombie hits player.
    _zombieName setdamage 0.9;
    while {(alive _zombieName)} do
     // Find closest player out of all playableUnits
    	_closestPlayer = playableUnits call BIS_fnc_selectRandom;
    	_closestDistance = _zombieName distance _closestPlayer;
    	{_distCheck = _zombieName distance _x;
    	 if (_distCheck < _closestDistance)
    		then {_closestPlayer = _x;
    			  _closestDistance = _distCheck;
    			  } foreach playableUnits;
    hint "1";
    // Zombie is in 'view' distance.  Will do random animations and walk around randomly. but does not see player
    while {((_zombieName distance _closestPlayer) <= _viewDistance) && ((_zombieName distance _closestPlayer) > _investigateDistance)} do {
    		_randomMove = floor (random 3);
    		switch (_randomMove) do {
    			case 0: {_zombieName playaction "C7A_longWalk";_randPlayer = playableUnits call BIS_fnc_selectRandom;_zombieName domove (position _randPlayer);};
    			case 1: {_zombieName playaction "AmovPercMstpSnonWnonDnon_Scared";};
    			case 2: {_zombieName playaction "AidlPercMstpSnonWnonDnon_G03";};
    		hint "2";
    		sleep 5;
     // 'Randomly' towards the closest Player if within _investigateDistance
     while {((_zombieName distance _closestPlayer) <= _investigateDistance) && ((_zombieName distance _closestPlayer) > _chaseDistance)} do {
    		_randomMove = floor (random 3);
    		switch (_randomMove) do {
    			case 0: {_zombieName playaction "C7A_longWalk";_zombieName domove (position _closestPlayer);};
    			case 1: {_zombieName playaction "AmovPercMstpSnonWnonDnon_Scared2";};
    			case 2: {_zombieName playaction "AmovPercMstpSnonWnonDnon_AinPercMstpSnonWnonDnon";};
    		hint "3";
    		// Add random zombie sound
    		sleep 2;
    // Run towards the closest Player if within _chaseDistance
    while {((_zombieName distance _closestPlayer) <= _chaseDistance) && ((_zombieName distance _closestPlayer) > _attackDistance)} do {
    		_randomMove = floor (random 3);
    		switch (_randomMove) do {
    			case 0: {_zombieName playaction "SprintCivilBaseDF";_zombieName domove (position _closestPlayer);};
    			case 1: {_zombieName playaction "SprintCivilBaseDFl";_zombieName domove (position _closestPlayer);};
    			case 2: {_zombieName playaction "SprintCivilBaseDFr";_zombieName domove (position _closestPlayer);};
    		hint "4";
    		// Add random zombie sound
    		sleep 1;
    // Attack player if within _attackDistance
    while {((_zombieName distance _closestPlayer) <= _attackDistance)} do {
    		_turnDir = [_zombieName,_closestPlayer] call BIS_fnc_dirTo;
    		_zombieName setdir _turnDir;
    		_zombieName playmove "AmovPercMstpSnonWnonDnon_AinvPercMstpSnonWnonDnon_Putdown";
    		// Add attack sound(s)
    		hint "5";
    		sleep 0.5;
    		_closestPlayer setdamage ((damage _closestPlayer) + _attackDamage);
    		sleep 0.5;
    sleep 1;

  12. I almost hate to ask this, because I feel like zombie related stuff is getting old hat, but I've been monkeying around with a mission idea that requires some sort of unarmed menace that will chase the players around and Zombies are just the easiest to deal with from the perspective of creating all new models/animations and such.

    I've looked at the few scripts that are out there and would like something a bit cleaner/more robust. I also don't want to use any types of addons or mods, and want the whole thing to be completely script based. Could someone let me know if doing any of the following is feasible through script?

    1) Be completely script based, no addons/mods required.

    2) Be multiplayer compatible, so anyone in the playableUnits array that is in range of one of these units will set it off to go after them.

    3) Change the skin tone of the infected units to grey or something that looks off.

    4) Have the units wander aimlessly until a player gets within range, then the unit may move to investigate, and if the player gets closer, it will start to chase them.

    5) When the unit gets up close and personal, hit the player and do damage.

    I've got a real basic script I've started working up, but it's just not looking right, and I'm not even sure some of these things can be done completely through script. Plus I'm thinking a behavior type script running for every 'zombie' unit out there will just kill server/host FPS/resources.

    Before I put a ton of time into this, I was just wondering if anyone had any thoughts or ideas...

  13. Hey Banga, I'm really liking this script, but it really puts a hurting on the server when it runs. I'd like have random loot for a MP misison on all of Altis, but when I start it up, it just chokes for a good 60 seconds, then finally starts sweeping the island and populating the buildings from west to east (which takes another 30-60 seconds).

    Also, is there any way to force it to only spawn near players so it doesn't load up the map with thousands of items that no player is near? I think just having all those extra items in game will kill the server/host machine.

  14. Is there any way to remove the "Scenario" take from a mission published to Steam Workshop? I've uploaded a few of my missions, and Steam Workshop is adding on the "Scenario" tag to the missions which then allows the game to be loaded from the Scenario menu in game. Problem is, it loads it as a Single Player game which borks up stuff if the mission is built to be multiplayer only.

    There's nowhere in the Steam Workshop UI to remove it in the Steam interface, and even though you see 'Scenario' as one of the tags when you publish the mission from A3, but if you 'Edit Tags', there's no way to remove Scenario as a tag.

    This has led to multiple comments on my missions where people had issues with the missions because A3 tried to load it in SP mode. Can you guys please fix that?

  15. I'm working on a script for a mission that will iterate multiple times and dynamically create and place AI in random locations. I'm just not able to figure out how to assign those units a variable name that I can watch for triggers, etc. In a really simplified form, the script looks something like this:

    aiUnit = 0;
    while {true} do {
    aiUnit = aiUnit + 1;
    _newAI = format ["aiUnit%1",aiUnit];
    _aiSpawned = _group createunit [_unitType,_position];
    sleep 300;

    The question is, what's the simplest way that I can use the _newAI variable to reference the _aiSpawned unit? For example, I'd like the first unit created by the script to be able to be referenced by the variable name "aiUnit1" so I can then do things like create a trigger watching for "!alive aiUnit1".

    Any ideas, or is there a better way to do this?