Jump to content
Sign in to follow this  
majinbot

Civilian become Enemy

Recommended Posts

I want a civilian attack me after a pick up (and deletevehicle) an evidence:

civian init:

nul = [this] execvm "script.sqf";

An east "enemy" with 0% probabilty of presence

script.sqf:

private ["_x"];
_x = _this select 0;

if ((alive _x) and (isNull evidence)) then 
{     
   [_x] JoinSilent enemy;
   _x say "allahu";
   _x setskill 0.9; 
   _x reveal player;
   _x addMagazine "30Rnd_9x19_UZI";
   _x addMagazine "30Rnd_9x19_UZI";
   _x addMagazine "30Rnd_9x19_UZI";
   _x addMagazine "30Rnd_9x19_UZI";
   _x addWeapon "UZI_EP1";
   _x selectWeapon "UZI_EP1";
   _x SetBehaviour "Careless";
   _x doTarget player;
   _x SetUnitPos "Up";
   _x SetSpeedMode "Full";
   _x SetCombatMode "Red";
   _x doFire player;

};

(isNull evidence) doesn't seem to work, if i delete this the script works but the civilian doesn't attack me if a don't try to shoot him, he only escapes?!?!

Help needed!!!

Share this post


Link to post
Share on other sites

I hope this is not a useless suggestion, but shouldn't you not use the variable "_x"? I though calling magic variables and scripting commands as private and using them causes issues. Maybe use "_civilian" instead.

Also, why do you need to group him with "enemy"? Shouldn't he fire at you regardless of wether or not he is friendly when you use the "doFire" command?

I think the issue may be that you have placed "enemy" somewhere far from the civilian, and as soon as the civilian joins "enemy" he runs back to the position of his group leader (even though he doesn't exist). Could this possible be the problem?

One more thing. For the "gorup civilian with zero probability enemy" trick to work, the enemy needs to have a significantly higher rank than the civilian.

Hope my tips helped...

Share this post


Link to post
Share on other sites

1. Don't use "_x." It is generally reserved as a special variable in forEach statements. It may work anyway, but it's bad practice and can easily get confusing.

2. There is no loop in this script. That means that it will check the conditions of the if statement once and then proceed to the end and terminate. Since the conditions in this case are not initially true, the contents of the if statement will never be executed.

3. Joining the group of a unit that doesn't exist probably won't work (it only works when setup in the editor because the group join occurs before the unit is deleted). Use [_civDude] join (createGroup east) instead.

4. As for "evidence," what is it, exactly? Is it an object?

Share this post


Link to post
Share on other sites

To shoot at West, you can make Resistance unfriendly to West and group the civilian unit with Resistance, or you could group them to East side.

3. an alternative is to set the probabilty of presence slider of the officer to Zero.

4. When you start the mission, the officer won't be there as he is deleted, but the civvies think they are East, will take over command and follow all waypoints, and fire on anyone on the opposite side

-----------------

I found it here: http://community.bistudio.com/wiki/Side_relations

Thanks for your help, I didn't know about _x and I'll try join (createGroup east) as soon as possible. Evidence is a small object (map) with addAction to pick up and deletevehicle to erase the object, i don't understand why isNull doesn't work.

Share this post


Link to post
Share on other sites

When you say "isNull doesn't work," do you mean that it causes an error? If so, what is the error message?

Share this post


Link to post
Share on other sites

An alternative would be to have a trigger or something that when the player picks up the evidence, you change the player's persona to an enemy side. That can be effective.

Share this post


Link to post
Share on other sites

He using _x because of mine own script which he forgot to mention.

That script has some bugs, and force civilian to attack for real on player via that is pretty unpredicteble. But that was my target in my script. Make civilians unpredictable.

more info and structure here.

Make a Civilians dangerous to a player

Share this post


Link to post
Share on other sites
He using _x because of mine own script which he forgot to mention.

That script has some bugs, and force civilian to attack for real on player via that is pretty unpredicteble. But that was my target in my script. Make civilians unpredictable.

more info and structure here.

Make a Civilians dangerous to a player

Sorry i had to mention, but I took only a part of your script to spare time, I never said "i created a script". Anyway i changed everything, now i spawn 2 enemies instead and with "attachto" i connected a trigger (bluefor present) with the object, cause if (isNull evidence) or if (evidence = objNull) don't work in the script.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×