Curatalo 0 Posted April 14, 2009 (edited) So, I made a "Detain Civilian" script on my own. And it works great on SP. But on Multiplayer, only the person who triggered the "Detain Civilian" Action can se it. And on MP the Civilian can still run around, even while doing the animation. Heres what I have: a1 switchmove"ActsPercMstpSnonWnonDnon_ArrestingMan"; sleep 17; a1 switchmove"ActsPercMstpSnonWnonDnon_ArrestingManLoop"; sleep 1; [a1, 15] execVM "freeze.sqf"; sleep 15; The Freeze.sqf script it uses was not made by me! But the code for that is private ["_man", "_retro", "_tempo","_pos","_dir","_mov"]; _man = _this select 0; _retro = _this select 1; _pos = position _man; _dir = direction _man; _mov = animationState _man; _tempo = (time + _retro); while {alive _man && time < _tempo} do { _man setpos _pos; _man setdir _dir; _man switchmove _mov; sleep 0.01; }; If somebody would like to help me get it MP Freindly. Keep it mind this is the first "script" I have ever even thought of making. Thanks for you're time. Sorry Ive been posting so much here! Im just goin all out for a big mission. *EDIT* I think these anims require QG. Just keep that in mind. Edited April 14, 2009 by Curatalo Share this post Link to post Share on other sites
snkman 351 Posted April 15, 2009 MP and SP are two different worlds. In SP everything is local to the machine who is playing the mission. In MP units which are not leaded by a player are local to the server. Some MP Examples: YourScript.sqf _man = _this select 0; _man switchmove"ActsPercMstpSnonWnonDnon_ArrestingMan"; sleep 17; _man switchmove"ActsPercMstpSnonWnonDnon_ArrestingManLo op"; sleep 1; [_man, 15] execVM "freeze.sqf"; sleep 15; Example 2 Civilians: 1. Civilian: In the Initializing field of the 1. Civilian which should use the "Freeze" script put: Civilian01 = this; Now the Global Name of the Civilian ( Which can be used by the Player and Server ) is "Civilian01". 2. Civilian: In the Initializing field of the 2. Civilian which should use the "Freeze" script put: Civilian02 = this; Now the Global Name of the Civilian ( Which can be used by the Player and Server ) is "Civilian02". Init.sqf of your mission: [Civilian01,Civilian02] execVM "YourScript.sqf"; A way easyer way is: In the Initializing field of the civilian/unit which should use the "Freeze" script put: freeze = [this] execVM "YourScript.sqf"; By a Trigger: Create A Trigger. Set the size of the trigger as far as you need to cover all "Civilians" you like to use with the script. Activated by: "Civilian" On Activated: {[_x] execVM "YourScript.sqf"} forEach thisList Now every Civilian which is covered by the trigger do run the "Freeze" script. Change Activated by to "Bluefor" and all "Blufore" units which are covered by the trigger do run the "Freeze" script. Check the Example Mission i made: Freeze Example By the way: I think there is no nee to say sorry becouse you ask questions. This forum section was made for questions like this. ;) Share this post Link to post Share on other sites
Curatalo 0 Posted April 15, 2009 Thank you so much SNKMAN! Question: on the _man = _this select 0; _man switchmove"ActsPercMstpSnonWnonDnon_ArrestingMan"; sleep 17; _man switchmove"ActsPercMstpSnonWnonDnon_ArrestingManLo op"; sleep 1; [_man, 15] execVM "freeze.sqf"; sleep 15; is the name of the unit _man? I dont exactly get this. Share this post Link to post Share on other sites
snkman 351 Posted April 15, 2009 Not a problem. ;) Nope "_man" is a variable. A variable is a container that stores things. Every unit which do execute "for example" the "YourScript.sqf" script will be stored in the variable _man. This means if you have 5 units which had execute "YourScript.sqf" then the variable _man do contain all 5 units. Another Example: I told you to call the script with freeze = [this] execVM "YourScript.sqf"; The [this] is the unit and in "YourScript.sqf" you select this unit by _this select 0. _this select 0 do pick the first entry of an array. Also some interesting things you may like to read at the bisstudio.wiki: Variables Array Share this post Link to post Share on other sites
Curatalo 0 Posted April 16, 2009 (edited) EDIT* Thank you so much! Im pretty sure its working!Ill find out tomorrow when I test it online. Thanks alot SNKMAN!* -Old Post below- So here is my setup. Trigger- On Activation : None, Present, Once Condition: playerside == west && ( { ( _x distance a1 )<2 }count( units group player ) )>0 On Activation : detain1 = a1 addAction[ "Detain Civilian","detaina1.sqf" ]; On Deact: (blank) [This trigger is so that only US can activate the script via action menu.] Then I have a civilian named "a1"; Then in the "detaina1.sqf", I have this : a1 switchmove"ActsPercMstpSnonWnonDnon_ArrestingMan"; sleep 17; a1 switchmove"ActsPercMstpSnonWnonDnon_ArrestingManLoop"; sleep 1; [a1, 15] execVM "freeze.sqf"; sleep 15; a1 switchmove"Normal"; Which you told me to replace with this: _man = _this select 0; _man switchmove"ActsPercMstpSnonWnonDnon_ArrestingMan"; sleep 17; _man switchmove"ActsPercMstpSnonWnonDnon_ArrestingManLo op"; sleep 1; [_man, 15] execVM "freeze.sqf"; sleep 15; I did this for 10 units. (a1,a2,a3,a4,a5,a6,etc.) So to have near that exact steup (so i know how to do it on my own), could you just give me an example of what to do, just for 1 unit? Im not getting exactly how "_man" can exec it at different times for all the units i want. P.S- I Really couldnt thank you enough. Edited April 16, 2009 by Curatalo Share this post Link to post Share on other sites
Curatalo 0 Posted April 16, 2009 No, its not working online still. Only the person that used the 'Detain Civilian' action can se it. the civilian and others around him cannot. Share this post Link to post Share on other sites
snkman 351 Posted April 16, 2009 Check this Example Mission: Detain Example I will have a look into the MP stuff tomorrow. The command "addAction" and "Player" are local command's so in MP they are not avalible on the server. Share this post Link to post Share on other sites
Curatalo 0 Posted April 18, 2009 Thanks for that detain example mission, thats pretty much exactly what I had except for the ending up the distance line in the Condition. I just really need the MP to get working. Its for an Afghan based BlackWater-ish RPG mission. I'd imagine alot of other missions will use it also. Thanks for all you're help, truly. I owe you somthing. Share this post Link to post Share on other sites
snkman 351 Posted April 18, 2009 Ok here we go: Detain MP compatible Init.sqf Client/Player: This is a array which includes all players able to detain a unit. [color="Blue"]Detain_Player_Array = [[color="Red"]p1,p2,p3[/color]];[/color] This array makes sure, that the detain action is only triggered once till its completly finished. [color="Blue"]Detain_Busy_Array = [];[/color] Server: Execute the "addAction" check. Note: [color="Blue"][[color="Red"]d1,d2,d3[/color]][/color] are all units which can have the action. [color="Blue"]{[_x] execVM "Detain_Action.sqf"} forEach [[color="Red"]d1,d2,d3[/color]];[/color] This array makes sure, that a action is added only once. [color="Blue"]Detain_Action_Array = [];[/color] NOTE: On the Server the detain units do not stop completly. It looks a bit strange, but that's how ArmA handle it. Doing stuff with animations on the Server always is a little bit freaky. Detain Example MP Share this post Link to post Share on other sites