OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: Captain on 03 Apr 2008, 12:44:36
-
I'm currently making a mission using DAC, I have set up various (deactivated) zones as sort of random encounters in the desert but I require a few things to get it to work as hoped. Firstly, rather than a trigger detecting 'OPFOR', 'Not Present', if possible I would like a condition that states 'when 80% of OPFOR in the area are 'Not Present' the condition is met.
Secondly I would like to know how to have a script exec 1 of 3 or more possible snippets *roughly below, forgive the crudity* :-[
#1st Option
titleCut ["","BLACK OUT",.001]
[z1,Position Logic1,[250,250],0,2,2] call DAC_fChangeZone
[z1] call DAC_Activate
titleCut ["You have encountered a small group of Raiders","BLACK IN",.001]
#2nd Option
titleCut ["","BLACK OUT",.001]
[z1,Position Logic1,[250,250],0,4,2] call DAC_fChangeZone
[z1] call DAC_Activate
titleCut ["You have been surprised by a medium group of Raiders","BLACK IN",.001]
#3rd Option
titleCut ["","BLACK OUT",.001]
[z1,Position Logic1,[250,250],0,5,3] call DAC_fChangeZone
[z1] call DAC_Activate
titleCut ["You have stumbled apon a Raider camp","BLACK IN",.001]
#and so on...
How would such a script go and how would one exec it?
Also in regard to the percentage condition, I'm surprised that after what I believe to be thorough searching there are few mentions of this type of condition on either this or the BI forum.
edit: Looking at it now that is actually only 1 Q about conditions... :whistle:
-
This could be done through two triggers.
First up would be the trigger to count the OPFOR inside the area.
(East Present)
Condition: This
Activation: OPF_units = Count ThisList
Second would be the 80% dead:
(East Present)
Condition: OPF_units * 0.2 > Count ThisList
Activation: <Code Here>
For the one in three chance.
script.sqf
private ["_r"];
_r = floor(random 3);
titleCut ["","BLACK OUT",.1];
switch (_r) do
{
case 0:
{
[z1,getPos Logic1,[250,250],0,2,2] call DAC_fChangeZone;
titleCut ["You have encountered a small group of Raiders","BLACK IN",.1];
};
case 1:
{
[z1,getPos Logic1,[250,250],0,4,2] call DAC_fChangeZone;
titleCut ["You have encountered a medium group of Raiders","BLACK IN",.1];
};
case 2:
{
[z1,getPos Logic1,[250,250],0,5,3] call DAC_fChangeZone;
titleCut ["You have encountered a large group of Raiders","BLACK IN",.1];
};
};
[z1] call DAC_Activate;
Or something along that nature, not at me PC so I can't test / cross check with Biki so I'll have to rely on knowledge, hopefully Mando or Spooner or the like will fix any errors I might have made.
Hope this helps,
romm
-
(East Present)
Condition: This
Activation: OPF_units = Count ThisList
(East Present)
Condition: OPF_units * 0.2 > Count ThisList
Activation: <Code Here>
Thanks, works as intended and has been added to my snippets file. :good:
I haven't used your second bit (but will) as I'm altering the way I'm going about it. Which has brought me a new problem, basically what I have now is as follows...
Whole map trigger, BLUFOR, Present, Repeatedly, Timeout, 1800/3600/2700
On activation: this exec "rundac.sqs";
so that somewhere between 30 minutes and 1 hour this is exec'd (repeatedly)...
titleCut ["","BLACK OUT",.01];
_trg = createTrigger["zone1",getPos player];
_trg setTriggerArea[250, 250, 0, false];
_trg setTriggerActivation["WEST","PRESENT",true];
_trg setTriggerStatements["this","["z1"[1,0,0,250,250],[2,2,25,15],[ ],[ ],[ ],[0,0,0,6,1]]exec "DAC\Scripts\DAC_Init_Zone.sqs"", ""];
titleCut ["You have encountered a small group of Raiders","BLACK IN",.01];
But it gives the following error.
Error in expression <_trg setTriggerStatements["this","["z1"[1,0,0,250,250],[2,2,25,15],[ ],[ ],[>
Error position: <z1"[1,0,0,250,250],[2,2,25,15],[ ],[ ],[>
Error Missing ]
Cannot create non-ai vehicle zone1,
Error in expression <_trg setTriggerStatements["this","["z1"[1,0,0,250,250],[2,2,25,15],[ ],[ >
Error position: <"["z1"[1,0,0,250,250],[2,2,25,15],[ ],[ >
Error Generic error in expression
Once I can get the script call working then I'll use your second section in the same way I would have before. Rather than having the zones placed manually in the editor they are spawned at the player after a random time.
...edited for stupidity
-
Found it!
["z1"[1,0,0,250,250],[2,2,25,15],[ ],[ ],[ ],[0,0,0,6,1]]exec "DAC\Scripts\DAC_Init_Zone.sqs"", ""];versus:
["z1",[1,0,0,250,250],[2,2,25,15],[ ],[ ],[ ],[0,0,0,6,1]]exec "DAC\Scripts\DAC_Init_Zone.sqs"", ""];
The "z1" is missing a comma after it, this is a common mistake when copying out of the DAC Manual, the bastards didn't check their code.
-
God dammit! I can't believe I f#&ked that up. I've corrected for that many times.
However that is not the issue here as I still get...
Error in expression <_trg setTriggerStatements["this","["z1",[1,0,0,250,250],[2,2,25,15],[ ],[ ],>
Error position: <z1",[1,0,0,250,250],[2,2,25,15],[ ],[ ],>
Error Missing ]
Cannot create non-ai vehicle zone1,
Error in expression <_trg setTriggerStatements["this","["z1",[1,0,0,250,250],[2,2,25,15],[ ],[>
Error position: <"["z1",[1,0,0,250,250],[2,2,25,15],[ ],[>
Error Generic error in expression
>:(
Thankyou for your continued assistance on this rommel.
-
Hate to be a ball breaker, but did you realise you named the trigger "zone1", not z1? :P
_trg = createTrigger["zone1",getPos player];
_trg setTriggerArea[250, 250, 0, false];
_trg setTriggerActivation["WEST","PRESENT",true];
_trg setTriggerStatements["this","["z1"[1,0,0,250,250],[2,2,25,15],[ ],[ ],[ ],[0,0,0,6,1]]exec "DAC\Scripts\DAC_Init_Zone.sqs"", ""];
However I can't see the problem with the missing ].
-
I hadn't noticed that, but unfortunately my stupidity is not the problem here.
same thing, different spot...
Error in expression <_trg setTriggerStatements["this","["zone1",[1,0,0,250,250],[2,2,25,15],[ ],[>
Error position: <zone1",[1,0,0,250,250],[2,2,25,15],[ ],[>
Error Missing ]
Cannot create non-ai vehicle zone1,
Error in expression <_trg setTriggerStatements["this","["zone1",[1,0,0,250,250],[2,2,25,15],[ >
Error position: <"["zone1",[1,0,0,250,250],[2,2,25,15],[ >
Error Generic error in expression
-
I hadn't noticed that, but unfortunately my stupidity is not the problem here.
same thing, different spot...
The error is in the script call, it does not like the "DAC\Scripts\DAC_Init_Zone.sqs", how to fix this I dont know, but remove those talking marks and it goes away.
-
Anytime you use "" within a string (such as a within a code string as part of setTriggerStatements) you must use double quotes. Examples:
""z1""
""DAC\Scripts\DAC_Init_Zone.sqs""
Try this line instead:
_trg setTriggerStatements["this","[""z1""[1,0,0,250,250],[2,2,25,15],[ ],[ ],[ ],[0,0,0,6,1]]exec ""DAC\Scripts\DAC_Init_Zone.sqs""", ""];
I suspect that will solve (some) of your problems.
-
Anytime you use "" within a string (such as a within a code string as part of setTriggerStatements) you must use double quotes. Examples:
""z1""
""DAC\Scripts\DAC_Init_Zone.sqs""
Try this line instead:
_trg setTriggerStatements["this","[""z1""[1,0,0,250,250],[2,2,25,15],[ ],[ ],[ ],[0,0,0,6,1]]exec ""DAC\Scripts\DAC_Init_Zone.sqs""", ""];
I suspect that will solve (some) of your problems.
Haha, LoyalGuard, damn those DAC bastards, they really have a domino effect, you forgot the comma too. :clap:
_trg setTriggerStatements["this","[""z1"",[1,0,0,250,250],[2,2,25,15],[ ],[ ],[ ],[0,0,0,6,1]]exec ""DAC\Scripts\DAC_Init_Zone.sqs""", ""];
-
I've now tried both with and without the comma (having seen LoyalGuard's post first) and the result is the same. I get no error in game but no DAC zone either. All I now get in the RPT is this... (which is an improvement but still no joy).
Cannot create non-ai vehicle zone1,