Jump to content

twirly

Member
  • Content Count

    1304
  • Joined

  • Last visited

  • Medals

Everything posted by twirly

  1. First off MP programming is not at all easy and may not be the best place to start. There's all sorts of issues with "locality". What gets executed on the server...what gets executed on the clients etc. Which computer runs the script... all sort of things to know. You can't test the MP stuff unless you run a MP game... which makes testing a challenge all by itself. Before you can do anything Multiplayer... you need to understand this sort of stuff... http://forums.bistudio.com/showthread.php?96812. For instance... the player is different on all machines and local to the machine he exists on. You must understand how this all fits together. You will get lots of help in these forums.... but no-one is going to write your scripts for you... so in the long run you will have to learn. Hope you stick around long enough to do that! :)
  2. private ["_marker","_boxes","_town","_newpos","_numb","_boxnum","_box","_townpos","_towns"]; if (isServer) then { if (CVG_Caches == 1) then { boxes = 20; // Starting point every island should have... _towns = towns; while {boxes > 0} do { _boxes = ["USBasicWeaponsBox","RUBasicWeaponsBox","GERBasicWeapons_EP1","USBasicWeapons_EP1","TKBasicWeapons_EP1","SpecialWeaponsBox","Ammobox_PMC"]; _town = _towns call BIS_fnc_selectRandom; _newpos = getpos _town; _townpos = [_newpos, 10, 100, 1, 0, 60 * (pi / 180), 0] call BIS_fnc_findSafePos; _numb = (count _boxes); _boxnum = floor (random _numb); _box = _boxes select _boxnum; _box = createVehicle [_box,_townpos,[], 0, "NONE"]; [color="#FF0000"]nul = [_box] execVM "fill_crate.sqf";[/color] boxes = boxes - 1; }; }; }; fill_crate.sqf:- private ["_crate"]; // Get the crate _crate = _this Select 0; // Remove the stock items from the crate ClearMagazineCargo _crate; ClearWeaponCargo _crate; // Add items to the crate _crate AddMagazineCargo ["20Rnd_556x45_Stanag", 30]; _crate AddMagazineCargo ["30Rnd_762x39_AK47", 30]; _crate AddWeaponCargo ["M4A1_Aim", 3]; _crate AddWeaponCargo ["AK_47_S", 3]; _crate AddMagazineCargo ["PipeBomb", 9]; _crate AddMagazineCargo ["TimeBomb", 9]; _crate AddWeaponCargo ["Binocular",3]; What goes into what crate will take some more thinking about the problem.
  3. Suck it and see it mate... I did no testing!
  4. For finding the towns.... _places = [url="http://community.bistudio.com/wiki/nearestLocations"]nearestLocations[/url] [getMarkerPos "center",["NameCityCapital","NameCity","NameVillage"],10000]; Creating the caches.... use createvehicle array _ammobox = createVehicle ["USBasicWeapons_EP1", position player, [], 0, "NONE"]; For finding good random places to place these caches. You have these to work with... findEmptyPosition isFlatEmpty For paradropping the ammo.... there are many scripts in the forums for that. It's going to be up to you to learn how to string this all together.
  5. Well basically it's like this....you can use addrating to make everyone shoot at them... but depends on how you want to use it, call it etc.. _uidarray = ["123456","654321","456789"]; if (not (_unit in uidarray)) then {_unit addrating -10000};
  6. Probably is.... make sure you didn't mix up the selects in the getmarkerpos's
  7. Ahhh... they are spawning in the ocean at sea level. So... breaking it down... _lhdheight = 15; //lhd deck height.. check this because I don't know!! _lhdpos = getmarkerpos "respawn_lhd"; //get the marker position _lhdpos set [2,_lhdheight]; //set (z) to deck height player setPos _lhdpos; //move the player or one long line... if (str player in _fob3) exitWith {player setPos [(getMarkerPos "respawn_lhd") select 0,(getMarkerPos "respawn_lhd") select 1,[color="#FF0000"]15[/color]]}; ...and the same for the carrier and you should be good to go! EDIT: I'm not sure of the deck heights so some experimentation or searching will be needed. Forgot to mention that! :)
  8. Hi... You need several scripts to accomplish what you need. Break what you want to do into pieces and start small.... very small. Don't be too ambitious... not with this game! http://community.bistudio.com/wiki/Category:Scripting_Commands
  9. twirly

    Feq questions.

    Hi... for the bird thing... I don't know offhand. For the chatter have a look here... http://community.bistudio.com/wiki/enableSentences
  10. Hi... one of your variables is missing the undescore... and check your pilot numbers. {_x assignAsCargo Hind(number)} forEach units Spetsnaz(number); Pilot(number) assignAsDriver Hind(number); Pilot(number) assignAsGunner Hind(number); {[[color="#FF0000"]_[/color]x] orderGetIn true} forEach units Spetsnaz(number); [Pilot(number), Pilot(number)] orderGetIn true Here's a friendly suggestion... start writing scripts and stop trying to cram stuff into those text boxes in the editor! myscript.sqf:- _vehicle = _this select 0; _pilots = _this select 1; _group = _this select 2; (_pilots select 0) assignAsDriver _vehicle; (_pilots select 1) assignAsGunner _vehicle; {[_x] orderGetIn true} forEach _pilots; {_x assignAsCargo _vehicle } forEach units _group; {[_x] orderGetIn true} forEach units _group; Execute it from your triggers like this:- nul = [Hind1,[Pilot1,Pilot2],Spetsnaz1] execVM "myscript.sqf"; Hope it helps.
  11. Something like this maybe....using a PVEH and titletext. In your init.sqf:- //Network titletext system if (isNil "PVEH_netText") then { PVEH_netText = []; }; "PVEH_netText" addPublicVariableEventHandler { private ["_text","_uidarray"]; _text = (_this select 1) select 0; _uidarray = if (count (_this select 1) >1) then {(_this select 1) select 1}; if (isNil "_uidarray") then { titletext [_text,"PLAIN DOWN"]; } else { if ((getplayerUID player) in _uidarray) then { titletext [_text,"PLAIN DOWN"]; }; }; }; Execute it like this for specific clients based on an array of UID's.... can be just one UID in the array. PVEH_netText = ["Show this text",["123456","498765","645372"]]; publicvariable "PVEH_netText"; To run on all clients leave out the UID array:- PVEH_netText = ["Show this text"]; publicvariable "PVEH_netText"; The Publicvariable can be updated from any machine.... but if you want the text to show up on the machine doing the updating you will have to add this line.... as PVEH's don't fire on the machine that broadcasts the variable. titletext ["Show this text","PLAIN DOWN"]; It's a bit complicated... but if you wrap your head around this you can make all sorts of stuff happen across the network. Must be MP to test!
  12. Hi... you do know that respawn won't work in Single Player testing in the editor.... right? Anyway check these out.... http://forums.bistudio.com/showthread.php?137016 http://forums.bistudio.com/showthread.php?142596 http://forums.bistudio.com/showthread.php?141847 http://forums.bistudio.com/showthread.php?139123
  13. Download the mission in the thread and have a look at it in the editor. It works with a radio trigger.... but is easy to change to a normal trigger. It will take some work on your part.
  14. http://forums.bistudio.com/showthread.php?142833
  15. Then the problem becomes... do you respawn the vehicle as soon as it's destroyed?.... or wait for the crew to all die before you do the respawn. If it's the latter then more code needs to be also added to track if the crew is alive or not. Otherwise you can end up with a lot of surviving crew running around as vehicles are spawned with new crew. Good old Arma... solve one problem and it creates another!
  16. Download this and have a look.... see if it works for you. Change things to suit your needs. It should display players in a MP game and needs to be run on all machines. For testing in SP.... look for these lines and comment out like this. //if (isPlayer _unit and (alive _unit)) then { if (alive _unit) then { for MP... if (isPlayer _unit and (alive _unit)) then { //if (alive _unit) then { Code... Hope it helps.
  17. Have a look here mate... http://community.bistudio.com/wiki/Artillery_Module
  18. I spent hours looking at it as Trig rotation and couldn't get it to work. Gave up in the end. Will try to digest the vector math.
  19. Execute the script below from the onAct of a trigger, or wherever... with this... nul = [] execVM "myscript.sqf" Create this script in your mission folder. Change the variable in orange to suit your needs. someobject is the object around which you want the guy spawned... the others are easy to figure out. myscript.sqf:- [color="#FF8C00"]sleep[/color] 60; [color="#FF8C00"]_radius[/color] = 100; _x1 = (getpos [color="#FF8C00"]someobject[/color]) select 0; _y1 = (getpos [color="#FF8C00"]someobject[/color]) select 1; _ang = random 360; _dx = sin(_ang) * _radius; _dy = cos(_ang) * _radius; _x2 = _x1 + _dx; _y2 = _y1 + _dy; _group = creategroup WEST; _unit = _group createUnit [[color="#FF8C00"]"SoldierWB"[/color], [_x2,_y2,0], [], 0, "NONE"];
  20. Have you actually added the event handler? http://community.bistudio.com/wiki/addPublicVariableEventHandler Try putting this in your init.sqf.... must run on every machine. if (isNil "rally_available") then { rally_available = 1; }; "rally_available" addPublicVariableEventHandler { private ["_var","_val"]; _var = _this select 0; //the variables name _val = _this select 1; //the variables value hint format ["%1 was just updated to %2",_var,_val]; }; You have to remember that the event handler does not fire on the machine it is called on. So if you were passing a value that was used to run a script on all machines it would not run on the machine that actually changed the value and broadcasted the public variable. In your case here you should be alright because you are not doing anything with the variable other than changing it's value. EDIT: Thinking about it some more.... that might in fact be your problem.
  21. Well... from just scanning it nothings really "wrong" except you don't need the last two lines for sure. What it needs is testing.... and since it's your script... you test it! Tell us what doesn't work and someone will try to help you. Also when posting code... Go Advanced and use the "code" tags to post the code. It makes it a little easier for everyone to digest.
  22. Not sure but try using createMarker instead of createMarkerLocal EDIT: You can also try tracking all playableunits locally on each players machine. If testing in SP you have to use switchableunits. if (isMultiplayer) then { _units = playableunits; } else { _units = switchableunits; };
  23. Download the mission in this thread and see if you can adapt it.... shouldn't be too hard.
  24. Hi mate... check this out....uses the nearEntities command instead. Works fine. Notice all the diag_log statements? I tracked the script the whole way through and logged the stuff to the .rpt file. Between that and -showScriptErrors parameter in your shortcut.. it becomes a little easier to work out. Keep trying till something works. Lots of commands are similar. It's quirky stuff. _type = _this select 3; _dir = 205.55; //diag_log format ["_type: %1",_type]; _objects = []; _objects = getMarkerPos "mcar" nearEntities [["Man","Air","Car","Motorcycle","Tank"],5]; //diag_log format ["_objects: %1",_objects]; if (count _objects >=1) then { hintSilent "Can't spawn vehicle,\na vehicle is blocking it's spawn!"; //diag_log "The hint fired."; } else { _veh = createVehicle [_type, getMarkerPos "mcar", [], 0, "NONE"]; _veh setdir _dir; //diag_log format ["%1 created. Heading: %2",_type,getdir _veh]; }; If you want to randomise the direction then do this... _dir = random 360; Hope that helps!
×