OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Resources Beta Testing & Submission => Topic started by: gadolinite on 31 Aug 2003, 00:32:47

Title: bus script does weird things
Post by: gadolinite on 31 Aug 2003, 00:32:47
This is Nogova island.  

Here is my bus script (see attached) that is unfinished, and still working on. So far the bus runs from "road object id # 4739" in Petrovice. The incomplete script tells the bus to go to "road object id # 640" in Davle, it will eventually keep looping to make a full circle on some other roads until it winds up in Petrovice again.  It will keep doing this until the mission ends or the bus is destroyed, or if the driver is killed.  For gas, it will eventually pull into a petrol station if it's fuel level is below 25% (none of this complicated stuff is programmed in there yet).  

My script problem:
 :beat:This bug is stubborn and I can't seem to squash it. :beat:  Around the section of road with object Id's 663 to 660; the bus swerves a few times and knocks over a telephone pole.  It always does the exact same swerve patten and knocks over the same pole.  The bus is supposed to stray on the road at all times.  
   
Title: Re:bus script does weird things
Post by: gadolinite on 31 Aug 2003, 19:30:25
Here is a mission with the script in it so you don't have to take the trouble in setting it up.  Speed up time and observe what happens a littleways up the road from the bridge.

Once I can get help (thank you)  :D squashing the bug, I will complete the script (hopefully I won't run into anymore  :P trouble).  The bus will not go over the bridge, once finished; the bus will make a left in Davle.
   
Title: Re:bus script does weird things
Post by: Unnamed on 01 Sep 2003, 07:33:50
There is definetly something buggy about that stretch of road. You get the same effect, if you just add a waypoint from the start to Davle, and set the speed to limited. Although I added a second waypoint close to the area where it swerves, and that appeared to fix it.

I have noticed a similar thing when you have an AI stood close to, but not on the road, the vehicle tends to swerve to avoid him. So even if you fixed the route it could still happen during the game.

But to be honest, I'm not sure thats the best way to move a bus from A to B. A pause of 0.001 seconds does not give your bus much time to get there?

I take it you dont want to use regular waypoints?
Title: Re:bus script does weird things
Post by: gadolinite on 01 Sep 2003, 19:25:24
I feel that the bus can stay on the road better if you do it my way.  

Thats why I asked if you can create a waypoint with code, one from the bus to Davle.
Title: Re:bus script does weird things
Post by: Gameer_77 on 01 Sep 2003, 21:07:00
The same thing happens with a stretch of road in Malden (or Everon). Check out OSA2's introduction to see what I mean, it can't be helped i'm afraid :(

Gameer
Title: Re:bus script does weird things
Post by: Chris Death on 01 Sep 2003, 21:31:57
I have not had a look into your bus script, nor did i try it
out yet, but:

as AI drivers sometimes really seem not stick to the road,
i would have an idea for a work-around.

Just simulate a car-accident (2 cars being crashed together)
so that you at least would have an explainable reason for the
bus to get off the road and do something what normally would
look stupid. Just place the two accident cars that way, that
the bus can't crash into the telephone pole anymore.

~S~ CD
Title: Re:bus script does weird things
Post by: Unnamed on 01 Sep 2003, 22:11:32
I like the idea of using the Getpos on road elements, would be handy to if you could get the road section object using nearest object?

But this appears to avoid the problem:

Code: [Select]
_Waypoints=[4739,1666,674,664,640]

_Index=0

#Loop

Bus2 domove (getpos object (_Waypoints Select _Index))

@(Bus2 Distance (object (_Waypoints Select _Index)) <50)

_Index=_Index+1

If (_Index<(Count _Waypoints)) then {goto "Loop"}
Title: Re:bus script does weird things
Post by: gadolinite on 02 Sep 2003, 01:39:48
this takes care of that, thanks for the trouble you took trying to solve it