OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: limmy3 on 23 Mar 2007, 16:02:49
-
Hello fellows,
I'm looking for a fellow how "loves" challenges in writting a script.
I have no experience in writting scripts. So I do not know whether it is possible.
Well, I'm able to write cunscenes and speech scripts but that's all. :(
I need a special script ... :D
I explain it.
A couple of two civilians called
Civ_1 and Civ_2
are walking down a hill and may be detected by one of three soldiers W_2, W_3 or W_4
Only one of them should report to the Corporal otherwise when all speak this ends in chaos.
I tried this with triggers which works but then it may happen that all are reporting to the Corporal.
I have written two scripts for each soldier
; [this] exec "W_2_Civ_1_1.sqs"
W_2 SideChat "Sir, Civilians are coming up the hill from the south."
~5
W_1 SideChat "Very well Mr Balboa, then tell them to disappear."
~3
W_2 SideChat "Yes Sir."
exit
; [this] exec "W_2_Civ_1_2.sqs"
W_2 sideChat "I intercepted them and convince them to go back. Sir."
~5
W_1 SideChat "Very well Mr Balboa that was correct."
~3
; W_1 SideChat "Fall back in formation."
W_2 CommandFollow W_1
~2
W_2 SideChat "Yes, Sir."
exit
; [this] exec "W_3_Civ_1_1.sqs"
W_3 SideChat "Corporal, here's a couple walking over the hill trough the zone."
~4
W_1 SideChat "Mr Bond make clear to them they can't pass this area."
~3
W_3 SideChat "Aye-aye, Sir."
exit
; [this] exec "W_3_Civ_1_2.sqs"
W_3 sideChat "Ok, Corporal the couple is bugging out."
~4
W_1 SideChat "Thank you Mr Bond."
W_3 CommandFollow W_1
~2
W_3 SideChat "Aye, Sir."
exit
; [this] exec "W_4_Civ_1_1.sqs"
W_4 SideChat "Corporal, Sir! Two persons are coming towards the depot."
~10
W_1 SideChat "Mr Christian make sure they leave this area. Don't let them pass."
~3
W_4 SideChat "Aye-aye, Sir."
~3
W_1 SideChat "Chase them away."
~3
W_4 SideChat "Yes, Sir."
exit
; [this] exec "W_4_Civ_1_2.sqs"
W_4 sideChat "They turned arround, Sir."
~7
W_1 SideChat "Yes, Mr Christian well done."
~3
W_4 SideChat "Yes, Sir."
W_4 CommandFollow W_1
~2
W_4 SideChat "Yes."
3
W_4 SideChat "Sir!"
exit
The triggers:
Trigger : 01 Function: Activates *.sqs at distance
Axis a: 0 Axis b: 0 Angle: 0° Ellipse: 0 Rectangle: 0 Once: 0 Repeatedly: 0
Activation: None
Type: None Text: Name:
Condition: W_2 distance Civ_1 < 160
On Activation: [this] exec "W_2_Civ_1_1.sqs"
Trigger : 02 Function: W_2 will move to Civ_1
Axis a: 0 Axis b: 0 Angle: 0° Ellipse: 0 Rectangle: 0 Once: 0 Repeatedly: 0
Activation: None
Type: None Text: Name:
Condition: W_2 distance Civ_1 < 70
On Activation: Civ_1 stop true; W_2 doMove getPos Civ_1
Trigger : 03 Function: W_2 will talk to Civ_1; Civ_1 will flee; W_2 will return to formation
Axis a: 50 Axis b: 50 Angle: 0° Ellipse: 0 Rectangle: 0 Once: 0 Repeatedly: 0
Activation: None
Type: None Text: Name:
Condition: W_2 distance Civ_1 < 5
On Activation: Civ_1 stop true; [this] exec "W_2_Civ_1_2.sqs"
On Deactivation: Civ_1 stop false; verjagen = true
What I need is a script to let only the one soldier activate his *.sqs file who first detected the civilians.
eg:
Lets say the soldier W_3 detected the Civ_1 first that means the other soldiers W_2 and W_4 should say nothing.
The importent thing is that only one soldier talks both parts.
All help is :welcome:
Regards limmy3
-
;Checkcivs.sqs
_civs = _this select 0
_guards = _this select 1
_scripts = _this select 2
_numguards = count _guards
#check
_i = 0
#checkguards
_know = 0
_guard = _guards select _i
"if (((_guard knowsabout _x) > _know) && (alive _x)) then {_know = (_guard knowsabout _x)}" forEach _civs
?_know > 0: []exec (_scripts select _i);exit
_i = _i + 1
?_i < _numguards: goto "checkguards"
~1
goto "check"
[[Civ_1, Civ_2], [W_2,W_3,W_4], ["W_2_Civ_1_1.sqs", "W_3_Civ_1_1.sqs","W_4_Civ_1_1.sqs"]]exec"Checkcivs.sqs"
-
Hello Mandoble,
thank you for writting this script for me. :)
I'm still trying to get it to work correctly.
The second code I copied in the trigger activated by civilians detected by west.
The W_2_Civ_1_1.sqs will be activated only. Unit W_2 detects the Civ_1 only.
[[Civ_1, Civ_2], [W_2,W_3,W_4], ["W_2_Civ_1_1.sqs","W_2_Civ_1_2.sqs", "W_3_Civ_1_1.sqs", "W_3_Civ_1_2.sqs", "W_4_Civ_1_1.sqs", "W_4_Civ_1_2.sqs"]]exec"Checkcivs.sqs"
Where is the mistake? ???
Regards limmy3
-
May be W_2 detects the Civ_1 all time before (or at the very same time) any other guard detects any other civ?
It is done so first to detect a civ notifies it and then nothing more is done (exit).