Jump to content

syhrus

Member
  • Content Count

    13
  • Joined

  • Last visited

  • Medals

Posts posted by syhrus


  1. 19 hours ago, jdot11 said:

    Thank you some much. I hate to be pain, I got one problem fixed but I'm still getting an error in spawner.sqf on line 19. Is there somthing that has to change?  Thank you again.

      Reveal hidden contents
    
    
    //Dynspawn Spawner
    //Syhrus
    //v1.0 170615
    
    
    _script = [_this select 0] spawn {
    	
    	sleep 5;
    	_spawner = _this select 0;
    	_canspawn = true;
    	
    	_check = (_spawner getVariable "SpawnCost");
    	if(isNil "_check")then{
    		_spawner setVariable ["SpawnCost", 9999];
    	};
    	
    	
    	_faction = _spawner getVariable ["DynSpawnFaction", -1];
    	if (_faction < 0 || _faction >= count DYNSPAWN_FACTIONS_FACTIONS) then {
    		_spawner globalChat format ["Invalid DynSpawnFaction (%2) on type on: %1", str _spawner, _faction];
    	}else{		
    		while {true} do{			
    			WaitUntil {(count ([_spawner] call GetPlayersInRange)) > 0 || _spawner getVariable ["DynSpawnOverrideDistance", false]};
    			if(DYNSPAWN_SPAWNED < DYNSPAWN_MAX_SPAWN && (_spawner getVariable "SpawnCost")>0)then{
    				switch (_spawner getVariable "DynSpawnType") do {
    					case "BASE": {
    						if (DYNSPAWN_CBA) then {
    							
    							[_faction, _spawner, 75] execVM "SyDynSpawn\SpawnScripts\SpawnMechStatic.sqf";
    							
    							[_faction, _spawner, 75] execVM "SyDynSpawn\SpawnScripts\SpawnCBADefend.sqf";
    							[_faction, _spawner, 75] execVM "SyDynSpawn\SpawnScripts\SpawnCBADefend.sqf";
    							
    							_script = [_faction, _spawner, 75] execVM "SyDynSpawn\SpawnScripts\SpawnInfPatrol.sqf";
    							
    							WaitUntil {scriptDone _script};
    							_spawner setVariable ["SpawnCost", 0];
    							
    							
    						}else{
    							[_faction, _spawner, 150] execVM "SyDynSpawn\SpawnScripts\SpawnMechStatic.sqf";
    							
    							[_faction, _spawner, 75] execVM "SyDynSpawn\SpawnScripts\SpawnInfPatrol.sqf";
    							[_faction, _spawner, 75] execVM "SyDynSpawn\SpawnScripts\SpawnInfPatrol.sqf";
    							_script = [_faction, _spawner, 75] execVM "SyDynSpawn\SpawnScripts\SpawnInfPatrol.sqf";
    							
    							WaitUntil {scriptDone _script};
    							_spawner setVariable ["SpawnCost", 0];
    							
    						};
    						_canspawn = false;
    					};
    					case "PATROL": {
    							_script = [_faction, _spawner, 75] execVM "SyDynSpawn\SpawnScripts\SpawnInfPatrol.sqf";
    							WaitUntil {scriptDone _script};
    							_spawner setVariable ["SpawnCost", 0];
    							
    						};
    					case "ATTACK": {
    							_script = [_faction, _spawner, (_spawner getVariable ["DynSpawnUnitType", "INF"]), (synchronizedObjects _spawner) select 0] execVM "SyDynSpawn\SpawnScripts\SpawnAssault.sqf";
    							WaitUntil {scriptDone _script};
    							_spawner setVariable ["SpawnCost", 0];
    							
    					};
    					case "AREA": {
    							_script = [_faction, _spawner, (_spawner getVariable ["DynSpawnUnitType", "INF"]), (synchronizedObjects _spawner) select 0] execVM "SyDynSpawn\SpawnScripts\AreaSpawn.sqf";
    							WaitUntil {scriptDone _script};
    							_spawner setVariable ["SpawnCost", 0];
    							
    					};
    					CASE "DEFEND": {
    							_script = [_faction, _spawner, 75] execVM "SyDynSpawn\SpawnScripts\SpawnCBADefend.sqf";
    							WaitUntil {scriptDone _script};
    							_spawner setVariable ["SpawnCost", 0];
    					};
    					default {_spawner globalChat format ["Invalid Spawner type on: %1", name _spawner]};
    					CASE "WAVE":{
    							_script = [_faction, _spawner, (synchronizedObjects _spawner) select 0] execVM "SyDynSpawn\SpawnScripts\WaveSpawn.sqf";
    							WaitUntil {scriptDone _script};
    					};
    					CASE "AMBIENTCIV":{
    							_script = [_faction, _spawner, (_spawner getVariable ["DynSpawnUnitType", "INF"]), (synchronizedObjects _spawner) select 0] execVM "SyDynSpawn\SpawnScripts\CivSpawn.sqf";
    							WaitUntil {scriptDone _script};
    							_spawner setVariable ["SpawnCost", 0];
    					};
    				
    				};
    			}else{
    				WaitUntil {DYNSPAWN_SPAWNED < DYNSPAWN_MAX_SPAWN};
    			};
    		
    		};
    	};
    };
    

     

     

    Ahh I see what's happened. I might need to consolidate the errors a bit so it doesn't run the spawners when it detects an error.

     

    What has happened is you have 2 factions set at the start (["Cavalry", "Kamistan"]) then later you have 3 items in some of the arrays, so it's picked up an error and not saved the factions data.

     

    To fix it just clear out the 3rd empty array in _FactionMotVeh, _FactionCrewTemplates, _FactionMechanizedVeh, _FactionMBT, _FactionPilots, _FactionTransportHeli, & _FactionCAS

     

    Thanks for all this, it's helpful for me updating the next version to be more user-friendly.


  2. On 8/24/2017 at 6:43 AM, jdot11 said:

    Thank you. But I'm still getting an error on line 19 and now getting one for line 15. here are the pictures and script. Again thank you.za6unBX.jpg

      Reveal hidden contents

    //Factions information for DynSpawn
    //By Syhrus
    //v1.0 - 170615

                //EDIT THESE VARIABLES TO SUIT YOUR SCENARIO//

    _Factions         = ["Cavalry", "Kamistan"];         //Faction Names
    _FactionSides    = [west, east];        //Faction sides - aligns with Factions array (ie first item applies to first faction);
    _FactionVoices = [
                        ["Male01ENG", "Male02ENG", "Male03ENG", "Male04ENG", "Male05ENG", "Male06ENG"],
                        ["Male01PER", "Male02PER", "Male03PER"]
                    ];            //Faction voice classnames in an array - Requires at least 1 each
    _FactionIdentities = [
                        ["Male01ENG", "Male02ENG", "Male03ENG", "Male04ENG", "Male05ENG", "Male06ENG"],
                        ["Male01PER", "Male02PER", "Male03PER"]
                    ];            //Faction face classnames in an array - Requires at least 1 each
    _FactionInfTemplates = [
                        [CAV_HEADQUATOR, CAV_TEAM1, CAV_TEAM2, CAV_MG1, CAV_AT1, CAV_AT1],
                        [KA_TEAM_1, KA_TEAM_2, KA_TEAM_3]
                    ];             //Arrays of group leaders from templates for infantry - aligns with Factions array
                                //NOTE: You CAN use this to spawn factions on sides different to their default! NATO-CSAT 
    _FactionMotVeh = [
                        ["rhsusf_M1237_MK19_usarmy_d", "rhsusf_M1237_M2_usarmy_d", "RHS_M2A3_BUSKIII", "burnes_MATV"],
                        ["CUP_O_BTR90_RU", "CUP_OGAZ_Vodnik_PK_RU", "CUP_O_Ural_RU", "rhs_tigr_sts_msv"],
                        []
                        
                    ];            //Arrays of vehicle classnames for MOTORISED squads - leave empty if no motorised squads wanted
    _FactionCrewTemplates = [
                        [CAV_CREW],
                        [KA_CREW]
                        ,[]
                    ];            //Arrays of mechanized and tank crew template group leaders
    _FactionMechanizedVeh = [
                        ["rhsusf_M1237_MK19_usarmy_d", "rhsusf_M1237_M2_usarmy_d", "RHS_M2A3_BUSKIII", "burnes_MATV"],
                        ["CUP_O_BTR90_RU", "CUP_OGAZ_Vodnik_PK_RU", "CUP_O_Ural_RU", "rhs_tigr_sts_msv"],
                        []
                    ];            //Arrays of vehicle classnames for MECHANIZED squads - leave empty array if no mechanized squads wanted
    _FactionMBT = [                    
                        [],
                        [],
                        []
                    ];            //Arrays of MBT classnames - leave empty array if no MBT wanted
    _FactionPilots = [
                        [],
                        [],
                        []
                    ];            //Arrays of pilot template group leaders
                    
    _FactionTransportHeli = [
                        [],
                        [],
                        []
                    ];            //Arrays of Airborne Reinforcements helicopter classnames - leave empty if none wanted
    _FactionCAS = [
                        [],
                        [],
                        []
                    ];            //Arrays of CAS vehicle clssnames - Leave empty array if none wanted
                    
                    

                //DO NOT EDIT PAST THIS POINT UNLESS YOU KNOW WHAT YOU'RE DOING//
                    
    _countcheck = count _factions;
    if(count _FactionSides != _countcheck)then{
        DYNSPAWN_MESSAGE_SENDER globalChat "DYNSPAWN: ERROR IN factions.sqf - FactionSides has the wrong number of items";
    }else{
        if(count _FactionInfTemplates != _countcheck)then{
            DYNSPAWN_MESSAGE_SENDER globalChat "DYNSPAWN: ERROR IN factions.sqf - FactionInfTemplates has the wrong number of items";
        }else{
            if(count _FactionMotVeh != _countcheck)then{
                DYNSPAWN_MESSAGE_SENDER globalChat "DYNSPAWN: ERROR IN factions.sqf - FactionMotVeh has the wrong number of items";
            }else{
                if(count _FactionCrewTemplates != _countcheck)then{
                    DYNSPAWN_MESSAGE_SENDER globalChat "DYNSPAWN: ERROR IN factions.sqf - FactionCrewTemplates has the wrong number of items";
                }else{
                    if(count _FactionMechanizedVeh != _countcheck)then{
                        DYNSPAWN_MESSAGE_SENDER globalChat "DYNSPAWN: ERROR IN factions.sqf - FactionMechanizedVeh has the wrong number of items";
                    }else{
                        if(count _FactionMBT != _countcheck)then{
                            DYNSPAWN_MESSAGE_SENDER globalChat "DYNSPAWN: ERROR IN factions.sqf - FactionMBT has the wrong number of items";
                        }else{
                            if(count _FactionPilots != _countcheck)then{
                                DYNSPAWN_MESSAGE_SENDER globalChat "DYNSPAWN: ERROR IN factions.sqf - FactionSides has the wrong number of items";
                            }else{
                                if(count _FactionTransportHeli != _countcheck)then{
                                    DYNSPAWN_MESSAGE_SENDER globalChat "DYNSPAWN: ERROR IN factions.sqf - FactionSides has the wrong number of items";
                                }else{
                                    if(count _FactionCAS != _countcheck)then{
                                        DYNSPAWN_MESSAGE_SENDER globalChat "DYNSPAWN: ERROR IN factions.sqf - FactionSides has the wrong number of items";
                                    }else{
                                        DYNSPAWN_FACTIONS_FACTIONS = _Factions;
                                        DYNSPAWN_FACTIONS_SIDE = _FactionSides;
                                        DYNSPAWN_FACTIONS_VOICES = _FactionVoices;
                                        DYNSPAWN_FACTIONS_FACES = _FactionIdentities;
                                        DYNSPAWN_FACTIONS_INF_TEMPLATES = _FactionInfTemplates;
                                        DYNSPAWN_FACTIONS_MOT_VEH = _FactionMotVeh;
                                        DYNSPAWN_FACTIONS_CREW_TEMPLATES = _FactionCrewTemplates;
                                        DYNSPAWN_FACTIONS_MECH_VEH = _FactionMechanizedVeh;
                                        DYNSPAWN_FACTIONS_MBT = _FactionMBT;
                                        DYNSPAWN_FACTIONS_PILOTS = _FactionPilots;
                                        DYNSPAWN_FACTIONS_T_HELI = _FactionTransportHeli;
                                        DYNSPAWN_FACTIONS_CAS = _FactionCAS;
                                        DYNSPAWN_MESSAGE_SENDER globalChat "DYNSPAWN: Factions Data Loaded";
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

     

    Comma at the end of the array shouldn't be there. It isn't in the code you posted though, so just double check you've got right file open/saved.

     

    When you get those errors, look for the # symbol and it'll show you where the issue is.

     

     


  3. 5 hours ago, sparker said:

    i also came across this thread and your idea to use isOnRoad is very good!

    So I made a similar function. It takes into account the direction of a road, then starts probing it with isOnRoad in both directions orthogonal to the direction of the road and returns decent results for segments of a road facing anywhere. I hope it's of any help.

    Also an interesting thing I've learned, the position returned by nearRoads is not always in the middle of the road, but the isOnRoad does its job well(in terms of symmetry). On the picture, blue arrow is the middle point returned by getPos road, and pink arrows show how isOnRoad works.

    Picture link: steam screenshot

     

     

    Oh Nice! I couldn't work out a way to get the road's direction. That's super helpful!

    • Like 1

  4. Sorry to resurrect a long-dead thread, but this thread comes up first on the google results, and I found a hacky solution to this issue today:

     

    Different road types are different widths, so with a little math, and and a few logic gates, you can estimate the kind of road the object is on. For example, the sealed highways on Malden are ~12m across, the sealed country roads are ~9.5m and so on... Using that knowledge, you can use isOnRoad to get five points: object position, and 5.5m in front, behind, left, and right of the object. If at least four of these return true, you're on a sealed highway, if not, check again at 4.5m, if four of those return true, you're on the country road and so on. Here's the code that'll do it:

     

    EDIT: I'm a dumb-dumb. You can get the road directly and work from there

    You can use isOnRoad and NearRoad to test 4 points around the road at various radii to get the width of the road more accurately. If all 4 return true, you know what size the road is. Keep in mind that all road pieces return North for GetRelPos [X, 0] and so on, so occasionally you might not get the right answer.
     

    It's worth noting that this is not a perfect solution. Intersections will return "highway" when they're actually gravel roads, and some angles may return "no road", but it'll work fine in most situations aside from that.

    _radii = [0, 3, 4.2, 5.75];
    _types = ["no road", "gravel road", "sealed road", "highway"];
    
    
    _type = (_types select 0);
    _currentTest = 1;
    while {(_currentTest < count _radii)}do{
    	
    	_nearestRoad = ((vehicle player) nearRoads (_radii select (count _radii - 1))*2.5) select 0;
    	if(isNil "_nearestRoad")ExitWith {};
    	
    	_left = isOnRoad (_nearestRoad getRelPos [(_radii select _currentTest), 270]);
    	_right = isOnRoad (_nearestRoad getRelPos [(_radii select _currentTest), 90]);
    	_behind = isOnRoad (_nearestRoad getRelPos [(_radii select _currentTest), 180]);
    	_front = isOnRoad (_nearestRoad getRelPos [(_radii select _currentTest), 0]);
    
    	if (_left && _right && _behind && _front) then{
    		_type = _types select _currentTest;
    	};
    	_currentTest = _currentTest + 1;
    };
    
    hint format ["player is on %1", _type];

     

    • Like 5

  5. 2 hours ago, katipo66 said:

    Hey syhrus,

     

    I downloaded and had a peek, looks like some nice features, could you possibly provide a very simple sample mission, i kinda get whats going on but i like sample missions i can pull apart and understand where everything goes.

     

    Also if i can picture this right, the ability to give custom waypoints as mentioned above would be an awesome function.

     

    Cheers!

    Here you go: https://www.mediafire.com/file/f3749dpf4uu81ld/Dynspawn_Example.Stratis.zip

    • Like 1

  6. Just now, katipo66 said:

     

    I just wasn't sure if they were given any waypoint or patrolling functionality, if not then I guess the ability to provide them with some would be great, the ability to redress them also sounds great, ill take it for a spin next chance, cheers

    Ah yes, in that case there are random waypoints given in most spawners, and others that give vague "attack here" commands after spawning.


  7. 1 minute ago, katipo66 said:

    Hi syhrus, sounds interesting, without me downloading and trying yet can I ask does it manage waypoints/movement etc, Does it cache units and spawn them in once player is a certain distance? 

     

    Cheers

    So if I understand correctly, you would like it to keep track of custom placed units and their waypoints? In which case, no it doesn't. However that is within my ability to add that function in future.

    Is does cache units when players move away, and then respawn them if the players return.


  8. Hi all, I'm usually just a lurker here, but I thought I'd release my dynamic spawning system seeing as I've finally got it to the point where I'm happy to hand it out to people.

    So, without further ado:

     

    What is it?

    The Dynamic Spawner is a system that dynamically spawns units with custom loadouts, faces, voices, etc. This can add variety to your missions by giving you the ability to create factions that normally don't exist in the game - WITHOUT needing extra mods (other than gear/weapons if you want modded ones). Handy for public servers that want to avoid using mods, or for groups who want to have special factions for their scenarios without needing entire mods for new factions.

     

    How do I use it?

    1. Unzip the files into your mission file, and add the following to your init.sqf:

    0 = execVM "SyDynSpawn\DynamicSpawnerInit.sqf";

    2. Place down units in your mission (disable their simulation/model/etc) and give them the custom loadout you want.

    3. Give the leaders of the groups relevant names.

    4. Insert the names of the group leaders, and classnames of vehicles into the factions.sqf (check attached readme for details on how to do that)

    5. Place down Game Logics where you want to spawn units and follow instructions in the readme file to set them up to spawn how you want.

     

    Example Mission here: https://www.mediafire.com/file/f3749dpf4uu81ld/Dynspawn_Example.Stratis.zip

     

    What does it not do yet?

    I've added base elements for CAS and Helicopter reinforcements, but haven't implemented a spawner for them yet. This will be added in future.

     

    Where do I get it?
    Here: http://www.mediafire.com/file/nb01br9o3pu9p3v/SyDynSpawn.zip

     

    Anyways, let me know if you find bugs or have questions/suggestions for future features.

    • Like 4

  9. Sorry to post this in a two year old thread, but this came up first when googling the error, so...

     

    I have found just recently that if you have the script attached to the vehicle instead of the pilot/squad leader/etc (easy to do in the editor by accident), the GETOUT/TR UNLOAD waypoints won't work correctly.

     

    Fix this by either making sure you have the pilot selected when you attach the script, or by using

    driver VEHICLENAME

    to select the driver, not the vehicle.

     

    *lurks away*


  10. FIX:

    After a bit of digging I found a fix to this. Sorry if I'm awakening an old thread, but this was the first one to come up on a google search, so I thought I'd post this here to save people time:

    To get the module to work since the Zeus update, you need to sync a GAME MASTER module in place of a curator. As far as I can tell you don't need an actual person to play as Zeus however.

×