Comrades in Arms Discussion Board

Full Version: Minefield/artillery no go area - advice pls...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I want to create a no go area - similar to the minefield scripts but for multiplayer.

I want it so that when any unit on the Blue (West) side enters they get blown up, but so it works for all players on multiplayer.

Ive tried these two scripts below but they dont always work:

I create a file arty.sqs:

Code:
playMusic "artyrep"
~5
playMusic "bombq"
~2
arty="laserguidedbomb" createvehicle getpos (thislist select 0)

or this one:
Code:
playMusic "artyrep"
~5
playMusic "bombq"
~2
arty = "laserguidedbomb" createvehicle [getpos (thislist select 0) select 0, getpos (thislist select 0) select 1, 0]

I create a large area trigger Activation: Blueforce (ie west) repeatedly, condition:
Code:
"man" countType thislist >0
On activation:
Code:
this exec "arty.sqs"

Any advice on how to get this to work properly?

Marto.
I have a mission (in cache somewhere) with this function. I'll search it up cause I think it's an easier way to do it. E.g if player is detected in area then set damage 1
Do you want a death zone as a border of your mission like everyone who enters it will be killed instantaneously or more like an actual minefield?

For the latter I have an IED script in one of my missions which is called from triggers which you could use for a regular minefield too. However the problem is that every trigger or mine needs to be named. Depending on the size of your minefield you could reach the maximum number of global variables pretty quick. I don't know if this is a problem in multiplayer but at least in singleplayer it would result in savegames of the mission not being loadable.

For the deathzone I suggest something like:
Trigger, Activation "West" "Repeatedly" and in the Activation line:
Code:
"_x setDammage 1" forEach thislist
This would kill any west unit (vehicles, aircraft, men) inside the trigger area.
If you only want certain unit classes (men, vheicles) killed you need to call a script or better a function which checks that.
For example:
Code:
// function deathzone.sqf
private ["_units", "_trigger", "_unit", "_i"];

_units = _this select 0;
_trigger = _this select 1;

_i = 0;
_unit = _units select 0;

while (_i < count _units)
{
    if("man" == typeOf _unit)
    {
        _unit setDammage 1;
    };
    _i = _i + 1;
};
And would be called in the trigger with:
Code:
[thislist, triggerName] call loadFile "deathzone.sqf"

If you want the units in the deathzone to blow up you would use
Code:
_tmp = "Shell73" createVehicle getPos _unit;
_tmp setDammage 1;
deleteVehicle _tmp;
instead of only setDammage'ing the unit.

You can also have a look into the Multiplayer Editing and Scripting forum of ofpec.com and see if you can find a more elegant solution.

P.S.: there might be a syntax bubu in my posted code because I did not test it.
Trigger must deactivate (its condition must become false) before it can activate again.

IE, if two guys walk into a "death zone" simultaneously (within 0.5 second of each other, which is the delay in evaluating trigger condition) and the other one survives somehow, trigger won't activate on him or anyone else entering the area until the trigger area is clear once again and deactivates.

You should create bombs a bit in the air (1 meter high or so). They might not explode when you create them on the ground.
(04-14-2009, 07:49 PM)Pulverizer link Wrote: [ -> ]within 0.5 second of each other, which is the delay in evaluating trigger condition
Where do you always know this kind of stuff from?  Smile

About bombs not exploding when created on the ground: that's why I setDammage 1 them in the function. It is tested and works in MP.
(04-14-2009, 09:08 PM)Zwobot link Wrote: [ -> ][quote author=Pulverizer link=topic=1675.msg7459#msg7459 date=1239731358]
within 0.5 second of each other, which is the delay in evaluating trigger condition
Where do you always know this kind of stuff from?  Smile[/quote]

Experimentation 8)

You can make a trigger flip-flop with a boolean variable and then have it output elapsed time onActivation and onDeactivation.

http://koti.mbnet.fi/rniemi/img/flip.JPG

edit:

I was bored so I thought of better ways to make a flip-flop trigger.

These two are nice because they don't need any initialization:

Condition: f&&call{f=true;f}
OnActivation: f=!f
OnDeactivation:

Condition: format["%1",f]!="1"
OnActivation: f=1
OnDeactivation: f=0

This one is very elegant but requires the variable f to be set true before it starts ticking:

Condition: f
OnActivation: f=!f
OnDeactivation: f=!f
Thanks guys, I will try and report back.
Hi Marto
About your test_@wg_co_08_laser.eden mission: I think you safely can remove the overview.html and blackop.paa from your mission. These files is only useful in SP mode, the text and pic who describe the mission in SP browser. Can do it for you if you are away, it might do the trick. The PS-plugin is in [blue]this pack.
OL,

Yep go ahead, and give it a go if you's have a WGL night this coming week..

Also if you are editing it could you place []exec "init.sqs"; []exec "intro.sqs" into the init of the player (the leader I think) - I think it needs to be in all the playable unit's init field? ie all 8 LSRD units.

This will show the cutscene that I forgot to put back in. I'm pretty sure it's a realtime cutscene not an "intro" so it should work multiplayer.

That's if you want to open the mission and not learn all the surprises of it... Maybe you can keep half your eyes closed and only look at the starting units...

Thanks for the tools pack - installed the PS plugin.

I havent had a chanc yet to get back to editing the mission with the no-go area maybe when I get back in a week. I might have some evening leave though and will try to hook up if you guys are on WGL...

(04-17-2009, 06:41 AM)Marto link Wrote: [ -> ]Also if you are editing it could you place []exec "init.sqs"; []exec "intro.sqs" into the init of the player (the leader I think) - I think it needs to be in all the playable unit's init field? ie all 8 LSRD units.
Manually calling the init.sqs is not necessary, it will be executed automatically. The intro script however should be called the way you said (from the init field of every playable unit).
Will do Marto, only problem is that this error only occurs on dedicated servers so we need to test it online (not sure if mine can run WGL).

EDIT: OK, got my WGL server up and running but this mission crash server...
Sitrep Marto:
Here is the error message I got on your mission on win-server
11:40:15 Mission test_@wg_co_08_laser.eden read from bank
11:40:30 Roles assigned
11:40:30 Reading mission ...
11:40:31 Error loading data3d\xm-177e2_proxy.p3d (Magic)

Can't really figure that out cause this is a model file and the previous error was invalid texture aspect ratio..
Code:
// function deathzone.sqf
private ["_units", "_trigger", "_unit", "_i"];

_units = _this select 0;
_trigger = _this select 1;

_i = 0;
_unit = _units select 0;

while (_i < count _units)
{
    if("man" == typeOf _unit)
    {
        _unit setDammage 1;
    };
    _i = _i + 1;
};
And would be called in the trigger with:
Code:
[thislist, triggerName] call loadFile "deathzone.sqf"

I've tried for a while and can't get any of the above to work. Couldn't I just put:

Code:
"man" countType thislist >0
in the condition field to only kill infantry (ie men) units?

I can get this to work:
Code:
"_x setDammage 1" forEach thislist
Wink

But I can't get the below to work either...
Code:
_tmp = "Shell73" createVehicle getPos _unit;
_tmp setDammage 1;
deleteVehicle _tmp;
instead of only setDammage'ing the unit.

I understant the flip switch that Pulverizer explained and will need to use it.

I guess my coding experience is not good enough yet...

I had a look in OPFEC as I always do, that's where I got the initial ideas from but couldn't find any info on finishing it off...

What I'm trying to do is have a area and whenever a blueforce unit enters it a bomb (shell73 or LGbomb doesnt matter) is created at the units position and for any of the others that are in the unit's group as long as they are within the trigger area. It is to kill them so I could include the
Code:
_unit setDammage 1
to be sure.

Also where could I look up what is the difference between sqs and sqf?

Sorry for all the questions...
My function has some syntax errors in the while loop and if selection as I've assumed before. But it won't work anyway because I read around in the Biki and found out that typeOf cannot be used with parent classes like "man" or "air".

For the start you can use a trigger with activation West present repeatedly and use the code "_x setDammage 1" forEach thislist in the on activation line of that trigger. I did some quick testing with this and it seems like it will only kill soldiers even if they are inside vehicles. The vehicles themselves remain unharmed.

So forget the function I posted before and only use the trigger. You only need an external script or function if you want the bomb too. I have put this in a small mission which is attached to this post (am too lazy to post the scripts again...). While doing this I also noticed that this:
Code:
_tmp = "Shell73" createVehicle getPos _unit
_tmp setDammage 1
deleteVehicle _tmp
is wrong indeed. You need a delay between setDammage'ing the shell and deleting it:
Code:
_tmp = "Shell73" createVehicle getPos _unit
_tmp setDammage 1
~1
deleteVehicle _tmp
(see attached mission).
Thanks Zwobot, it works and is exactly what I need.

I also put"

Code:
playMusic "artyrep"
~5
playMusic "bombq"
~2

I'm hoping this will be fine in MP.

Also do I need to do the deactivation thing that pulverizer explains above with this trigger?
Pages: 1 2