Home   Help Search Login Register  

Author Topic: Long duration traffic on roads?  (Read 898 times)

0 Members and 1 Guest are viewing this topic.

Safari

  • Guest
Long duration traffic on roads?
« on: 03 Apr 2004, 18:21:11 »
Is it possible to make a scenario where heavy traffic is moving between two cities for hours to come? I mean when there are 20-30 vehicles on the road, collisions will occur and AI repair trucks (in support waypoint) don't seem to support too much sometimes. So eventually it's always the same. You fond walking drivers where there should be heavy traffic. Can AI repair trucks even repair damaged trucks and jeeps on their own anyway.

I could always learn how to make script that spawns new vehicles who inherit their predecessors waypoints?

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re:Long duration traffic on roads?
« Reply #1 on: 03 Apr 2004, 18:59:54 »
uhm....maybe a script which checks the dammage of each vehic and resets it to 0 if needed...it could look like this

;repair.sqs

_car = _this select 0

#start
~1
_dam = getdammage _car
?(_dam >= 0.1): goto "repair"
goto "start"

#repair
_car setdammage 0
goto "start"

Call the script from each vehics init line:

[this] exec "repair.sqs"

This will prevent the cars get dammaged and drivers leave the car...at least i think it should do it  ;D


btw...syntax not guaranteed  ;)
« Last Edit: 03 Apr 2004, 19:00:33 by myke13021 »

Rappy

  • Guest
Re:Long duration traffic on roads?
« Reply #2 on: 03 Apr 2004, 20:19:21 »
indeed, also while you are at it refuel the cars from time to time
like:
~360
_car setfuel 1

or they'll most likely end up without fuel at one point

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re:Long duration traffic on roads?
« Reply #3 on: 03 Apr 2004, 20:24:03 »
very good point Rappy...didn't thought about this case.

But i think you can add the setfuel line without a previous delay...making the car refuel every second.

;repair.sqs

_car = _this select 0

#start
~1
_dam = getdammage _car
_car setfuel 1
?(_dam >= 0.1): goto "repair"
goto "start"

#repair
_car setdammage 0
goto "start"
« Last Edit: 03 Apr 2004, 20:25:28 by myke13021 »

Rappy

  • Guest
Re:Long duration traffic on roads?
« Reply #4 on: 03 Apr 2004, 23:02:06 »
yah, I used a longer delay though(using whenever possible) for performance reasons.

It starts hitting really hard eventually when you have lots of scripts all doing actions like that per second or usually 5+ times per second.

Not really that important in this case though I guess

For example the damage could be @ instead of ? so it wouldn't have to be a loop

@(_car getdammage >= 0.1): _car setdammage 0

shame there isn't a function to request the fuel level of the car (atleast I didn't find one)

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:Long duration traffic on roads?
« Reply #5 on: 04 Apr 2004, 03:52:58 »
errm just for info:

@ uses way more processor power than a 1 second ? loop

@ frequenzy is almost every available frame = multiple times
per second, while ? + ~1 as you already guessed: 1 sec.

~S~ CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Rappy

  • Guest
Re:Long duration traffic on roads?
« Reply #6 on: 04 Apr 2004, 10:49:26 »
oh I didn't know that :D

But as we are already on it, how much do such things slow ofp down anyways ? How much performance could one gain by making loops longer and removing @ ?

just wondering

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Long duration traffic on roads?
« Reply #7 on: 04 Apr 2004, 13:00:55 »
I have a script that does this.    There's not a huge amount of traffic, just enough, and it seems to work pretty well.   The loop delay is 5s which is more than fast enough.     For each vehicle the script is this:  


#mgjeep1
? not (alive mgjeep1D): goto "mgjeep2"
mgjeep1 setFuel 1
? getdammage mgjeep1 < 0.9: mgjeep1 setdammage 0
? getdammage mgjeep1 >= 0.9: mgjeep1 setdammage 1

#mgjeep2
? not (alive mgjeep2D): goto "mgjeep3"
mgjeep2 setFuel 1
? getdammage mgjeep2 < 0.9: mgjeep2 setdammage 0
? getdammage mgjeep2 >= 0.9: mgjeep2 setdammage 1

etc
Plenty of reviewed ArmA missions for you to play

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re:Long duration traffic on roads?
« Reply #8 on: 04 Apr 2004, 19:59:42 »
well...i got a similar problem. I have a Taxi cab which can be called by an action to players actual position. This worked pretty well, but sometimes the driver was just too stupid and crashed the car, get out of it and continued his path at feet. As you can imagine, this isn't pretty cool when you call a Taxi and the driver comes without a Car  ;D

for this i wrote a little script which checks if car is dammaged and repairs it and moves driver instantly back on his driving seat.

I'll post it here, maybe it helps you to get some ideas.

_vehic = _this select 0
_driver = _this select 1

#loop
~0.5
_dam = getdammage _vehic
?(_dam >= 0.2): goto "repair"
?(isnull driver _vehic):goto "repair"
_vehic setfuel 1
goto "loop"

#repair
_vehic setdammage 0
_driver setdammage 0
_driver moveindriver _vehic
goto "loop"


Good luck with your heavy traffic...and watch out when passing roads  ;)

Safari

  • Guest
Re:Long duration traffic on roads?
« Reply #9 on: 05 Apr 2004, 13:03:37 »
These scripts works and they really help me. Thank you all so much. Learning scripts opens up a whole new world on mission editing.

How can there be a game that kicks ass this much. omg  ;D
« Last Edit: 05 Apr 2004, 13:04:09 by Safari »

Rappy

  • Guest
Re:Long duration traffic on roads?
« Reply #10 on: 05 Apr 2004, 14:35:51 »
How can there be a game that kicks ass this much. omg  ;D

One of a million pal, one of a million :)


Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Long duration traffic on roads?
« Reply #11 on: 05 Apr 2004, 15:14:01 »
You probably know all this, but just in case here are a few tips on making traffic work.

Give the vehicles as few waypoints as possible - that will help keep things smooth.    

Since unit stop at waypoints, a good place for a waypoint is just before a junction - that way it looks as if the driver is consulting a map or something.  A vehicle that stops for no apparent reason in the middle of a long straight looks a bit odd.

Synchro waypoints of different vehicles so that they meet where you want them to meet.

Try to avoid placing static objects (e.g. tents) too close to the road.    

If a vehicle is behaving erratically - zigzagging or something - move its start position by a few yards.    

Set the vehicles to behaviour safe.  If you want more than one in a group use formation column.

Set all drivers to maximum skill and give them a decent rank - at least sergeant.

Playtest as a passenger in each vehicle in turn - that's the only way you'll find out what really happens.

Don't forget you can use bikes and motorbikes or even pedestrians.
Plenty of reviewed ArmA missions for you to play