De_little_Bubi
Jun 7 2009, 23:09
Yeah made my first real own script^^
Wanted a little door "open/close" script. Just lower the objects under the map and back again. (i used the hiik script from Cyborg11 to learn the basics, thx)
Now the Problem: in singleplayer it works very goot but if im using it in multiplayer, only i (server and squadleader) can use it.
If somebody else is using it, the action gets removed from the action menu but nothin else happend.
Is there any special stuff to do for clients?
// ********************************************
// Script File for ArmA2
// Made by: De_little_Bubi
// Version: 0.9
// ********************************************
// Add Action in the Init of the door terminal:
// this addaction ["Oeffne Tor","door.sqf",[false,HEIGHT,STEP_HEIGHT,OBJECT_COUNT,DOOR_OBJECT1,DOOR_OBJECT2,...]];
_terminal = _this select 0;
_action = _this select 2;
_params = _this select 3;
//State of the door, true = open, false = closed
_state = _params select 0;
//Height of the door
_height = _params select 1;
//Stepheight - the height the door should be lowered each step
_step = _params select 2;
//Amount of Objects the door is using
_door_obj_count = _params select 3;
//Get all the objects out of the params
_door_objs = [];
for "_x" from 0 to _door_obj_count-1 do {
_door_objs = _door_objs + [_params select _x+4];
};
//Determine the count of steps we need to lower the door
_count = _height / _step;
//Remove the old action from the terminal before the long lower process starts => no double action
_terminal removeaction _action;
//Set the new door state in the paramlist
_params set [0, !_state];
//Initialize the data array for new action
_new_action = ["","door.sqf"];
_new_action set [2,_params];
_hint = "";
if (!_state) then {
_hint = "Tor geoeffnet";
_new_action set [0, "Schliesse Tor"];
//If door should be opened -> lower the door ( negativ value )
_step = _step * -1;
} else {
_hint = "Tor geschlossen.";
_new_action set [0, "Oeffne Tor"];
};
//Lower,Upper the door
//For each step
for "_y" from 0 to _count do {
//For each door object
for "_x" from 0 to _door_obj_count-1 do {
//Lower/Upper the Object
_door_obj = _door_objs select _x;
_door_obj setPos [ getPos _door_obj select 0, getPos _door_obj select 1, (getPos _door_obj select 2) + _step];
};
//Wait 50ms
sleep 0.05;
hint "ACHTUNG - TOR WIRD BEWEGT";
};
//Door open/closed, add new action to the terminal
hint _hint;
_terminal addaction _new_action;
Wanted a little door "open/close" script. Just lower the objects under the map and back again. (i used the hiik script from Cyborg11 to learn the basics, thx)
Now the Problem: in singleplayer it works very goot but if im using it in multiplayer, only i (server and squadleader) can use it.
If somebody else is using it, the action gets removed from the action menu but nothin else happend.
Is there any special stuff to do for clients?
// ********************************************
// Script File for ArmA2
// Made by: De_little_Bubi
// Version: 0.9
// ********************************************
// Add Action in the Init of the door terminal:
// this addaction ["Oeffne Tor","door.sqf",[false,HEIGHT,STEP_HEIGHT,OBJECT_COUNT,DOOR_OBJECT1,DOOR_OBJECT2,...]];
_terminal = _this select 0;
_action = _this select 2;
_params = _this select 3;
//State of the door, true = open, false = closed
_state = _params select 0;
//Height of the door
_height = _params select 1;
//Stepheight - the height the door should be lowered each step
_step = _params select 2;
//Amount of Objects the door is using
_door_obj_count = _params select 3;
//Get all the objects out of the params
_door_objs = [];
for "_x" from 0 to _door_obj_count-1 do {
_door_objs = _door_objs + [_params select _x+4];
};
//Determine the count of steps we need to lower the door
_count = _height / _step;
//Remove the old action from the terminal before the long lower process starts => no double action
_terminal removeaction _action;
//Set the new door state in the paramlist
_params set [0, !_state];
//Initialize the data array for new action
_new_action = ["","door.sqf"];
_new_action set [2,_params];
_hint = "";
if (!_state) then {
_hint = "Tor geoeffnet";
_new_action set [0, "Schliesse Tor"];
//If door should be opened -> lower the door ( negativ value )
_step = _step * -1;
} else {
_hint = "Tor geschlossen.";
_new_action set [0, "Oeffne Tor"];
};
//Lower,Upper the door
//For each step
for "_y" from 0 to _count do {
//For each door object
for "_x" from 0 to _door_obj_count-1 do {
//Lower/Upper the Object
_door_obj = _door_objs select _x;
_door_obj setPos [ getPos _door_obj select 0, getPos _door_obj select 1, (getPos _door_obj select 2) + _step];
};
//Wait 50ms
sleep 0.05;
hint "ACHTUNG - TOR WIRD BEWEGT";
};
//Door open/closed, add new action to the terminal
hint _hint;
_terminal addaction _new_action;