Jump to content

TurokGMT

Member
  • Content Count

    222
  • Joined

  • Last visited

  • Medals

Everything posted by TurokGMT

  1. firecount = 0 is a bit dodgy in init.sqf because it will set the global variable to 0 every time a client runs init/sqf (eg, every time a JIP player joins). The waituntil {local player} should work fine, but I normally use this instead: //=============== PLAYER SYNC ==================================== if ( (!isServer) && (player != player) ) then { waitUntil {player == player}; waitUntil {time > 10}; }; //============= END OF PLAYER SYNC =============================== what is firecount actually counting? If it's something like an ammo count or artillery rounds, it would nice to know whether you want it to be a personal thing for each player or a global thing for the mission. eg firecount increases by 1 for a client when detonating a satchel charge, but not for everyone else vs firecount increases by 1 for all players when an artillery barrage is launched by any player
  2. TurokGMT

    Respawning

    because you are respawning as a fresh unit. To ensure you spawn with the gear you previously had, you need to use a scripted event handler which retains a list of your kit (the only thing it can't do is keep track of exactly how many rounds you have in your current mag). Try this, it's in sqs format, but you could probably tweak it to do the same thing in sqf: ;Universal Weapons Respawn Script v1.04 (March 31, 2003) revised (February 1, 2007) ;Required Version: ArmA ;original by toadlife revised by norrin for ArmA ;toadlife@toadlife.net ;intialize like this: ["unitname",0] exec "weapons_respawn.sqs" ; Or this: ["unitname",1] exec "weapons_respawn.sqs" ; ; * "unitname" = The name of the player the script runs on (must be enclosed by quotes!) ; * 0/1 = method of repleneshing weapons ; **if method is 0, the player gets the same weapons he started out with every time ; **if method is 1, the player gets the same weapons he had when he died ; ; Advanced example method of initializing script - put the following lines in your init.sqs, ; and replce the unit names with your own: ;_units = ["w1","w2","w3","w4","w5","w6","w7","w8","w9","w10","w11","w12","w13","w14","w15","w16","w17","w18"] ;{[_x,0] exec "weapons_respawn.sqs"} foreach _units ; ; ~(random 0.3) _name = _this select 0 _method = _this select 1 _hasrifle = false _unit = call compile format["%1",_name] ?(_method == 0):_return = "checklocal";goto "guncheck" #checklocal _unit = call compile format["%1",_name] ?(local _unit):goto "respawnloop" ~(1 + (random 3)) goto "checklocal" #respawnloop @!alive _unit #checkmethod ?(_method == 1):_return = "waitforlife";goto "guncheck" #waitforlife @alive call compile format["%1",_name] _unit = call compile format["%1",_name] removeAllWeapons _unit ?_hasrifle:_guns = _guns - [_prigun];_guncount = count _guns _c = 0 while {_c <= (_magcount - 1)} do {_unit addmagazine (_mags select _c); _c = _c + 1} _c = 0 while {_c <= (_guncount - 1)} do {_unit addweapon (_guns select _c); _c = _c + 1} ?_hasrifle:_unit addweapon _prigun;_gun = _guns + [_prigun] ;//If unit has a rifle select it ?_hasrifle:goto "selectrifle" ;//No rifle - if unit has a pistol, select it ?_unit hasweapon ((weapons _unit - [secondaryweapon _unit,"Binocular","NVGoggles"]) select 0):_unit selectweapon ((weapons _unit - [secondaryweapon _unit,"Binocular","NVGoggles"]) select 0);goto "respawnloop" ;//No rifle or pistol, select secondary weapon _unit selectweapon secondaryweapon _unit goto "respawnloop" #selectrifle ;// BUG WORKAROUND! - Added to compensate for selectweapon bug ;// Any gun with more than one muzzle (grenadelaunchers) cannot be selected with selectweapon! ;// Default Grenadelaunchers supported - Add your own types if you need to. _unit selectweapon _prigun ?_prigun == "M16A2GL":_unit selectweapon "M16Muzzle" ?_prigun == "M16A4GL":_unit selectweapon "M16Muzzle" ?_prigun == "M16A4_ACG_GL":_unit selectweapon "M16Muzzle" ?_prigun == "M4GL":_unit selectweapon "M4Muzzle" ?_prigun == "M4A1GL":_unit selectweapon "M4Muzzle" ?_prigun == "AK74GL":_unit selectweapon "AK74Muzzle" goto "respawnloop" #guncheck _guns = weapons _unit _mags = magazines _unit ~(random 0.5) _guncount = count _guns _magcount = count _mags ?_unit hasweapon (primaryweapon _unit):_hasrifle = true;_prigun = primaryweapon _unit;goto _return _hasrifle = false goto _return
  3. I thought that objects like ammo crates were already created locally on MP servers if they were present in the editor? Can the problem not be solved by running the restocking script locally instead?
  4. Sounds like a dedicated server bug to me. Have you tried a VERY basic test, like just one guy, one AI in the same group and the ammo crate, compile it and run it with a dedi server to replicate the problem?
  5. check that you can spawn them in the editor at all before tinkering with completed missions you'll probably find that startup scripts in the warfare game mode dictate what the starting vehicles are - ie your editor placed vehicles will spawn where you put them, but that woon't likely be where you start, nor will they be added to the list of buildable vehicles for the air factory.
  6. Probably because the group leader has to be synchronised with the SOM. If all players have died at some point, there may not be a surviving squad member to pass the baton on to. An eventhandler that resynchronises the SOM with a player might solve the problem.
  7. Welcome to the problems of join in progress =] Quick questions to help diagnosis: 1. Is your eventhandler intended to work after player respawn? 2. Does it work after respawn? 3. Does it work for JIP players other than you? 4. Does the problem arise on dedicated or hosted servers or both? 5. Please insert your entire init.sqf using code tags so we can mull over it and make tutting noises while shaking our heads like car mechanics before announcing "It'll cost ya..."
  8. I understand that assignascargo adds a unit to an array of objects which are effectively ordered into the cargo of a vehicle. Does anyone know if using moveincargo will also add a unit to the assignedcargo list. ie if a group is moved into cargo using their init lines, will running assignedcargo on the helicopter return a null array or not?
  9. Move him up to the vehicle first. A get in command will override a walking footspeed because the unit will try to get in the car etc. as quickly as possible from the moment th eorder is issued. Try something like this: _peep setSpeedMode "LIMITED"; _peep setBehaviour "SAFE"; _peep domove (getpos _vehicle); while {(_peep distance _vehicle) > 10} do { sleep 5; }; _peep assignAsCargo _vehicle; [_peep] orderGetIn true;
  10. TurokGMT

    Respawning

    The invincible on respawn bug usually occurs when also trying to use the first aid modules in the editor - are you doing this? The teamswitch option being anabled may also provide a conflict with respawning AI.
  11. I borrowed a pop up target script for a sniper training map I made for arma on the avgani map. Here's the script - it might help you. I can't remember if I called the script from a the pop up target's init line, or from init.sqf. // this script should be being run by every pop up target on dedi server /* InitPopUpTarget.sqf * * SYNTAX: nil = [Object, Number, Boolean] execVM "InitPopUpTarget.sqf" * * PARAMETERS: Object: A pop-up target * Number: The number of hits it takes to knock the target down * Boolean: If set to True, the target will pop up again. * * NOTES: This function is meant to be placed in the Initialization field * of a pop-up target. * * Pop-up targets that are not initialized with this function will * stop working as expected: they won't pop up again. This is * because this function sets the global variable "nopop" to True. */ #define VERSION 0.1 #define HIT_COUNTER "HitCounter" #define ONHIT_PARAMS "AdvPopUp_OnHit_Params" #define ONHIT_HANDLER "AdvPopUp_OnHit_Handler" #define ONHIT_INDEX "AdvPopUp_OnHit_Index" nopop = true; _target = _this select 0; _requiredHits = _this select 1; _isPopUp = _this select 2; _hitHandler = { private ["_target", "_requiredHits", "_isPopUp", "_hitCount", "_keepUp"]; _target = _this select 0; _requiredHits = _this select 1; _isPopUp = _this select 2; if (_target animationPhase "terc" > 0.1) exitWith {}; _hitCount = (_target getVariable HIT_COUNTER) + 1; _keepUp = true; if (_hitCount == _requiredHits) then { //////////////// // ADDED CODE // //////////////// // code designed to fire an event handler defined in init.sqf myvar = _target; publicVariable "myvar"; // This executes the event handler on other machines /////////////////////// // END OF ADDED CODE // /////////////////////// _hitCount = 0; _target animate ["terc", 1]; sleep 3; _keepUp = _isPopUp; }; if _keepUp then { _target animate ["terc", 0]; }; _target setVariable [HIT_COUNTER, _hitCount]; }; _target setVariable [HIT_COUNTER, 0]; _target setVariable [ONHIT_PARAMS, _this]; _target setVariable [ONHIT_HANDLER, _hitHandler]; _code = { _t = _this select 0; (_t getVariable ONHIT_PARAMS) spawn (_t getVariable ONHIT_HANDLER); // weird! }; _index = _target addEventHandler ["Hit", _code]; _target setVariable [ONHIT_INDEX, _index];
  12. Well that's that sorted then...hope the original question has been answered. Also nice to get a bit of discussion going about how to fiddle around with arrays - they are a powerful scripting tool which really help when processing the same command for mulitple units or when passing groups around a script.
  13. the setcaptive command will prevent anyone firing on you unless you do something stupid like pick up a weapon and shoot someone. As far as becoming unfriendly to anyone, just shoot a few dudes from that side and you will automatically be marked as an enemy to that side (try shooting a couple of squad memebers dead in the editor if you need proof =] )
  14. my suggestion to you would be to download the domination map pack, unpbo domination_west and be prepared to lose your summer learning how it all fits together. It's the only fast track way to getting really good at scripting that I know, but the learning curve is a bitch =]
  15. TurokGMT

    Respawning

    @lokai to open my mission in the editor, you'll need to unpbo it and place the folder in your missions folder in your profile area in my documents. If you just want to play it as a proff of concept, just put the pbo file in the MPmissions folder in your arma2 root directory
  16. Not as far as I'm aware. If the crate is placed in the editor, then a local version of the crate is created on the server and all client machines. I'm unable to determine what might cause inaccessability to the crate on a dedi. Have you tried approaching the crate from different angles etc?
  17. In the case of respawning vehicles, does anyone know how to retain the name of a vehicle when it respawns? eg a heli called chopper dies, the respawn script is fired and a shiny new helicopter appears back at base - but how to you ensure that the new one retains the name of the original? does the x_vehirespawn.sqf script from domination already feature name retention?
  18. I think that sidechat has to have arguments passed in an array...? I've certainly used it in array format before, might want to double check your syntax. Might also possibly be an issue where it's the PILOT of the vehicle that is sending the sidechat, and he doesn't have a name (whereas his plane does). I'm a little hazy on the whole naming convention system for spawned vehicles with crew, further reading needed on this one I'm afraid!
  19. arrays can be defined in scripts eg: _myarray = [element0,element1,element2]; specific elements in an existing array can be changed or referenced: _myelement = _myarray select 3; _myarray select 3 = _newelement; <--- never tried this, think it should work though =] you can also pass arguments to a script using arrays: [soldier,helicopter,[getpos player]] execvm "myawesomescript.sqf"; we're bascially talking about script editing here, which can be done using notepad. Just change the file extension from .txt to .sqf
  20. I suggest you post your code. Being unable to access an ammo crate you've placed in the editor is a serious mission breaker! =]
  21. The secondary operations module. The .pbo file containing the scripts it's uses can be found in your addons folder in the main arma 2 root directory.
  22. revive as a respawn method has issues when used in MP with SOM - I've read threads involving the red "hurt" screen staying on and invulnerable players problems.
  23. This should be posted on the main domination thread - look elsewhere. Xeno should get back to you promptly.
  24. TurokGMT

    Respawning

    To respawn in general in MP: 1. create a marker called respawn_west 2. in description.ext, set the respawn type to base (I forget which number that is) To respawn as a paratrooper, add an event handler in the ini/sqf file which gets fired upon player respawn. The event handler simply calls one of the BIS halo functions (search the forum for HALO). Check out my mission operation magpie, in my sig, which already has paratroop insertion upon respawn - you can probably reverse engineer it.
  25. You won't need to have all of warfare running. Base management can be done with just the construction interface. Money can be handled using killed event handlers for enemies and a money variable which is publically updated every time a bad guy dies. A "killed" type event handler passes two arguments by default, the dead object and the killer, this contains enough info to determine what gets killed and who should get rewarded (the basis of a simple points sytem). As for money, that's simple enough, create a public variable called something like, I dunno, blingbling and alter it's value every time the event handler gets fired or you spend something at base.
×