Home   Help Search Login Register  

Author Topic: Randomised Objectives  (Read 1568 times)

0 Members and 1 Guest are viewing this topic.

Offline XCess

  • Former Staff
  • ****
Randomised Objectives
« on: 22 Aug 2006, 19:44:47 »
I'm making a large mission with two randomised objectives and a randomised convoy, but having trouble showing these objectives in the initial briefing.

THe scripts defining the objectives:

Init.sqs
Code: [Select]
; HIDE ALL OBJECTIVES
"1" ObjStatus "HIDDEN"
"2" ObjStatus "HIDDEN"
"3" ObjStatus "HIDDEN"
"4" ObjStatus "HIDDEN"
"5" ObjStatus "HIDDEN"
;"6" ObjStatus "HIDDEN"
"7" ObjStatus "HIDDEN"
"8" ObjStatus "HIDDEN"
"9" Objstatus "HIDDEN"
"10" ObjStatus "HIDDEN"
[] exec "showObjects.sqs"
? !(local server): exit

; DEFINE OBJECTIVE VARIABLES
; These Variables will tell the triggers which objectives are activr
xs_conv1 = false
xs_conv2 = false

object1A = false
object1B = false
object1C = false
object1D = false
object1D = false

takeGravette = false
takeLeMoule = false
takeRegina = false
takeStPierre = false


_nomin_random = random 1

? _nomin_random <= 0.5: {deleteVehicle _x} forEach units nomin_convoy1; deletevehicle nomin_convoyTruck1; deleteVehicle conTone; deletevehicle conRone; deletevehicle conAone; deleteVehicle conBone; xs_conv2 = true
? _nomin_random > 0.5: {deleteVehicle _x} forEach units nomin_convoy2; ; deletevehicle nomin_convoyTruck2; deleteVehicle conTtwo; deleteVehicle conRtwo; deleteVehicle conAtwo; deleteVehicle conBtwo; xs_conv1 = true

_ob1_random = random 5
_ob1_num = _ob1_random - (_ob1_random mod 1)

;hint format ["objective: %1",_ob1_num]
? _ob1_num == 0 : goto "obj1_A"
? _ob1_num == 1 : goto "obj1_B"
? _ob1_num == 2 : goto "obj1_C"
? _ob1_num == 3 : goto "obj1_D"
? _ob1_num == 4 : goto "obj1_E"

; OBJECTIVE 1A KILL OFFICER
#obj1_A
xs_ob1 = "1"
{deleteVehicle _x} forEach units xs_spets
{deleteVehicle _x} forEach units xs_transHelo
deleteVehicle tranMI

object1A = true
;hint "killofficer"

goto "objective3"


; OBJECTIVE 1B KILL SPETSNAS GROUP
#obj1_B
xs_ob1 = "3"
{deleteVehicle _x} forEach units xs_officer
deleteVehicle xs_offCar
{deleteVehicle _x} forEach units xs_transHelo
deleteVehicle tranMI

object1B = true
;hint "kill spets"

goto "objective3"

; OBJECTIVE 1C KILL Mi17 HELO
#obj1_C
xs_ob1 = "2"
{deleteVehicle _x} forEach units xs_spets
{deleteVehicle _x} forEach units xs_officer
deleteVehicle xs_offCar
object1C = true
;hint "kill helo"

goto "objective3"

; OBJECTIVE 1D KILL PROVINS FUEL STATION
#obj1_D
xs_ob1 = "4"
{deleteVehicle _x} forEach units xs_spets
{deleteVehicle _x} forEach units xs_officer
deleteVehicle xs_offcar
{deleteVehicle _x} forEach units xs_transHelo
deleteVehicle tranMI

object1D = true
;hint "kill provins fuel station"

goto"objective3"

; OBJECTIVE 1E KILL TYRONE FUEL STATION
#obj1_E
xs_ob1 = "5"
{deleteVehicle _x} forEach units xs_spets
{deleteVehicle _x} forEach units xs_officer
deleteVehicle xs_offcar
{deleteVehicle _x} forEach units xs_transHelo
deleteVehicle tranMI

object1E = true
;hint "kill tyrone fuel station"


#OBJECTIVE3
_ob3_random = random 4
_ob3_num = _ob3_random - (_ob3_random mod 1)

? _ob3_num == 0 : takeGravette = true ; xs_ob3 = "8" 
? _ob3_num == 1 : takeLeMoule = true ; xs_ob3 = "7"
? _ob3_num == 2 : takeRegina = true ; xs_ob3 = "9"
? _ob3_num == 3 : takeStPierre = true ;xs_ob3 = "10"

runObjects = true
exit

ShowObjects.sqs
Code: [Select]
@runObjects
xs_ob1 objStatus "ACTIVE"
xs_ob3 objStatus "ACTIVE"

All this works fine server side, but not on other comps. Is there any way to fix this so I can show objectives in the initial briefing, or will I have to show them later on?

Offline Garcia

  • Members
  • *
  • Leeds United is the best football team...EVER!
Re: Randomised Objectives
« Reply #1 on: 22 Aug 2006, 21:30:39 »
as far as I can see you haven't publicvariabled anything. You've exited the script for all the clients, but not PVed anything on the server, therefor the clients know jack shit about what objectives are active or when they 'runObjects' is true. They won't ever get past the '@runObjects'. You have to PV all the unknown variables (runObjects, xs_ob1, xs_ob3).

Offline XCess

  • Former Staff
  • ****
Re: Randomised Objectives
« Reply #2 on: 23 Aug 2006, 18:26:28 »
I've updated the script with publicVariables, but I still seem to be missing something. I'm totally new to mp scripting after the past 4 years of SP only, so bear with me :p

Code: [Select]
; HIDE ALL OBJECTIVES
"1" ObjStatus "HIDDEN"
"2" ObjStatus "HIDDEN"
"3" ObjStatus "HIDDEN"
"4" ObjStatus "HIDDEN"
"5" ObjStatus "HIDDEN"
;"6" ObjStatus "HIDDEN"
"7" ObjStatus "HIDDEN"
"8" ObjStatus "HIDDEN"
"9" Objstatus "HIDDEN"
"10" ObjStatus "HIDDEN"
[] exec "showObjects.sqs"
? !(local server): exit

; DEFINE OBJECTIVE VARIABLES
; These Variables will tell the triggers which objectives are activr
xs_conv1 = false
xs_conv2 = false

object1A = false
object1B = false
object1C = false
object1D = false
object1E = false

takeGravette = false
takeLeMoule = false
takeRegina = false
takeStPierre = false

xs_ob1 = "0"
xs_ob3 = "0"

runObjects = false

publicVariable "xs_conv1"
publicVariable "xs_conv2"

publicVariable "object1A"
publicVariable "object1B"
publicVariable "object1C"
publicVariable "object1D"
publicVariable "object1D"
publicVariable "object1E"

publicVariable "takeGravette"
publicVariable "takeLeMoule"
publicVariable "takeRegina"
publicVariable "takeStPierre"

publicVariable "runObjects"

publicVariable "xs_ob1"
publicvariable "xs_ob3"


_nomin_random = random 1

? _nomin_random <= 0.5: {deleteVehicle _x} forEach units nomin_convoy1; deletevehicle nomin_convoyTruck1; deleteVehicle conTone; deletevehicle conRone; deletevehicle conAone; deleteVehicle conBone; xs_conv2 = true
? _nomin_random > 0.5: {deleteVehicle _x} forEach units nomin_convoy2; ; deletevehicle nomin_convoyTruck2; deleteVehicle conTtwo; deleteVehicle conRtwo; deleteVehicle conAtwo; deleteVehicle conBtwo; xs_conv1 = true

_ob1_random = random 5
_ob1_num = _ob1_random - (_ob1_random mod 1)

;hint format ["objective: %1",_ob1_num]
? _ob1_num == 0 : goto "obj1_A"
? _ob1_num == 1 : goto "obj1_B"
? _ob1_num == 2 : goto "obj1_C"
? _ob1_num == 3 : goto "obj1_D"
? _ob1_num == 4 : goto "obj1_E"

; OBJECTIVE 1A KILL OFFICER
#obj1_A
xs_ob1 = "1"
{deleteVehicle _x} forEach units xs_spets
{deleteVehicle _x} forEach units xs_transHelo
deleteVehicle tranMI

object1A = true
;hint "killofficer"

goto "objective3"


; OBJECTIVE 1B KILL SPETSNAS GROUP
#obj1_B
xs_ob1 = "3"
{deleteVehicle _x} forEach units xs_officer
deleteVehicle xs_offCar
{deleteVehicle _x} forEach units xs_transHelo
deleteVehicle tranMI

object1B = true
;hint "kill spets"

goto "objective3"

; OBJECTIVE 1C KILL Mi17 HELO
#obj1_C
xs_ob1 = "2"
{deleteVehicle _x} forEach units xs_spets
{deleteVehicle _x} forEach units xs_officer
deleteVehicle xs_offCar
object1C = true
;hint "kill helo"

goto "objective3"

; OBJECTIVE 1D KILL PROVINS FUEL STATION
#obj1_D
xs_ob1 = "4"
{deleteVehicle _x} forEach units xs_spets
{deleteVehicle _x} forEach units xs_officer
deleteVehicle xs_offcar
{deleteVehicle _x} forEach units xs_transHelo
deleteVehicle tranMI

object1D = true
;hint "kill provins fuel station"

goto"objective3"

; OBJECTIVE 1E KILL TYRONE FUEL STATION
#obj1_E
xs_ob1 = "5"
{deleteVehicle _x} forEach units xs_spets
{deleteVehicle _x} forEach units xs_officer
deleteVehicle xs_offcar
{deleteVehicle _x} forEach units xs_transHelo
deleteVehicle tranMI

object1E = true
;hint "kill tyrone fuel station"


#OBJECTIVE3

_ob3_random = random 4
_ob3_num = _ob3_random - (_ob3_random mod 1)

? _ob3_num == 0 : takeGravette = true ; xs_ob3 = "8" 
? _ob3_num == 1 : takeLeMoule = true ; xs_ob3 = "7"
? _ob3_num == 2 : takeRegina = true ; xs_ob3 = "9"
? _ob3_num == 3 : takeStPierre = true ;xs_ob3 = "10"


runObjects = true
exit

Offline XCess

  • Former Staff
  • ****
Re: Randomised Objectives
« Reply #3 on: 27 Aug 2006, 02:19:24 »
Solved the problem, I was using strings which publicVar doesn't support.
I will be running a public beta test on Monda, check the beta board for details.