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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×