Jump to content
Freebie

Make AI carry briefcase. Possible?

Recommended Posts

Hi, I'm making a MP mission for me and a acouple of friends and in part of it I would like for this to happen...

We're looking around town for a certain AI individual who is believed to have some evidence that we would like to get our hands on.

We see said individual running away carrying a briefcase.

He is shot and killed by one of us and we go over to his body where one of us picks up the briefcase.

In the briefcase we find the information we want.

Now I know nothing about scripting but I've done some searching and found this script by someone else which allows you (as a player) to pick up (and drop) the briefcase through the addaction menu by placing this in the briefcase's init line

this addAction ["Take case","case.sqf","take"]; caseholder = objNull

and placing this in an case.sqf file in the mission folder

_o = _this select 0;
_p = _this select 1;

switch (_this select 3) do {
 case "take": {
   caseholder = _p;
   publicvariable "caseholder";
   deletevehicle _o;
   _id = _p addaction ["Drop case","case.sqf","drop"];

       while {sleep 3; alive _p && caseholder == _p} do {
     "markerCase" setmarkerpos getpos _p;
   };
   _p removeaction _id;

   _o = "Suitcase" createvehicle [1,1,1];
   _o setposasl getposasl _p;
   _o setvehicleinit "this addaction [""Take case"",""case.sqf"",""take""]";
   _o setvehicleinit "player reveal this";
   processInitCommands;
 };
 case "drop": {
   _p removeaction (_this select 2);
   caseholder = objnull;
   publicvariable "caseholder";
 };
};

But that still leaves me with the following to be done...

1. How do you make an AI hold a briefcase in his hand? Plus this guy's going to be running so will the briefcase move with his hand as it moves and look realistic? This is the part that I'm hoping is possible but I've got big doubts about :pray:

2. How do you make the AI drop the briefcase next to him when he gets shot and killed? (so then one of us can pick it up)

3. How can I add another addaction menu of "Open Briefcase?" to whoever picks the briefcase up? in order to then do a "hint" of what info is found inside. Could the case.sqf file even be altered to do this?

Thanks, and sorry for all the questions :o

Share this post


Link to post
Share on other sites

scase is the case name and man is the unit name

 scase attachto [man, [-0.03,-.105,-0.27], "RightHandMiddle1"];
        scase setdir 90;

To Drop you can do something like this called from a trigger or script

in a trigger

conditiion !alive man

on act

man removeAction act2;
detach scase;
scase setvelocity[0,0,1];

I add a little velocity as it sometimes sticks in the air.

Edited by F2k Sel

Share this post


Link to post
Share on other sites

Sel beat me to #1

2: Trigger example:

Condition:

!alive UnitName

OnAct:

detach BriefcaseName;

Share this post


Link to post
Share on other sites

also if a unit gets in a vehicle you you can use scase hideobject true and then scase hideobject false when he gets out otherwise it will look silly

Share this post


Link to post
Share on other sites

Thanks very much for your help guys! That worked a treat. :) And I just added a seperate addAction to the briefcase for the open briefcase / hint "whats inside blah blah" thing.

Ok if I can push my luck a little I have one more question...

I'd like to use the Ambient Civilian module/s in the editor to place civies around a takistani town. But after searching I see quite a few using it, but no explanation on how to implement it properly. I tried just placing the modules over a town and even tried a couple of extra things that seem to be vaguely mentioned in one post but still no luck. I'm afraid my lack of experience just can't fill in the necessary blanks :o

Is there any chance that you could explain (in a newbie way) how to get these modules to actually work. That would be great :)

Share this post


Link to post
Share on other sites

where do you put this command?

 scase attachto [man, [-0.03,-.105,-0.27], "RightHandMiddle1"];
        scase setdir 90;

I put it in the init of the suitcase and its just sits on the ground then falls over.

-Bigshot

Share this post


Link to post
Share on other sites
where do you put this command?

 scase attachto [man, [-0.03,-.105,-0.27], "RightHandMiddle1"];
        scase setdir 90;

I put it in the init of the suitcase and its just sits on the ground then falls over.

-Bigshot

Put it in the innit line of anything else but the suitcase.

Is it poss to make the suitcase a weaponholder so files can be placed inside it?

Share this post


Link to post
Share on other sites

It may work, I have used a weapon holder to place a weapon on a units back but I didn't check to see if it would hold items.

Share this post


Link to post
Share on other sites

@ Bigshot: I put that in the init line of the man. The suitcase has the addAction line in for the case.sqf file.

I found out that the ALICE module doesn't work unless it's over an actual town with a name on the map. I didn't know it doesn't work over non named settlements lol >.<

Do you have to place a module over every town you want? Or is there a way to just place one module and with a little scripting have several towns spawn civvies?

Share this post


Link to post
Share on other sites

Ok thank you!

About adding files to the suitcase, that depends on how you want it done.

1) You can add the selected item by putting this in the init of the suitcase:

removeallitems this; this addweapon "classname";

Now I'm not sure if that would work since the suitcase was proably not made with some sort of cargo space.

2) You can have a script fire when the case holder is killed. You can have the suitcase disappear and have a Notebook spawn where the case holder died, including some files and other things.

The notebook look like the suitcase but open so you can make it look like the suitcase popped open and its contents fell out.

Also about the ALICE module, you can place it anywhere on the map and it will spawn civilians randomly. But if you want it in a certain town then you have to place the module over a named town.

Just an idea for you guys to try..

-Bigshot

Edited by bigshotking
Added more info

Share this post


Link to post
Share on other sites

Ah ok no probs :D

What would be good is if you could just place the one module randomly on the map and sync it to some triggers or something around towns and have civvies spawn and populate a town if you're within the trigger radius. But disappear again once you're outside the radius.

Hmmmm I'm sure there'll be some way to do that....

Share this post


Link to post
Share on other sites
also if a unit gets in a vehicle you you can use scase hideobject true and then scase hideobject false when he gets out otherwise it will look silly

Can you write me whole command, how to make CONDITION in case when MAN is IN the car and when MAN is OUT of the car? And how to work repeatedly... :) Thank you!

Share this post


Link to post
Share on other sites
Can you write me whole command, how to make CONDITION in case when MAN is IN the car and when MAN is OUT of the car? And how to work repeatedly... :) Thank you!

The trigger conditions would be like this

size 0,0

repeating

none present

cond (vehicle player) != player

on act scase hideobject true;

on dea scase hideobject false;

However I never tried the script in the first post so it probably won't work.

This is the script I used myself.

save as init.sqf

In_out = createTrigger["emptyDetector",[0,0,0]];
In_out setTriggerArea [0,0,0,false]; 
In_out setTriggerActivation ["any","present",True]; 
In_out setTriggerStatements["(vehicle player) != player and take == 0","scase hideobject true;","scase hideobject false;"];

save as carry.sqf

//act1 = this addaction ["Take Case","carry.sqf",[0],1,false,true,"","side player == civilian"]


taken = _this select 3;
take = taken select 0;

switch (take) do
{
   case 0:
   {
    scase = _this select 0;
     _man = _this select 1;
     scase attachto [_man, [0.035,-.055,-0.22], "LeftHandMiddle1"];
      scase setdir 90;
       scase removeAction act1;
        act1 = _man addaction ["Drop Case","carry.sqf",[1],1,false,true,"","side player == civilian"];
         _man addEventHandler ["killed", "detach scase;_man removeeventHandler [""killed"",0]"];
   }; 

   case 1:
   {
      _man = _this select 0;
        detach scase;
         scase setvelocity[0,0,-.3];
          _man removeAction act1;
           act1 = scase addaction ["Take Case","carry.sqf",[0],1,false,true,"","side player == civilian"];
            _man removeeventHandler ["killed",0];
   };
};

Place this in the init box of the suitcase and name it scase

act1 = this addaction ["Take Case","carry.sqf",[0],1,false,true,"","side player == civilian"]

I've only tried it in single player and it's currently only set for civilians to use.

Share this post


Link to post
Share on other sites

guys, I've found this thread very helpful with my mission. I was wondering if I could add to it. Is it possible to have enemy AI wanting to get the suitcase, pick it up and then take it to a position?

Share this post


Link to post
Share on other sites

It's basically written just for one unit, Have a search around I believe someone has a more versatile 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

×