Jump to content

twirly

Member
  • Content Count

    1304
  • Joined

  • Last visited

  • Medals

Everything posted by twirly

  1. You include it as a function in a script like this.... X_fnc_SunElev = { /* Author: CarlGustaffa Description: Returns the suns altitude for current day and hour of the year on any island (whos latitude may differ). Parameters: None needed. Returns: Suns altitude in degrees, positive values after sunrise, negative values before sunrise. */ private ["_lat", "_day", "_hour", "_angle", "_isday"]; _lat = -1 * getNumber(configFile >> "CfgWorlds" >> worldName >> "latitude"); _day = 360 * (dateToNumber date); _hour = (daytime / 24) * 360; _angle = ((12 * cos(_day) - 78) * cos(_lat) * cos(_hour)) - (24 * sin(_lat) * cos(_day)); _angle }; [color="Red"]_sunangle = [] call X_fnc_SunElev[/color]; hint format ["Angle of the sun is %1",_sunangle]; ..or you can make a separate ".sqf" for it and also call it as a function. In which case you would preprocess the function by including this line in your "init.sqf" in your mission folder. init.sqf:- X_fnc_SunElev = compile preProcessFile "X_fnc_SunElev.sqf"; Now the function itself.... X_fnc_SunElev.sqf:- /* Author: CarlGustaffa Description: Returns the suns altitude for current day and hour of the year on any island (whos latitude may differ). Parameters: None needed. Returns: Suns altitude in degrees, positive values after sunrise, negative values before sunrise. */ private ["_lat", "_day", "_hour", "_angle", "_isday"]; _lat = -1 * getNumber(configFile >> "CfgWorlds" >> worldName >> "latitude"); _day = 360 * (dateToNumber date); _hour = (daytime / 24) * 360; _angle = ((12 * cos(_day) - 78) * cos(_lat) * cos(_hour)) - (24 * sin(_lat) * cos(_day)); _angle }; Then call the function the same way as above :- _sunangle = [] call X_fnc_SunElev; hint format ["Angle of the sun is %1",_sunangle]; Hope that helps in some way.
  2. Can't help with the Movie Modules but here's a brilliant way to find out if it's dark...was just looking this up yesterday myself. Thanks to Carl Gustaffa. http://forums.bistudio.com/showthread.php?t=107476&highlight=detect+night Hope it helps.
  3. You really have to just try and see what works mate. It can be painfull learning at times.
  4. :) I just put something together for you. I am not sure how much you know about scripting so I hope it does not confuse you more! This is also for Singleplayer....I can't help you make this work in multiplayer. You can download a little demo here. This consists of a script and a function. The script in this case is the init.sqf itself for want of a better place to put the code. The function is in a separate folder called "func". Create "init.sqf" in your mission folder.... "init.sqf":- private ["_i","_units","_unit"]; whoDunnit = compile preProcessFile "func\fn_whoDunnit.sqf"; sleep 1; _units = allUnits; for [{_i=0},{_i<count _units},{_i=_i+1}] do { _unit = _units select _i; _unit addeventhandler ["KILLED",{nul=[_this] call whoDunnit}]; sleep 0.01; }; Then make a folder in your mission folder called "func" and create the file "fn_whoDunnit.sqf" with the code below. "fn_whoDunnit.sqf":- private ["_deatharray","_victim","_killer","_side","_x1","_y1","_x2","_y2","_dis"]; _deatharray =_this select 0; _victim = _deatharray select 0; _killer = _deatharray select 1; _x1 = getPos _victim select 0; _y1 = getPos _victim select 1; _x2 = getPos _killer select 0; _y2 = getPos _killer select 1; _x = _x2 - _x1; _y = _y2 - _y1; _dis = sqrt(_x^2+_y^2); _dis = round _dis; _killer globalchat format ["%1 killed %2 at %3m", name _killer, name _victim, _dis]; Add a few BLUFOR groups...add a few OPFOR groups and let them slog it out. The kills will be reported. Mate I haven't commented the code for you...but it's not much code and you should be able to follow it pretty easily. The other thing is it's 2:40 am ! LOL! You mentioned GR 1....well I still play that up to today with a couple mates. It works well and we get a lot of kicks out of it. I use this same script above to hear "He's history", "Kill confirmed" or "Goodbye" when I kill someone in the Arma world. Here's the code! private ["_deatharray","_side", "_victim","_killer","_dis"]; _deatharray =_this select 0; _victim = _deatharray select 0; _killer = _deatharray select 1; _side = side _victim; _dis = round (_killer distance _victim); if (isPlayer _killer) then { _killer globalchat format ["%1 killed %2 at %3m", name _killer, name _victim, _dis]; if (_side == side player) then { playsound "onourside"; } else { _rnd = floor (random 3); if (_rnd == 0) then {playsound "killconfirmed"}; if (_rnd == 1) then {playsound "heshistory"}; if (_rnd == 2) then {playsound "goodbye"}; }; }; Wheeww! That was longer than expected. Hope it helps!
  5. Try using "say"....That makes the sound directional. who say "your sound";
  6. I don't know man....try it and see. I run lots of scripts including this one on my groups, vehicles etc...without any noticeable hit. This processor is an AMD 3.0 Gig Quad Core....so nothing too fancy. I think it will go OK for you....download the demo mission and copy and paste groups till you have 30+ and see what happens!!
  7. @kyfohatl Try this mate.....it might be just what you need. I have removed all the extra code I need for my missions and trimmed this down for you. It is well commented so should be easy to follow if you want to change anything and hack it to death. I created a demo mission that can be found here at Mediafire. twirl_respwnGrp.sqf:- [color="SeaGreen"]/* Respawn a group infinitely or a set number of times*** Author: Twirly. Date: February 2011 Execute from ONE member of a groups init like this:- nul = [group this,999,[10,30],_waypt] execVM "twirl_respwnGrp.sqf"; Execute from a script like this:- nul = [_group,999,[10,30],_waypt] execVM "twirl_respwnGrp.sqf"; Where:- _group = the group to respawn... 999 = the number of respawns... use -1 for perpetual respawn [10,30] = the minimum and maximum time between respawns in seconds _waypt = the groups waypoint...can be an object or a position */[/color] private ["_group","_waypt","_nresp","_minmaxt","_mintim","_maxtim","_i","_j","_dude","_alive", "_dead","_typs","_spawnpos","_weap","_mags","_prim","_wp"]; _group = _this select 0; _nresp = _this select 1; _minmaxt = _this select 2; //array of min/max tim before respawn. Eg...[30,180] _waypt = _this select 3; //if an object was passed...get the position of the object if (typename _waypt == "OBJECT") then {_waypt = getpos _waypt}; //get the spawn position of the group _spawnpos = getPos leader _group; //get the number of units in the group _numunits = count units _group; //get the minimum and maximum times for respawn _mintim = _minmaxt select 0; _maxtim = _minmaxt select 1; //initialise the necessary arrays _typs = []; _weap = []; _mags = []; _prim = []; //save unit types and weapons...mags etc. for [{_i=0},{_i<count units _group},{_i=_i+1}] do { //select the unit _dude = units _group select _i; //save the typeof unit and the weapons into separate arrays _typs = _typs + [typeOf _dude]; _weap = _weap + [weapons _dude]; _mags = _mags + [magazines _dude]; _prim = _prim + [primaryWeapon _dude]; //love my sleep :) sleep 0.01; }; //main loop....keep looping as long as _nresp is not equal to zero while {_nresp !=0} do { //not sure if this is necessary deleteWaypoint [_group,0]; //add the waypoint _wp = _group addWaypoint [_waypt, 10]; [_group, 1] setWaypointSpeed "NORMAL"; [_group, 1] setWaypointBehaviour "AWARE"; [_group, 1] setWaypointType "MOVE"; [_group, 1] setWaypointCombatMode "RED"; //no running away _group allowfleeing 0; //works better if you track the dead units separately _dead = []; //main loop while {(count units _group >= 1)} do { for [{_i=0},{_i<count units _group},{_i=_i+1}] do { //select unit _i _dude = units _group select _i; //make sure the unit can always walk if (alive _dude and not canStand _dude) then { _dude setDammage ((getDammage _dude) - 0.1); }; //if unit is dead add to the dead array if (not(alive _dude)) then { if (not(_dude in _dead)) then { _dead = _dead + [_dude]; }; }; sleep 0.01; }; sleep 1; }; //hide the bodies...then delete for [{_i=0},{_i<_numunits},{_i=_i+1}] do { _dude = _dead select _i; hideBody _dude; sleep 4; deleteVehicle _dude; sleep 0.01; }; //wait for a random time between mintim and maxtim before we respawn the group _wait = time + _mintim + (random _maxtim); waitUntil {(time > _wait)}; //respawn the group restore weapons, mags etc for [{_i=0},{_i<_numunits},{_i=_i+1}] do { _dude = _typs select _i createUnit [_spawnpos, _group, ""]; removeAllWeapons _dude; {_dude addMagazine _x} forEach (_mags select _i); {_dude addWeapon _x} forEach (_weap select _i); _dude selectweapon (_prim select _i); sleep 0.1; }; //update the number of respawns _nresp =_nresp - 1; //hint...side, group and respawns left _respleft = _nresp; if (_nresp <0) then {_respleft = "Unlimited"}; hint format ["%1:%2 has respawned\n%3 respawns remaining", side _group, _group, _respleft]; };
  8. twirly

    Clear area

    You can set that up when placing the trigger. Nothing else needed. Activation "OPFOR"....and then select "Not Present". Edit: I replied to slowly :)
  9. I really hope you will apply your fixes to Arma 2 as well!
  10. twirly

    Graphics engine improvement

    Yes...and they look like crap and one of the many things that simply help kill the immersion factor. We simply don't need every leaf modelled...it's a war game not a garden show! I agree that the pic you posted would look way better!
  11. Just reading through I don't see any problrms other than might be caused with stuff that is referenced outside of the script itself....like "Medcrew"..."MedSpawn" etc. So maybe look there!
  12. LOL! Your script is not "working fine" if it does not work! The add "showscripterrors" and looking in the report file is excellent advice. Anyway...just from reading this thread and the help you have already been given....I got it working with not too much trouble at all.... Demo here. EDIT: You can name your script anything you want...it is your script. As it stands however....it is not a function.....so maybe you should leave out the "fnc_" in the name. This normally means it is a function of some sort and may be confusing to others.
  13. twirly

    Latency

    Not good news! By then they will have grandchildren and have no time for developing anything! ...and I will probably be too old to even get to my computer. LOL!
  14. You can also try "Eliteness"....which is what I use. Look on this page http://andrew.nf/ofp/tools/
  15. Try this guys.....it's much simplified from what I'm using but will get you started. You need to use an Eventhandler. Create this file in your mission folder (add_ehs.sqf)....it adds the necessary "Killed" Evenhandler to all the units of a group. add_ehs.sqf //Twirly 2011 private ["_group","_unit","_i"]; _group = _this select 0; whoDunnit = { private ["_deatharray","_victim","_killer","_namvictim","_dis"]; _deatharray =_this select 0; _victim = _deatharray select 0; _killer = _deatharray select 1; _dis = round (_killer distance _victim); _killer globalchat format ["%1 killed %2 at %3m", name _killer, name _victim, _dis]; }; for [{_i=0},{_i<=count units _group},{_i=_i+1}] do { _unit = units _group select _i; _unit addeventhandler ["KILLED",{nul=[_this] call whoDunnit}]; sleep 0.01; }; Add this to the leader of each groups init..... nul = [group this] execVM "add_ehs.sqf"; Each and every unit will have to have this script running on it in order to get a message for every death. I run this on all my units and have no problems. Demo mission here. I realise this is not exactly what you need....but I'm sure you can figure out how to run it on the player! Good luck!
  16. @fadly1979.... When you spawn a jet like this does it actually fly?...or just crash in a burning heap?
  17. twirly

    Latency

    You hit the nail on the head here buddy! I think you are 100% right. It warps...period! I cannot understand why people suck up to BIS?.....as this will lead to nothing being done! Would you suck up to the guy that just built you a house with a leaky roof?
  18. I just sent you a PM mate! ... let's sort it out there.
  19. Tells me wrong version!! I have 1.56. It needs 1.56. LOL! Par for the course I guess!
  20. I hear you man.....and agree one hundred percent. I see people creating 100 player and more games. WTF would you do this? What is the point! I have been dying to play online with just two mates for donkeys years....but I can't expect them to spend money on this! I'm just stuck with this scripting addiction that has come about over the years while waiting for the network side of things to get better.....but it never has. It's like one step forward....two steps back with this game! Bittersweet!
  21. This blows me away too! I have set up a dedicated server (seperate machine) on a 2.8Ghtz dual core on LAN and get warping with 1 AI at 100m also. I have spent weeks trying to get multiplayer playable...and to no avail. I guess I just don't understand. Another little test I've done is to put the player and one group running towards him. Monitor your bandwith usage as the group comes nearer....you will see the bandwith use go up hugely. This I also don't understand. From what I can make out I think people simply deny or ignore the warping. Not me...can't enjoy a game like that!
  22. See if this will help you....wolffy.au's reinforcements script over at Armaholic. http://www.armaholic.com/page.php?id=9033
  23. Hi....What you want is not that hard to do...but there is quite a bit of thought and code involved as it has to be tailored specifically for what you are trying to achieve. I would say that to solve a problem like that you really need to learn to script! Search the forums some more....you may find scripts that you can pick apart and learn from. Good luck!
×