Jump to content

Grumpy Old Man

Member
  • Content Count

    4313
  • Joined

  • Last visited

  • Medals

Everything posted by Grumpy Old Man

  1. Grumpy Old Man

    EventHandler "Hit"

    Kidding aside, you want a variable to turn true once a vehicle is damaged more than 0.3? Why not just: RBN_granDamage = false; waitUntil {damage dispo1 >= 0.3}; RBN_granDamage = true; //do stuff Cheers
  2. Grumpy Old Man

    EventHandler "Hit"

    That entire snippet doesn't make sense. At all. At first you don't need global variables, when you could simply use the _unit parameter that's being passed inside the EHs code. Then you manually set the damage of the vehicle to 0.1, yet check with an if statement if the damage is (what I presume) bigger than 0.3, which will only be true if the vehicle gets destroyed with one hit (big explosive charge or tank hit might do that). The check of the damage isn't proper syntax, you're using =>, which might pass as a smily face, but not as bool comparison, you might want to use >= instead. Then inside the if statement you set a local variable to true, which can't be accessed anywhere outside the scope where it has been defined, namely the if statement inside that EH. To top it off the variable names are all over the place, you'd want them named in a way that makes it obvious what they contain and as best practice add a tag to them to prevent conflicts with other scripts/addOns. The vehicle could be called RBN_obj_dispo1 (whith RBN being short for redburn), the global variable to handle the damage check could be called RBN_flag_dispo1Damaged or similar. I suggest taking a look at some basic scripting guides first before attempting something like that, heh. What exactly do you want to accomplish? In your post you state that you want to check for damage, but in the snippet you manually set the damage of the object. Cheers
  3. What exactly didn't work? The plane stops taking damage, as intended. If you also want to make the vehicles crew immune to any damage (explosions, piercing ammo, etc) where a player is not the damage source you'll have to handle that separately. Cheers
  4. Grumpy Old Man

    Refill vehicle ammo

    Try setVehicleAmmoDef. Also try to improve your search game, since you can easily stumble upon this command by using ctrl+f on the scripting command wiki page and searching for either "ammo" or "vehicle". Cheers
  5. Grumpy Old Man

    "Hit" Event Handler Params

    Group is its own data type, similar to object, location or array. The "in" command needs either a vehicle, to find if a unit is inside it, or an array, to check if an element exists inside an array. Group is of data type group, so the "in" command doesn't work, hence why you need "units group". Cheers
  6. Grumpy Old Man

    Daytime question

    If you want to check or compare dates you can use dateToNumber and numberToDate. If you want to do a simpler check when stuff will happen on the same day, simply use daytime. dayTime is rather straightforward, 10 being 10:00, while 10.5 is 10:30. Cheers
  7. Might be the position error of the command messing things up, you could simplify it like this: _rndTarget = selectRandom _nearby; _targetPos = getPosATL _rndTarget; So the final snippet would look like this: GOM_fnc_mortarAutoReveal = { params ["_mortar"]; while {alive _mortar AND canFire _mortar AND count crew _mortar > 0} do { _enemySides = side _mortar call BIS_fnc_enemySides; _mag = currentMagazine _mortar; _nearby = (getposatl _mortar nearEntities 4000) select {side _x in _enemySides AND _mortar getArtilleryETA [getposatl _x,_mag] > 0 AND getPosATL _x inRangeOfArtillery [[_mortar], _mag]}; //no enemies found which are in range and have a firing solution, skip and wait if (count _nearby > 0) then { _rounds = 4; _rndTarget = selectRandom _nearby; _targetPos = getPosATL _rndTarget; (effectiveCommander _mortar) commandArtilleryFire [_targetPos,_mag,_rounds]; systemchat format ["%1 targets: %2",effectivecommander _mortar,count _nearby]; sleep _rounds * 6;//give enough time to fire all rounds, then start over }; sleep (3 + random 3); }; }; GOM_fnc_spawnMortars = { params ["_side",["_debug",true]]; _sides = [west,east,resistance]; if !(_side in _sides) exitWith {systemChat "Wrong side parameter"}; _mortarTypes = ["B_Mortar_01_F","O_Mortar_01_F","I_Mortar_01_F"]; _mortar = _mortarTypes select (_sides find _side); _markers = allMapMarkers select {toUpper _x find toUpper str _side >= 0};//for east this returns all markers containing "east" in the name _mortars = []; if (_debug) then {systemchat format ["Spawning %1 mortars: %2",_side,_markers]}; { _mortarSpawn = _mortar createVehicle getMarkerPos _x; createVehicleCrew _mortarSpawn; _mortars pushBack _mortarSpawn; } forEach _markers; {[_x] spawn GOM_fnc_mortarAutoReveal} forEach _mortars; if (_debug) then {systemchat format ["Spawn finished: %1",_mortars]}; }; //now when you want to spawn the mortars simply do this: _spawn = [east] call GOM_fnc_spawnMortars; Should be more precise. Cheers
  8. So you have multiple triggers doing the same thing? Are you using other practices similar to this one? Other than that try build stuff from the ground up and see when those "lags" start to show up. Vanilla first, add mod units/vehicles when the framework for the mission does what it should. Then add fancy stuff like video playback, music etc. Cheers
  9. Not that I know of, seems the AI brain waits for the units to disembark, then waits for everyone to get in again. You could force every unit out of the vehicle using moveOut command, then immediately moveInAny, might do the trick but strongly depends on how the AI FSM is working. Cheers
  10. Grumpy Old Man

    Location location?

    Not sure if this is what you want, but you can retrieve all locations like this: _locations = nearestLocation [[worldSize/2,worldSize/2],[],(worldSize/2) * 1.4142]; Then you'd need to further filter for location names if you want a specific one. Cheers
  11. Grumpy Old Man

    [Release] GOM - Aircraft Loadout V1.35

    The answer is in my third reply on this very page. Might be passing the variable name of a deleted object to the script maybe? None of the functions included in this script package handle player respawn or music playback on respawn. Might be some other script/mod causing this. Cheers
  12. Grumpy Old Man

    Time inside a while

    That's not proper syntax. Would look like this: if ((getposASLW _vehicle select 2) < -25 and (getposASLW _vehicle select 2) > -43) No idea where you getting at, you mention a smaller area depending on depth, yet your example doesn't show anything similar. Also the usage of getPosASLW can lead to unwanted results, especially with heavy sea (especially since you seem to check for depths between -83 and -85m). State exactly what you want to do, since there's probably a more convenient way to do it other than spawning and deleting triggers inside a while loop. Cheers
  13. Grumpy Old Man

    Chances in an array

    35? Try reading the wiki entry. Cheers
  14. Indeed this seems to be the case. Well the AI seems to be truly done for this iteration... Placed a HEMTT transport with a waypoint, a few units in the cargo slots, all of the same group. Then called this: {_x doFollow leader group _x} forEach units squadLeader; Half the squad left the vehicle, just to get in again. After that the vehicle starts moving towards the waypoint... Not really sure if it's worth it to post a ticket. Cheers
  15. Grumpy Old Man

    Time inside a while

    This looks sketchy as hell. The while true loop will run every second, creating a trigger every second when the _vehicle is 25m below water. _vehicle also is undefined inside the scope you're using it. Did this even work when you tried it? What do you want to achieve? Also post using code tags and proper indentation, makes it easier to go through. Cheers
  16. Don't worry about performance until you run into performance issues caused by your scripts. Other than that depends on your workflow I guess. I've grown fond of having multiple smaller, specialized functions where possible. Makes it easy for the eyes having to go over a few lines vs scrolling through 1000+ lines. Cheers
  17. Grumpy Old Man

    Searching a script

    Where exactly did you search? Won't find any scripts in a barn, just saying. Cheers
  18. Grumpy Old Man

    Handicapped player

    Carrying? What do you mean? Cheers
  19. Your while loop has no sleep inside, might be causing it since it will run at full speed, didn't look much further though. Cheers
  20. Grumpy Old Man

    [IceBreakr/IBIS] Lingor & Dingor for A3

    Almost got a heart attack when I saw you replying to this thread, thought 3.9 is happening! Most favorite map by far, keep up the good work! Cheers
  21. Grumpy Old Man

    INTRO - need some good tutorial

    Just ditch the idea of using the vanilla intro/outro stuff and script it via event files depending on for whom you want to run this intro. Cheers
  22. Grumpy Old Man

    Draw circle on terrain in script

    19 minutes ago, heh... Maybe you'll make it within a minute on mercury. Cheers
  23. Make sure to check out the alternative syntax for most scripting commands, quite a few neat additions in the last 2 years. Cheers
  24. Grumpy Old Man

    Draw circle on terrain in script

    No idea if there's a formula (might be) for it and if the thread starter actually needs it. My geometry lessons are in the distant past, heh. Cheers
×