Jump to content

G4meM0ment

Member
  • Content Count

    79
  • Joined

  • Last visited

  • Medals

Community Reputation

1 Neutral

1 Follower

About G4meM0ment

  • Rank
    Corporal

core_pfieldgroups_3

  • Interests
    Gaming, scripting
  • Occupation
    Pupil

Contact Methods

  • Skype
    thonak
  • Biography
    I'm just a pupil like playing games, and scripting.
  • Youtube
    http://www.youtube.com/G4meM0ments
  1. Appears the list of commands became longer since ArmA 2 :P Anyway the scripts in the missions are limited in some way, so for example u won't download ACE or JSRS from the mission files (I know because they got tons of .paa's, p3d's and however the sound files were called) I need some kind of point to start my scripts with, so in the list of commands there a few "on[Event]" commands, so I can use those to listen to some events? But there're missing a lot of events... (Or just for testing and learning, how would u listen for a gun fired?)
  2. Hello community, I already coded plugins/mods for other games, lets pick a easy example: mc/bukkit, where I had a good workin API which provided a event/listener system to hook up into the game mechanics. So for example I listened for a "PlayerDamageEvent" and displayed a message when those event has been fired. What I need to know now, how to hook up into ArmA... I already unpacked some mods, looked threw the sqfs and tried to figure out the point where the script is triggered, but it seems to work otherwise than I'm used to it. So, for example, how to "listen" for a player fired his rifle? Or how to schedule a repeating task to recheck things (would that be done otherwise within ArmA?)? I actually need no general help how to code Addons, but some kind of startup help, to get the general idea of ArmA Addons. Thanks in advance :)
  3. But I think he don't get all these vars you added to private, is he?
  4. Yes switch/case would be better, but it wouldn't fit the scope problem, would it? I tried this, but it don't works: scopeName "main"; while {(_playerCounter +1) < (count _playerArray)} do { //checks if the unit is a player if(vehicle (_playerArray select _playerCounter) == player) then { //checks which unit is detected and starts his script while{_playerCounter == 0 && _p1isP == 0} do { execVM "Scripts\Player\p1 start.sqf"; _p1isP = 1; //jumps to the end _playerCounter = _playerCounter +1; breakTo "main"; }; ... } else { hint "else"; //if the unit isn't a player an AI script will be started while{_playerCounter == 1 && _sec_player != 1 && _third_player != 1 && _fourth_player != 1} do { execVM "Scripts\Player\AI2 init.sqf"; _p2isP = 0; _playerCounter = _playerCounter +1; breakTo "main"; }; while{_playerCounter == 2 && _sec_player != 2 && _third_player != 2 && _fourth_player != 2} do { execVM "Scripts\Player\AI3 init.sqf"; _p3isP = 0; // if(_nc > 300) then {hint "Killed 3"};//KILL AI SCRIPT hint "AI 3 found"; _playerCounter = _playerCounter +1; breakTo "main"; }; while{_playerCounter == 3 && _sec_player != 3 && _third_player != 3 && _fourth_player != 3} do { execVM "Scripts\Player\AI4 init.sqf"; _p4isP = 0; // if(_nc > 300) then {hint "Killed 4"};//KILL AI SCRIPT hint "AI 4 found"; _playerCounter = _playerCounter +1; breakTo "main"; }; }; };
  5. Forgot to say you should use switchMove :P
  6. Maybe the stand up move? May use this one: AdthPercMstpSnonWnonDnon_3 dies, falling forward and then: AinjPpneMstpSnonWrflDnon_rolltoback (I would use here sleep 3.5; to make it look like one animation) at least: AidlPpneMstpSnonWnonDnon_SleepA_standUp - Standing up from lying on back
  7. G4meM0ment

    Spawn a ENEMY Ai ??

    Just change the 0 to about 20 or more then he will spawn in a 20 meter radius around your position.
  8. I got the same problem not sure, what the problem was, never found a reason, maybe something with the primary Weapon. Anyone else maybe know?
  9. Why? I ask if the one who is getting checked is == player if not shouldn't it jump over to else?
  10. Yes here I got an example script for you. _this addEventHandler ["GetIn", { _veh = _this select 0; _pos = _this select 1; _unit = _this select 2; _type = typeOf _unit; _vehType = typeOf _veh; _crew = ["US_Soldier_Crew_EP1"]; _pilot = ["US_Soldier_Pilot_EP1"]; _medic = ["US_Soldier_Medic_EP1"]; _medVeh = ["M1133_MEV_EP1", "UH60M_MEV_EP1", "HMMWV_Ambulance_CZ_DES_EP1", "HMMWV_Ambulance_DES_EP1"]; _kick = false; if (_veh iskindOf "Tank" AND !(_type in _crew)) then {_kick = true}; if ((_vehType in _medVeh) AND !(_type in _medic)) then {_kick = true}; if (_veh iskindOf "Air" AND !(_type in _pilot)) then {_kick = true}; if ((_vehType in _medVeh) AND (_type in _medic)) then {_kick = false}; if (_pos == "driver") then { if (_kick) then { if (isEngineOn _veh) then {_veh engineOn false}; unassignVehicle _unit; _unit action ["Eject", _veh]; if (_unit == player) then { hint format["%1 you aren't trained to operate this vehicle",name player]; }; }; } else { if (_kick) then { _allowed = _unit spawn { _veh = vehicle _this; while {alive _this AND (vehicle _this) == _veh} do { if (alive _this AND (vehicle _this) == _veh AND (driver _veh) == _this) then { if (isEngineOn _veh) then {_veh engineOn false}; unassignVehicle _this; _this action ["Eject", _veh]; if (_this == player) then { hint format["%1 you aren't trained to operate this vehicle",name player]; }; }; sleep 1; }; }; }; }; }]; For sure you need to edit this and check if it's a special player instead of an admin (or all your admins playing a special type of unit). Dont know if this will work with the gate, you should try.
  11. There is still another problem too, if the players 2,3,4 arent used (I tried this out in sp (preview)) the script will never go into the "else"-part of the statement in line 16. I set these units as playable but it doesnt seems to matter if theyre playable or not... _playerArray = [dummy1, p2, p3, p4]; _playerCounter = 0; //Variables to check if this unit is a player or not and which player _sec_player = 0; _third_player = 0; _fourth_player = 0; _p1isP = 0; _p2isP = 0; _p3isP = 0; _p4isP = 0; //stands for newcomer this counter counts until 300 after that 2 units will die _nc = 0; scopeName "main"; while {(_playerCounter +1) < (count _playerArray)} do { //checks if the unit is a player if(vehicle (_playerArray select _playerCounter) == player) then { //<---- LINE 16 //checks which unit is detected and starts his script if(_playerCounter == 0 && _p1isP == 0) then { execVM "Scripts\Player\p1 start.sqf"; _p1isP = 1; //jumps to the end breakTo "end"; }; if(_playerCounter == 1 && _p2isP == 0) then { execVM "Scripts\Player\p2 start.sqf"; hint "Player 2 found"; if (_p2isP == 0) then { if(_sec_player < 1) then {_sec_player = 1; _p2isP = 1; breakTo "end";}; if(_third_player < 1) then {_third_player = 1; _p2isP = 1; breakTo "end";}; if(_fourth_player < 1) then {_fourth_player = 1; _p2isP = 1; breakTo "end";}; _p2isP = 1; }; }; if(_playerCounter == 2 && _p3isP == 0) then { execVM "Scripts\Player\p3 start.sqf"; hint "Player 3 found"; if (_p3isP == 0) then { if(_sec_player < 1) then {_sec_player = 2; _p3isP = 1; breakTo "end";}; if(_third_player < 1) then {_third_player = 2; _p3isP = 1; breakTo "end";}; if(_fourth_player < 1) then {_fourth_player = 2; _p3isP = 1; breakTo "end";}; _p3isP = 1; }; }; if(_playerCounter == 3 && _p4isP == 0) then { execVM "Scripts\Player\p4 start.sqf"; hint "Player 4 found"; if (_p3isP == 0) then { if(_sec_player < 1) then {_sec_player = 3; _p4isP = 1; breakTo "end";}; if(_third_player < 1) then {_third_player = 3; _p4isP = 1; breakTo "end";}; if(_fourth_player < 1) then {_fourth_player = 3; _p4isP = 1; breakTo "end";}; _p4isP = 1; }; }; } else { //<--- THE ELSE-PART hint "else"; //if the unit isn't a player an AI script will be started if(_playerCounter == 1 && _sec_player != 1 && _third_player != 1 && _fourth_player != 1) then { execVM "Scripts\Player\AI2 init.sqf"; _p2isP = 0; breakTo "end"; }; if(_playerCounter == 2 && _sec_player != 2 && _third_player != 2 && _fourth_player != 2) then { execVM "Scripts\Player\AI3 init.sqf"; _p3isP = 0; // if(_nc > 300) {hint "Killed 3"};//KILL AI SCRIPT hint "AI 3 found"; breakTo "end"; }; if(_playerCounter == 3 && _sec_player != 3 && _third_player != 3 && _fourth_player != 3) then { execVM "Scripts\Player\AI4 init.sqf"; _p4isP = 0; // if(_nc > 300) {hint "Killed 4"};//KILL AI SCRIPT hint "AI 4 found"; breakTo "end"; }; }; //if anything had been detected the script will jump to this point and repeat to check the next unit scopeName "end"; _playerCounter = _playerCounter +1; }; //5 min after the game started unit 3 & 4 will be available to be played by an player after that they get killed while{_nc <= 300} do { _nc = _nc +1; sleep 1; _playerCounter = 0; breakTo "main"; }; //simply restarts the script and checks all units again while {true} do { sleep 1; _playerCounter = 0; breakTo "main"; }; ---------- Post added at 23:58 ---------- Previous post was at 23:56 ---------- Sry I'm not so familiar with that linguistic scripting languages, sorry for that but I just posted the real problem...
  12. I found that too, but there is a problem with the "if(_nc > 300) {};//KILL AI SCRIPT" it says ; is missing.
  13. I figured the problem out, yes you were right, and it needed to be if ( vehicle .... == player). But now I got a new problem I want to use this script to check if a player joined or if an script is needed to handle this unit. I use it in the init.sqf with the statement if(!isServer) exeitWith{}; but it don't works my debug just tells me "reached main" but it doesn't seems to reach the while loop. May you have an idea what's going wrong? _playerArray = [dummy1, p2, p3, p4]; _playerCounter = 0; //Variables to check if this unit is a player or not and which player _sec_player = 0; _third_player = 0; _fourth_player = 0; _p1isP = 0; _p2isP = 0; _p3isP = 0; _p4isP = 0; //stands for newcomer this counter counts until 300 after that 2 units will die _nc = 0; hint "reached main"; scopeName "main"; while {(_playerCounter +1) < (count _playerArray)} do { hint "reached while"; //checks if the unit is a player if(vehicle (_playerArray select _playerCounter) == player) then { //checks which unit is detected and starts his script if(_playerCounter == 0 && _p1isP == 0) then { hint "Player 1 found"; execVM "Scripts\Player\p1 start.sqf"; _p1isP = 1; //jumps to the end breakTo "end"; }; if(_playerCounter == 1 && _p1isP == 0) then { execVM "Scripts\Player\p2 start.sqf"; _p2isP = 1; if (_p2isP == 0) then { if(_sec_player < 1) then {_sec_player = 1; _p2isP = 1; breakTo "end";}; if(_third_player < 1) then {_third_player = 1; _p2isP = 1; breakTo "end";}; if(_fourth_player < 1) then {_fourth_player = 1; _p2isP = 1; breakTo "end";}; }; }; if(_playerCounter == 2 && _p1isP == 0) then { execVM "Scripts\Player\p3 start.sqf"; _p3isP = 1; if (_p3isP == 0) then { if(_sec_player < 1) then {_sec_player = 2; _p3isP = 1; breakTo "end";}; if(_third_player < 1) then {_third_player = 2; _p3isP = 1; breakTo "end";}; if(_fourth_player < 1) then {_fourth_player = 2; _p3isP = 1; breakTo "end";}; }; }; if(_playerCounter == 3 && _p1isP == 0) then { execVM "Scripts\Player\p4 start.sqf"; _p3isP = 1; if (_p3isP == 0) then { if(_sec_player < 1) then {_sec_player = 3; _p4isP = 1; breakTo "end";}; if(_third_player < 1) then {_third_player = 3; _p4isP = 1; breakTo "end";}; if(_fourth_player < 1) then {_fourth_player = 3; _p4isP = 1; breakTo "end";}; }; }; else { //if the unit isn't a player an AI script will be started if(_playerCounter == 1 && _sec_player != 1 && _third_player != 1 && _fourth_player != 1) then { execVM "Scripts\Player\AI2 init.sqf"; _p2isP = 0; breakTo "end"; }; if(_playerCounter == 2 && _sec_player != 2 && _third_player != 2 && _fourth_player != 2) then { execVM "Scripts\Player\AI3 init.sqf"; _p3isP = 0; if(_nc > 300) {};//KILL AI SCRIPT breakTo "end"; }; if(_playerCounter == 3 && _sec_player != 3 && _third_player != 3 && _fourth_player != 3) then { execVM "Scripts\Player\AI4 init.sqf"; _p4isP = 0; if(_nc > 300) {};//KILL AI SCRIPT breakTo "end"; }; }; //if anything had been detected the script will jump to this point and repeat to check the next unit scopeName "end"; _playerCounter = _playerCounter +1; }; //5 min after the game started unit 3 & 4 will be available to be played by an player after that they get killed while{_nc <= 300} do { _nc = _nc +1; sleep 1; _playerCounter = 0; breakTo "main"; }; //simply restarts the script and checks all units again while {true} do { sleep 1; _playerCounter = 0; breakTo "main"; }; ---------- Post added at 20:33 ---------- Previous post was at 20:28 ---------- I need to add that there is no error.
  14. I used execVM in the init to call this script, it's used to indetify the players and execute different scripts for each player. _playerArray = ["p1", "p2", "p3", "p4", "dummy1"]; _playerCounter = 0; while {(_playerCounter +1) < (count _playerArray)} do { if ((_playerArray select _playerCounter) == player) then { // if(_playerCounter == 0) then { // execVM "Scripts\Player\p1 start.sqf"; // }; if(_playerCounter == 1) then { execVM "Scripts\Player\p2 start.sqf"; }; if(_playerCounter == 2) then { execVM "Scripts\Player\p3 start.sqf"; }; if(_playerCounter == 3) then { execVM "Scripts\Player\p4 start.sqf"; }; if(_playerCounter == 4) then { execVM "Scripts\Player\p1 start.sqf"; }; }; _playerCounter = _playerCounter +1; }; The problem I get this errror... Error in expression <f ((_playerArray select _playerCounter) == player) then { hint "Is Player"; i> Error position: <== player) then { hint "Is Player"; i> Error Generic error in expression Absolutly now clue whats wrong... sorry if it's just a dump careless mistake. Thank you for the help :) Greets Julian
  15. Can you exlpain me why? Because I used this boolean to check if it has been already counted.
×