Jump to content

johnnyboy

Member
  • Content Count

    1864
  • Joined

  • Last visited

  • Medals

  • Medals

Community Reputation

2024 Excellent

About johnnyboy

  • Rank
    Sergeant Major

Profile Information

  • Gender
    Not Telling
  • Location
    Oregon

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. This script shows how to use an eventHandler to reduce damage to specific parts of an AI unit. Read this and see how it works. Once you understand that, look at this script I used on a vehicle to reduce damage taken by a vehicle (same principle): // handleBoatDamages.sqf // dummy = [boat1] execVM "Scripts\handleBoatDamages.sqf"; /* diag_log ["getAllHitPointsDamage boat1",getAllHitPointsDamage boat1];diag_log ["getAllHitPointsDamage player",getAllHitPointsDamage player]; ["HitBody","HitEngine","HitTurret","HitGun","HitTurret","HitGun","HitTurret","HitGun","HitTurret","HitGun"], ["hull","engine","","","","","","","",""], [0,0,0,0,0,0,0,0,0,0]]] */ _u = _this select 0; _u addEventHandler ["HandleDamage", { private ["_return"]; _unit = _this select 0; _selection = _this select 1; _passedDamage = _this select 2; _source = _this select 3; _projectile = _this select 4; _oldDamage = 0; _bodyMultiplier = .01; _engineMultiplier = 0.005; _otherMultiplier = 0.01; _overAllMultiplier = 0.005; switch (_selection) do { case("hull"): { _oldDamage = _unit getHitPointDamage "HitBody"; _return = _oldDamage + ((_passedDamage - _oldDamage) * _bodyMultiplier); }; case("engine"): { _oldDamage = _unit getHitPointDamage "HitEngine"; _return = _oldDamage + ((_passedDamage - _oldDamage) * _engineMultiplier); }; case("fuel"): { _oldDamage = _unit getHitPointDamage "HitFuel"; _return = _oldDamage + ((_passedDamage - _oldDamage) * _otherMultiplier); }; case(""): { _oldDamage = damage _unit; //_return = _oldDamage + ((_passedDamage - _oldDamage) * _overAllMultiplier); _return = _oldDamage; }; default{}; }; _return }]; I ran this script on a boat to make it tougher to destroy. You can tweak this to work for you most likely. Good luck.
  2. I would try putting at least one intermediate waypoint in the water between the 2 shores, putting group in FILE formation, and running this on the ai before they cross: { _x disableAI "FSM"; } foreach units group LeaderOfTeamThatIsSwimming; Disabling FSM tends to make units ignore formation and move directly to next point. Not sure if that will work well with swimming or not. If the above doesn't work, I would give each ai in the group a moveTo command when they are on starting shore, to a point on ending shore. This would have them move independently from the group. You can have a trigger on the ending shore that has them return to formation once they all have crossed. That should work, as they each unit will be pathing independently (like the leader does who you say actually makes it to the other side). You may need to disableAI "FSM" for this approach also.
  3. Maybe I'm not crazy after all and its not just me! Thanks for the slick test function.
  4. Thanks RCA3. That KillZone Kid example is what I based my experiments on. If you run that code you see the weapon line drawn which is exactly what I want to use to see if it intersects an AI unit. Unfortunately when I use this technique with any of the intersects commands, I can't get them to return the AI man object in the array of intersected objects. I'm probably doing something wrong, but can't figure it out. 😖
  5. Thanks Gizz, I'll try it out when I go into Arma later. But it may not work for me because, I think this test... ...is checking if eyepos shooter can see aimpos of target (if I understand this code correctly). What I want to know is if the weapon is pointing directly at the target. Example: Shooter is standing, and target is prone 5 meters away. If shooter is facing the target, and 2D weapon direction is toward target, that is not good enough, because weapon may be pointing above the prone target. What I need to know is if weapon is pointing down exactly at target (so if shooter was to shoot, they would hit the target).
  6. Thanks for the reply. I tried all the different intersects commands, and none of them were returning object of type "Man" though.
  7. I want to detect when ai unit is pointing his weapon at another ai unit. So I think I need to ray cast from weapon using weapon direction. I came up with this based on Killzone Kid's Bob example: _unit = dude1; _beg = eyePos _unit; _endW = (_beg vectorAdd (_unit weaponDirection currentWeapon _unit vectorMultiply 15)); objs = lineIntersectsWith [_beg, _endW]; When I test this, I have player stand directly in front of dude1 unit (and dude1 has his rifle raised and pointing at me), but player is never in the objs array. I do see plant and building objects in the objs array, but not the player object. What am I doing wrong? Is there a better way to return human object an ai is pointing his weapon at?
  8. Welcome back dude! Arma is punishing you for leaving, she can be a vengeful mistress. Now that you are hailing from Bigfoot Country, I expect to see Bigfoot appear in one of your campaign missions. Now get to work sir!
  9. johnnyboy

    LAMBS Improved Danger.fsm

    Also note that if you want to test if unit is refusing to suppress, use the currentCommand command after doSuppressiveFire. If unit successfully did some suppressive fire, then currentCommand returns "suppress" for some time. If unit did not successfully do suppressive fire, then currentCommand returns "". Maybe this can be tested to determine if unit should move to a better shooting position?
  10. johnnyboy

    LAMBS Improved Danger.fsm

    You can cure the "Negative"/"No can do" spam by temporarily disabling speaker. Replace code like this: p1 doSuppressiveFire t2; With this spawned code: _nul= [p1,t2] spawn { params["_shooter","_target"]; _speaker = speaker _shooter; _shooter setSpeaker "NoVoice"; _shooter doSuppressiveFire _target; sleep 1; _shooter setSpeaker _speaker; }; I just tested this and it works for me! Hope that helps.
  11. johnnyboy

    LAMBS Improved Danger.fsm

    Love your work man. For AI controlled groups, maybe adding some chatter would be good. In your video, you show the AI initial reaction to contact is to retreat first. If he had team mates, the leader could say "move back". During grenade reactions, if they sense grenade (thrower to the front of their position?) they could shout "incoming grenade". After getting hit with a grenade they can swear or grunt in pain. In my CQB AI script I'm working on, I have a function you can call that uses the unit's in-game voice (i.e., english, french, persian, etc.) to say the voice files. Here's the function if you want to use it:
  12. johnnyboy

    [RELEASE] Notification System

    Sweet. And I love your name btw! 🙂
  13. Excellent demonstration video Kenny, and very useful scripts. Thanks. For the fn_taskHunt script where units are patrolling casually initially, you might consider adding some code from my patrol chatter/lightsOnOff scripts. Rather than have lights on all the time, lights and chatter could occur less frequently, which can startle a player in a night mission when they don't see the patrol, then suddenly hear chatter or see a light come on. If you like the idea feel free to take some code. If not, no problem, your scripts are very cool as is.
  14. johnnyboy

    Interiors for CUP buildings

    Awesome contribution to the community. Thanks much!
  15. johnnyboy

    Singleplayer immersion

    EDIT: I just re-read the top post, and I don't think you were asking for a WAVE assault, so if that's true, you can totally ignore my suggestion below! Haha. To achieve all your goals, Wogz's code sounds great. However, it is relatively simple to create a very randomized wave assault mission using editor placed groups, waypoints, and a time-release loop. Like this: Place 6 assault groups around the town and name the groups g1,g2,g3,g4,g5,g6. Create series of waypoints for each group leading them to center of town (or wherever you want them to attack). The first waypoint for each should be close to group's starting position and contain this code in the waypoint: this lockwp true; lockwp true will force units to stop moving and wait until lockwp = false. Make all the intermediate waypoints that move the assault groups to town center have a placement radius of 200 or 300. This will guarantee their exact path differs each run. To start the wave assault, run a script like the following. It could be in your init.sqf or a trigger. assaultGroups = [g1,g2,g3,g4,g5,g6] call BIS_fnc_arrayShuffle; // randomize order of assault groups sleep 30; // Sleep however long you want before starting first group moving { _x lockwp false; // start group moving through their waypoints sleep (100 + random 100); // randomize delay time between starting each wave/group } forEach assaultGroups; I created a mission with this approach where I had assault groups coming by sea to a beach landing, and multiple land groups (infantry, mechanized infantry, and armor). It worked very well and was very re-playable and unpredictable, because : Order in which groups/waves attack is randomized Exact path each group follows is randomized by waypoint placement radius Time between releasing each wave is randomized When group's combat AI takes over, they are reacting to enemy presence and no longer following waypoints. Hope that helps. Good luck.
×