Jump to content
engima

[RELEASE] Engima's Traffic Script

Recommended Posts

Got some errors in dedicated server now, I can't figure out oh to fix it lol

 

_refPosX = (_refPlayerPos select 0) + (_minSpawnDist>
14:01:58   Error position: <_refPlayerPos select 0) + (_minSpawnDist>
14:01:58   Error Undefined variable in expression: _refplayerpos
14:01:58 File mpmissions\__cur_mp.Malden\Engima\Traffic\Server\Functions.sqf, line 278
14:01:58 Error in expression <= "NULL";
_refPlayerPos = (selectRandom _allPlayerPositions) select 1;
_areaMark>
14:01:58   Error position: <_allPlayerPositions) select 1;
_areaMark>
14:01:58   Error Undefined variable in expression: _allplayerpositions
14:01:58 File mpmissions\__cur_mp.Malden\Engima\Traffic\Server\Functions.sqf, line 268
14:01:58 Error in expression <_spawnSegment = [_currentInstanceIndex, _allPlayerPositions, _minDistance, _maxS>
14:01:58   Error position: <_allPlayerPositions, _minDistance, _maxS>
14:01:58   Error Undefined variable in expression: _allplayerpositions
14:01:58 File mpmissions\__cur_mp.Malden\Engima\Traffic\Server\StartTraffic.sqf, line 276
14:01:58 Error in expression < true;
_dir = random 360;

_refPosX = (_refPlayerPos select 0) + (_minSpawnDist>
14:01:58   Error position: <_refPlayerPos select 0) + (_minSpawnDist>
14:01:58   Error Undefined variable in expression: _refplayerpos
14:01:58 File mpmissions\__cur_mp.Malden\Engima\Traffic\Server\Functions.sqf, line 278
14:01:58 Error in expression < true;

:down:

Share this post


Link to post
Share on other sites

Hello

Is there a way to Blacklist traffic like you have done in Civilians? I like the randomness of your work and definitely adds to missions a bit of realism. It would be nice to have no traffic in a couple select areas, as it tends to reek havoc in a military compound in a mission I am trying to build. Thanks for any suggestions.

 

Cheers

Greg 

Share this post


Link to post
Share on other sites
On 2018-09-17 at 1:48 AM, swift39 said:

Hello

Is there a way to Blacklist traffic like you have done in Civilians? I like the randomness of your work and definitely adds to missions a bit of realism. It would be nice to have no traffic in a couple select areas, as it tends to reek havoc in a military compound in a mission I am trying to build. Thanks for any suggestions.

 

Cheers

Greg 

 

No, but depending on what you need you may solve such a problem by whitelisting surrounding areas using markers.

Share this post


Link to post
Share on other sites

Hi Enigma!

Loving the mod so far, Im just getting into using scripts more during missions and have a curious question, i might be missing how to do this through the readme/documentations you have. Is there way to kill both the traffic and civilian scripts during a mission?

Share this post


Link to post
Share on other sites
8 hours ago, Comrade_Derpy said:

Hi Enigma!

Loving the mod so far, Im just getting into using scripts more during missions and have a curious question, i might be missing how to do this through the readme/documentations you have. Is there way to kill both the traffic and civilian scripts during a mission?

 

Yes. Implement the ON_UNIT_CREATING (ON_UNIT_SPAWNING_CALLBACK for Engima's Civilians) callback and return false to prevent spawning of new vehicles. Something like this to prevent traffic during night:

 

onUnitCreating = {
    private _createUnit = false;

    if (daytime > 7 and daytime < 22) then {
        _createUnit = true;
    };

    _createUnit
};

// Set traffic parameters.
_parameters = [
    ["SIDE", civilian],
    ["VEHICLES", ["C_Offroad_01_F", "C_Offroad_01_repair_F", "C_Quadbike_01_F"]],
    ["ON_UNIT_CREATING", onUnitCreating],
    ["DEBUG", false]
];

// Start an instance of the traffic
_parameters spawn ENGIMA_TRAFFIC_StartTraffic;
  • Like 2

Share this post


Link to post
Share on other sites
Quote
On ‎2018‎-‎09‎-‎22 at 7:25 AM, engima said:

 

No, but depending on what you need you may solve such a problem by whitelisting surrounding areas using markers.

 

 

Thanks, that seems to do the trick.

Share this post


Link to post
Share on other sites

Hey @engima how would I go about adding passengers? I'd like there to be a random number of civilians in each car.
Would this be easy to do?

Share this post


Link to post
Share on other sites

@phronk that's awesome thanks dude, already using your IED script in my mission to supplement the way ALIVE does it's IED's, now this will help with the civilian traffic.

Thanks again 

Share this post


Link to post
Share on other sites

I run this script all the time on our persistent ALiVE missions and it works great, except for the fact that when no one is online the script spams the same error over and over 

 0:06:23   Error Undefined variable in expression: _allplayerpositions
 0:06:23 File mpmissions\__cur_mp.lythium\Engima\Traffic\Server\StartTraffic.sqf, line 133
 0:06:24 Error in expression <= _playerCalculatedShare;
};
} foreach (_allPlayerPositions);
 
_calculatedMaxVeh>

is there something I can change to avoid this?

Share this post


Link to post
Share on other sites

@JD...

 

 

dos it work with the new vcom driving thing?

Share this post


Link to post
Share on other sites
18 hours ago, loopdk said:

@JD...

 

 

dos it work with the new vcom driving thing?


To be honest I haven't really paid too much attention, it's just a little ambience. 
Having said that I can't remember seeing any AI crashes. I guess it's one of those things that's great if you don't notice it because nothing's going wrong 😂

Share this post


Link to post
Share on other sites
On 5/2/2019 at 2:09 PM, JD Wang said:

I run this script all the time on our persistent ALiVE missions and it works great, except for the fact that when no one is online the script spams the same error over and over 

is there something I can change to avoid this?

 

I can confirm there is an error in the script. I do not use it on an empty server myself. But it's quite an easy fix. Cannot fix it immediately though, since I'm away from home.

 

I would guess the best fix is to have all vehicles removed if there are no players in.

  • Thanks 1

Share this post


Link to post
Share on other sites

Could try adding a check into the code's loop like:
 

if ( count allPlayers > 0 ) then 

{

//Code

};

 

Share this post


Link to post
Share on other sites

Just wondering if there's any way to have the AI use the horn of the vehicle if there's a man (or another vehicle) in front of the car?
A little bit of road rage from the civilians would make for some good atmosphere 😂
 

  • Like 1

Share this post


Link to post
Share on other sites

Back again, and before I ask I have to say again thank you for this script. Hands down the best traffic script for ARMA.

Just curious if it could be expanded to include parked cars on the side of the road and/or outside houses etc?

That's the one thing I miss at the moment when creating long term persistent missions is cars parked up.

I guess the biggest issue would be if you spawned vehicles and the despawned them when the player left the area, when they come back how do you ensure the same vehicle spawns again?
Maybe even just spawn them all over the map and enable dynamic sim?
 

  • Like 1

Share this post


Link to post
Share on other sites

I have not tried it, but I’ve seen this, which might be what you are asking for:

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Hi, I'm probably late to the conversation on this, but I am unable to get the script to work at all. I've used the script in the past, but currently it is not initialising. 😕

I'm testing on Stratis, vanilla and the script in default locations, and I can't even get the debug to show.
The RPT also seems to be devoid of any mention of it starting, let alone throwing errors.

 

This is ConfigandStart:

 private ["_parameters"];

// Set traffic parameters.
_parameters = [
	["SIDE", civilian],
	["VEHICLES", ["C_Offroad_01_F", "C_Offroad_01_repair_F", "C_Quadbike_01_F"]],
	["VEHICLES_COUNT", 10],
	["MAX_GROUPS_COUNT", 12],
	["MIN_SPAWN_DISTANCE", 10],
	["MAX_SPAWN_DISTANCE", 30],
	["MIN_SKILL", 0.4],
	["MAX_SKILL", 0.6],
	["AREA_MARKER", "traffic"],
	["HIDE_AREA_MARKER", true],
	["ON_UNIT_CREATING", { true }],
	["ON_UNIT_CREATED", {}],
	["ON_UNIT_REMOVING", {}],
	["DEBUG", true]
];

As you can see pretty standard. I know the minimum and maximum spawn distances are a bit absurd, but I was attempting to get anything to spawn within easy viewing distances.

Share this post


Link to post
Share on other sites

Spawn distance between 10 and 30 is problematic. Vehicles only spawn on roads, so there must be a road segment within that range.

 

And also, the script use the first five minutes to collect all road segments, so chances that your eventual road segment is initialized within half that time is 50%.

 

Try better values for spawn range. Like default, 800-1200.

Share this post


Link to post
Share on other sites

I initially had it had the default values, but it must have been me not waiting the required 5 minutes for proper initialisation. Thanks for clearing that up.

 

edit: Also I forgot that debug only occurred in the map instead of the HUD. All working, thanks.

  • Like 1

Share this post


Link to post
Share on other sites
3 hours ago, anfo said:

I initially had it had the default values, but it must have been me not waiting the required 5 minutes for proper initialisation.

 

Vehicles should start spawning at once when script starts, but in certain cases, like the one I described, there can be an initial delay.

  • Thanks 1

Share this post


Link to post
Share on other sites

I'm updating the script to version 1.7.

 

v1.7

- Fixed: The same car had different random texture on different clients. Now all players see the same texture on all cars.

- Fixed: Script error when no players are in the mission.

 

For now only for TypeSqf distribution channel (at Armaholic as soon as I can make it)

http://typesqf.no-ip.org/cpack/details/Engima.Traffic

 

Have fun!

  • Like 2
  • Thanks 2

Share this post


Link to post
Share on other sites
On 9/12/2019 at 12:38 AM, JD Wang said:

Back again, and before I ask I have to say again thank you for this script. Hands down the best traffic script for ARMA.

Just curious if it could be expanded to include parked cars on the side of the road and/or outside houses etc?

That's the one thing I miss at the moment when creating long term persistent missions is cars parked up.

I guess the biggest issue would be if you spawned vehicles and the despawned them when the player left the area, when they come back how do you ensure the same vehicle spawns again?
Maybe even just spawn them all over the map and enable dynamic sim?
 

 

@JD Wang

I needed what you asked for myself. Check out my new Engima's Parked Vehicles script:

http://typesqf.no-ip.org/cpack/details/Engima.ParkedVehicles

 

  • Like 3
  • Thanks 1

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

×