Home   Help Search Login Register  

Author Topic: debug help - drop command - where is the smoke?  (Read 1376 times)

0 Members and 1 Guest are viewing this topic.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
debug help - drop command - where is the smoke?
« on: 29 Sep 2005, 16:22:40 »
I have a script that is misbehaving on a dedicated server.  On the mission intro,  a helicopter carrying the players, named IntroHeli,  passes over a trigger that sets its damage to 0.97, which causes it to crash. A trigger based on IntroHeli's height launches a script.  The script sets up the beginning of the game, calls TJ's famous fire.sqs to set IntroHeli alight, kills the pilot and gunner, starts my Helicas system(see editors depot scripts) on the server, and finishes by blowing a tall dark column of smoke to help players find the wreckage.

The smoke code is a simple looped drop command. 4000 times an average random pause of 0.325 seconds is 1300 seconds of smoke. That is over 20 minutes. The ~ command will run at slightly different speeds on all machines. I was trying to keep smoke time to a minimum to prevent unnecessary cpu drain on low-end machines, and used a loop count of 2000 or so. I increased it to 4000 for the release version when playtesters on a dedicated server complained the smoke did not last long enough.

In fact playtesters say that sometimes the smoke is there and sometimes it is not.  Even when it is there it seems to last less than a minute, not long enough.  Sometimes the fire effects of TJ's fire.sqs are not visible either.  

I am so desperate... Here is the code for the trigger:

Code: [Select]
position[]={5745.482910,83.205139,4124.036621};
a=900.000000;
b=900.000000;
rectangular=1;
age="UNKNOWN";
text="Helicopter crashed";
expCond="((GetPos IntroHeli) Select 2) < 5";
expActiv="[] Exec ""helicrashed.sqs""";



calls script helicrashed.sqs
Code: [Select]
If (CadetMode) Then {Exit}
; move triggers and markers associated with helicopter crash to crash site vacinity
;
_pos = Position IntroHeli
_xp = _pos Select 0
_yp = _pos Select 1
_pos2D = [ _xp , _yp ]
triggerEastCrash SetPos _pos2D
triggerWestCrash SetPos _pos2D
"MarkerCrashSite" SetMarkerPos _pos2D
"MarkerCrashSite" SetMarkerType "FLAG"
"MarkerV" SetMarkerType "EMPTY"
"MarkerLZ" SetMarkerType "EMPTY"
"MarkerRecon" SetMarkerType "EMPTY"
"0" ObjStatus "HIDDEN"
"1" ObjStatus "HIDDEN"
"2" ObjStatus "HIDDEN"
"3" ObjStatus "ACTIVE"
~1
Hint "Objectives and Map Updated"
;
y2 = -99
If (Local Server) Then {x1 = 20 - Random 40 ; x2 = 20 - Random 40 ; y1 = 20 - Random 40 ; y2 = 20 - Random 40 ; {PublicVariable _x} ForEach ["x1","x2","y1","y2"]}    
@(y2 != -99)
[gwj1, 2] SetWPPos [ _xp + x1 , _yp + y1 ]
[gwj2, 2] SetWPPos [ _xp + x2 , _yp + y2 ]
[gwj1, 3] SetWPPos [ _xp + x1 , _yp + y1 ]
[gwj2, 3] SetWPPos [ _xp + x2 , _yp + y2 ]
{_x LockWP FALSE} ForEach  [gwj1,gwj2]
~1

;East ammo cans and mash cabinet
y3 = -99
If (Local Server) Then {x1 = 10 - Random 20 ; x1 = x1 + 5*([x1] Call Sign) ; x2 = 10 - Random 20 ; x2 = x2 + 5*([x2] Call Sign) ; x3 = 10 - Random 20 ; x3 = x3 + 5*([x3] Call Sign) ; y1 = 10 - Random 20 ; y1 = y1 + 5*([y1] Call Sign) ; y2 = 10 - Random 20 ; y2 = y2 + 5*([y2] Call Sign) ; y3 = 10 - Random 20 ; y3 = y3 + 5*([y3] Call Sign) ;{PublicVariable _x} ForEach ["x1","x2","x3","y1","y2","y3"]}    
@(y3 != -99)
ammoEast1 SetPos [ _xp + x1 , _yp + y1 ]
Mash1 SetPos [ _xp + x3 , _yp + y3 ]
If (("Alive _x" Count Units ZuluR) > 6 ) Then {ammoEast2 SetPos [ _xp + x2 , _yp + y2 ]}
x1 = NIL ; x2 = NIL ; x3 = NIL ; y1 = NIL ; y2 = NIL ; y3 = NIL

[IntroHeli] Exec "fire.sqs"

;Kill ai
IntroPilot Say (hitsounds Call RandomSelect)
IntroGunner Say (hitsounds Call RandomSelect)
~2
IntroPilot SetDamage 1
IntroGunner SetDamage 1

;
~10
;
;start cas on server only
If Not (Local Server) Then {Goto "client"}
[[H1,H2,H3,H4,H5,H6,H13,H14,ExtractHeli],30,5.0,0.5,0.05] Exec "helicas.sqs"
;
#client
;smoke
_i = 0
#loop
_vel= -1.0 + (random 2.0)
drop ["cl_basic", "", "Billboard", 1,  50+(random 25), [0,0,0.3], [ _vel, _vel, 1 + random 3], 1, 0.6, 1,1, [random 3 , 50 + random 15], [[0,0,0,0.80],[0,0,0,0.1 - Random 0.1]], [0,1], 0.2, 1.0, "", "",IntroHeli]
~0.4 - random 0.15
_i = _i + 1
If (_i < 4000) Then {Goto "loop"}
;
1 FadeMusic 1
~5
;
Exit

 
urp!

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re:debug help - drop command - where is the smoke?
« Reply #1 on: 29 Sep 2005, 20:11:49 »
This is not a direct solution, but a possible workaround...

Create a loop script that runs for 20 minutes, where the logic works like this

Loop for 20 minutes
  If SMOKE_RUNNING is FALSE
     run the smoke script
  End if
  ~wait 5 seconds
End Loop

In the init.sqs initialize global variable SMOKE_RUNNING to false.

In start of smoke sript set SMOKE_RUNNING to TRUE, and just before exit in smoke script, set SMOKE_RUNNING to FALSE.

This way, if your smoke script ends early for whatever strange reason, it will be re-started automatically.
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re:debug help - drop command - where is the smoke?
« Reply #2 on: 30 Sep 2005, 02:20:47 »
I am putting the smoke loop into its own sqs and using the _time variable to determine when to exit instead of a set number of loops.
 
« Last Edit: 30 Sep 2005, 02:21:01 by Mr.Peanut »
urp!

Offline Platoon Patton

  • Members
  • *
  • "Barbecue" CreateVehicle getpos LLama
Re:debug help - drop command - where is the smoke?
« Reply #3 on: 30 Sep 2005, 18:49:08 »
Code: [Select]
expCond="((GetPos IntroHeli) Select 2) < 5";
There is a chance that your chopper chrashes in the woods and keeps hanging in a tree,

your script would never execute then...

Maybe check for speed instead?
http://www.platoon-clan.com/ We always wellcome dedicated OFP players :)

http://www.european-combat-league.com/index.php To play with us in the best OFP league ;)