Home   Help Search Login Register  

Author Topic: Dynamic Mission template problem  (Read 1252 times)

0 Members and 2 Guests are viewing this topic.

Offline MehMan

  • Members
  • *
Dynamic Mission template problem
« on: 31 Jul 2006, 14:29:53 »
This is causing me some problems

For some reason, I can't get the choppers working correctly all the time, sometimes the insertions won't work at all, while the crashed helo insertions work each and every time, for some reason the helo pilot gets confused and just hovers over the base, doesn't move an inch and you're stuck with a ruined mission. I didn't accelerate the time or anything, did everything normal. I'm using Unsung Demo II and CSJ hueys, and it won't work.

Could it be the that the helo itself doesn't use a Transport Unload waypoint? The helo currently gets to the WP and then lands via a teleport thing(the script just teleports it to the ground, you don't see the actual landing), could this be the problem? Also can you actually set what kind of waypoint will the chopper be using via a script? Would any of this fix my problem?

Here are the insertion scripts:
Preinsertion:
Code: [Select]
? assignatedfree == 1 : goto "exitout"
? mission_type == 6 : goto "exitin"
? mission_type == 7 : goto "exitin"
? mission_type == 0 : goto "exitin"

[West, "HQ"] sidechat "Permission granted, select your insertion zone on the map"
onMapSingleClick {[_pos] exec "insertionfly\insercoord.sqs"}
exit

#exitin
~0.2
onMapSingleClick {}
[West, "HQ"] sidechat "Permission denied, wait for your insertion"
exit

#exitout
~0.2
[West, "HQ"] sidechat "You already have an insertion permission"
~1
[West, "HQ"] sidechat "Select your insertion location on the map as requested."
exit

Spawn:
Code: [Select]
~0.2
_sp = getpos airbase

; little trick to force the soldiers to move in cargo
; by using some black screen

titlecut ["Transport chopper preparing","BLACK OUT"]
~1.3
;timeda = random 10
timeda = (random 13) + 5.5
castda = random 1
rainda = random 1
skiptime (timeda - DayTime)
1 setovercast (castda)
1 setrain (rainda)
if (rainda >= 0.8) then {1 setfog (random 0.5)} else {1 setfog 0}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;{_x removeweapon "NVGoggles"}foreach units TEAM1
~0.1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;{_x addweapon "NVGoggles"} foreach units TEAM1
#start
inser1 = "csjUh1slick" createvehicle _sp
~0.3
"soldierwpilot" createunit [_sp,inser_group,"inserpilot=this",1,"captain"]
~0.3
;"sebnam_acpilot" createunit [_sp,inser_group,"insergunner=this",1,"SERGEANT"]
~0.3
;insergunner moveingunner inser1
~0.3
inserpilot moveindriver inser1
~0.2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;removeallweapons inser1
[] exec "insertionfly\inserfly.sqs"

exit

Some coordinate sscript:
Code: [Select]
_pos = _this select 0
~0.2
inser_pos_x = _pos select 0
~0.1
inser_pos_y = _pos select 1
~0.1
airbase2 setpos [inser_pos_x, inser_pos_y]
onmapsingleclick {}
~0.5
; detect if the insertion location is too near the base
; as it can break some trigger i refuse it
~0.5
toonear = airbase distance airbase2
~0.5
? toonear <=500 : goto "refusing"
~0.5
[] exec "insertionfly\spawn_inser.sqs"

; this is testing if the chopper enter inside the danger zone
; if the helicopter approach too much the objective it i can be shot down
; and so it will trigger the rotor secret event
; in the place of the actual mission event

#iamtesting
~3
_dangerzone = airbase2 distance mis_obj
? _dangerzone <= 450 : goto "toobad"
exit

#toobad
~1
fate = random 5
? fate <= 0.5 : goto "badoops"
exit

#badoops
? touching == 1 : goto "normend"
unluck = true
exit

#normend
unluck = false
exit

#refusing
hint format ["Insertion unavailable for less than 500 meters. Currently you selected an insertion at : %1",toonear]
[West, "HQ"] sidechat "Insertion too near the base, we can't allow it"
~1
[West, "HQ"] sidechat "Define another insertion point on by clicking on the map"
~1
[] exec "insertionfly\secondinser.sqs"
exit

Fly to there:
Code: [Select]
"_x moveincargo inser1" foreach units TEAM1

; little trick to have the player in gunner position
; to avoid a visual bug occuring sometime in the OFP engine
; when a player is teleported inside of a chopper
; sometime you could see through other units inside the chopper

;troop1 action ["eject",inser1]
;troop1 moveingunner inser1

letspurge = 0
arghh = 0
stopcity = 0
~0.2
;inser1 flyinheight 100
;inser1 setspeedmode "normal"
inser1 lock true

; this is for later to see if the helicopter enter the danger zone
; if the mission is an ambush or sad one this will not apply
; as the danger zone does not apply

? mission_type == 6 : unluck = false; goto "nextch"
? mission_type == 7 : unluck = false; goto "nextch"

touching = 0
? nodangerzone >= 1 : touching = 1
~0.1
nodangerzone = 0

; testing if there is a dangerzone
~0.1
? touching == 1 : unluck = false

#nextch

; creation of an explosion in the click area, to make the landing zone clear of trees
; to prevent any possible chopper crash

~0.5
booom = "LaserGuidedBomb" camcreate getpos airbase2

#letsgo
~0.2
[inser_group, 0] setwppos getpos airbase2
[inser_group, 1] setwppos getpos airbase2
~0.2
inserpilot domove getpos airbase2
~2.0
; test to see if the chopper is near the destination of the radio click
; but first a possibility of random event
ST1=(random 4)

~0.5
titlecut ["Transport chopper preparing","BLACK IN"]

? nodangerzone >= 1 : goto "loopentrypoint"

#secrettest1
~1
_d0 = inser1 distance airbase2
?_d0 <= 550 : goto "ooops1"
goto "secrettest1"

#loopentrypoint
~2
_d = inser1 distance airbase2
?_d <= 150 : goto "insertion1"
goto "loopentrypoint"

; execution of the insertion itself

#insertion1
~1
; testing if there is a dangerzone
? (unluck) : secretrotor setpos getpos mis_obj;[] exec "secretevents\rotorevent.sqs";exit

[] exec "insertionfly\jumpout.sqs"

~1
unluck = false
touching = 1

#end
exit

; secret event possibility
; tested there
 
#ooops1
setacctime 1
~0.2
? ST1 <= 0.1 : [] exec "secretevents\rotorevent.sqs"; goto "end"
~0.2
? ST1 <= 0.2 : [] exec "secretevents\convoyevent.sqs"; goto "end"
goto "loopentrypoint"

And the landing script:

Code: [Select]
; warn the player that the chopper is landing
; set the waypoint to the chopper location so it will not move
; use a black screen trick so the player will not see the teleportation
; you can use this black screen time to run some spawn script
; so the spawn lag will not be noticed too

titlecut ["Insertion in progress", "BLACK OUT"]
~1
[inser_group, 0] setwppos getpos inser1
[inser_group, 1] setwppos getpos inser1
~2

; teleporting to the ground notice that i use
; a double teleport to be sure the chopper will be stable
; using a single teleport cause the chopper to bounced around
; and fatally explode in some locations

inser1 setvelocity [0,0,0]
inser1 setpos [(getpos airbase2 select 0), (getpos airbase2 select 1), (getpos airbase2 select 2)+50]
inser1 setpos [(getpos airbase2 select 0), (getpos airbase2 select 1), (getpos airbase2 select 2)]
inser1 flyinheight 2
inser1 setvelocity [0,0,0]

titlecut ["Insertion in progress", "BLACK IN"]

; wait a bit so the player now the chopper has landed
; then eject the team using a honchoblack script
~3
#verif
inser1 setvelocity [0,0,0]
_aunits=units Team1
_i=0
_j=count _aunits
#HERE
(_aunits select _i) action["eject",inser1]
unassignvehicle (_aunits select _i)
_i=_i+1
~0.1
?_j>_i:goto "HERE"

; heal the team that can hurt themself in the eject process
; in some specific location unfortunately
troop1 exec "RadioDialog\CloseRadio.sqs"
~2
"_x setdammage 0" foreach units Team1
airbase2 setpos getpos airbase
inser1 sidechat "Good luck, i return to base"
; this setvelocity is used to be sure the AI chopper will not have the
; bad idea to try to land again for some strange reason it happened sometime
; or when using a lower setvelocity
~1.5
inser1 setvelocity [0,0,25]
#endthisnow

; go back to base
; and disappear nasty AI chopper

inser1 flyinheight 100
[inser_group, 0] setwppos getpos airbase
[inser_group, 1] setwppos getpos airbase

inser1 setspeedmode "normal"

~20
deletevehicle inserpilot
deletevehicle insergunner
deletevehicle inser1

exit
Shit happens.