Home   Help Search Login Register  

Author Topic: Arma says "Hey guess what, cars are civilians"  (Read 1539 times)

0 Members and 1 Guest are viewing this topic.

Offline D007

  • Members
  • *
Arma says "Hey guess what, cars are civilians"
« on: 28 Aug 2008, 15:06:36 »
Lol seriously?

We use a civilian not present trigger and after hours of narrowing it down between objects on the map we find.

"if a car has no one in it, arma considers that car a civilian...

So, say you have a car sitting in the middle of your trigger.
a random player parks a car in your trigger and leaves it.. etc..
That trigger will never go off again until that car car either gets a driver, is destroyed.. or is moved out of the trigger area.
This makes the civilian not present trigger, all but pointless if you want to use it in any kind of decent sized radius.
The variables become completely unpredictable during play.

so you either go to lengths to fix the problem manually over and over throughout the game..
Or just find another way to do it? lol..

Point im at is: teleporting a man into the driver seat, that is in the trigger area every time the car respawns..
the car is part of the reward you can get, for raiding the main base and living to make it out.
It's loaded with guns ammo etc. so It's important we keep it for variety.

The car needs to be able to be taken. so the ai is disabled inside it.
he's easy to kill but he can detect you as well and killing him also sets off the trigger.

Base has civilians inside, who are hostages and can be saved for rewards.
when no civs are preset within about 1200 meters, the trigger brings back in more civs who can be saved again.
The trigger area, men,vehicles, etc, reset themselves, to go again next time.

But this situation is still unreliable.
if someone so much as parks a car in the trigger and leaves it..
We're screwed..lol..

we need to make one of those count this list things or something for the civs I guess....
We're still getting use to those, but more and more they seem
so unbelieveably reliable.
Especially in comparison to armas own trigger design.
Which is totally flawed..lol..
getting not present triggers to work, seems to be very iffy.

this is our spawn script for those 4 civs who will respawn..
I'm sure this is no way practical but it's what we know how to do.lol..

Code: [Select]
?! (local server): exit
~1
_this = group hosg createUnit ["civilian", hosm1, [], 0, "form"]
_this addaction ["Rescue","rescue.sqs"]
_this addEventHandler ["killed",  {      _Killer = _this select 1;      _id=([man1,man2,man3,man4,man5,man6,man7,man8,man9,man10,man11,man12,man13,man14,man15,man16,man17,man18,man19,man20] find gunner _Killer)+1;  if(_id>0)then{["punishmentevent", _id] call SPON_publishGlobalEvent;}}];
~1
_this = group hosg createUnit ["civilian", hosm2, [], 0, "form"]
_this addaction ["Rescue","rescue.sqs"]
_this addEventHandler ["killed",  {      _Killer = _this select 1;      _id=([man1,man2,man3,man4,man5,man6,man7,man8,man9,man10,man11,man12,man13,man14,man15,man16,man17,man18,man19,man20] find gunner _Killer)+1;  if(_id>0)then{["punishmentevent", _id] call SPON_publishGlobalEvent;}}];
~1
_this = group hosg createUnit ["civilian", hosm3, [], 0, "form"]
_this addaction ["Rescue","rescue.sqs"]
_this addEventHandler ["killed",  {      _Killer = _this select 1;      _id=([man1,man2,man3,man4,man5,man6,man7,man8,man9,man10,man11,man12,man13,man14,man15,man16,man17,man18,man19,man20] find gunner _Killer)+1;  if(_id>0)then{["punishmentevent", _id] call SPON_publishGlobalEvent;}}];
~1
_this = group hosg createUnit ["civilian", hosm4, [], 0, "form"]
_this addaction ["Rescue","rescue.sqs"]
_this addEventHandler ["killed",  {      _Killer = _this select 1;      _id=([man1,man2,man3,man4,man5,man6,man7,man8,man9,man10,man11,man12,man13,man14,man15,man16,man17,man18,man19,man20] find gunner _Killer)+1;  if(_id>0)then{["punishmentevent", _id] call SPON_publishGlobalEvent;}}];

exit

If anyone wants to give us a heads up.. feel free..
We'd sure appreciate any insight as to a solution that doesn't involve teleportation or something.. XD


« Last Edit: 28 Aug 2008, 15:08:22 by D007 »

Offline i0n0s

  • Former Staff
  • ****
Re: Arma says "Hey guess what, cars are civilians"
« Reply #1 on: 28 Aug 2008, 15:16:48 »
The trigger returns a list of civilians in the area.
So:
Code: [Select]
_empty = true;
{
    if (_x isKindOf "Man") exitWith {_empty = false};
} forEach _list;

Be aware not to do this code in the trigger because a trigger checks nearly every frame. So but that code in a script which checkes every minute or so.

Edit: Men to Man.
« Last Edit: 28 Aug 2008, 18:36:03 by i0n0s »

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Arma says "Hey guess what, cars are civilians"
« Reply #2 on: 28 Aug 2008, 16:05:07 »
@I0n0s: The correct class to look for is "Man", not "Men". Your system will also count corpses and ignore living civilians in vehicles, so...

@D007: All empty vehicles, objects and corpses are considered to be civilian, as well as living civilians and the vehicles they are driving, so you have to be careful. Yes, it is far from intuitive, but it is how it is (and yes, it is predictable if you know how it works).

As far as I'm aware, and based on a quick test, a trigger checks approximately every 0.5s (I'd guess it uses sleep 0.5, which can be slightly longer than 0.5 seconds, depending on your frame rate; "sleep 0.5" actually means, "wait exactly 0.5 seconds, then wait for the next frame"). I wouldn't be as worried as I0n0s regarding CPU load, as long as there weren't likely to be a lot of civilians in the area.
Code: (trigger condition, firing when there are no living civilians in the area, either on foot or in vehicles, assuming that the trigger is CIVILIAN PRESENT) [Select]
civsRemaining = 0; { civsRemaining = civsRemaining + ({ alive _x } count (crew _x)) } forEach thisList; civsRemaining == 0

Bearing in mind making things predictable, please don't use _this as a normal local variable. You will only confuse people who know what it is supposed to be used for (it is used correctly inside the event handlers). Always use meaningful variable names, such as _newUnit in this case, when you want to make use of a variable; _this is specifically used for passing parameters into functions.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Arma says "Hey guess what, cars are civilians"
« Reply #3 on: 28 Aug 2008, 16:11:38 »
The crew command works on MAN? But isNull MAN's driver,gunner and commander? It would explain a great deal about my life.

For ArmA, I suppose animals will also be civilians?
« Last Edit: 28 Aug 2008, 16:19:42 by Mr.Peanut »
urp!

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Arma says "Hey guess what, cars are civilians"
« Reply #4 on: 28 Aug 2008, 17:41:49 »
Yes, a man has one crew-member: himself. BIS know best, though it does make some code simpler :whistle:

I have no idea about the side of a creature, but I seriously doubt if the ArmA creatures would be pulled in by even a civilian trigger, since they are purely decorative. For ArmA 2, the "real" beasts would probably be civilians, but that is anybody's guess.
« Last Edit: 28 Aug 2008, 17:44:05 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Arma says "Hey guess what, cars are civilians"
« Reply #5 on: 28 Aug 2008, 18:18:18 »
But is a man cargo or driver of himself  :)
urp!

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Arma says "Hey guess what, cars are civilians"
« Reply #6 on: 28 Aug 2008, 18:38:44 »
Come to OFPEC and ask the great philosophical questions of our time... :dunno:
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)