Jump to content

thedarkbird

Member
  • Content Count

    8
  • Joined

  • Last visited

  • Medals

Posts posted by thedarkbird


  1. EDIT: Various improvements

    If you don't want to cheat with a script like the reply above, the function 'reveal' (http://community.bistudio.com/wiki/reveal) might do what you need:

    - position your sniper

    - add a move waypoint very close by

    - set the waypoint to stealth (so your sniper lies down) and set it to 'Never fire'

    - synchronize this waypoint with a countdown switch trigger (say 5 seconds); it allows your sniper to get down and acquire the target

    - add a second waypoint on top of the first (move/hold, doesn't matter too much) and set it to 'Open fire'

    - in the init field of your sniper type: doStop this; this reveal targetname; while {alive targetname} do {this doTarget targetname;}; (avoid reposition; reveal the enemy unit; keep targeting and shooting until target is dead)

    - slide skill to max

    Example video (special forces marksman firing from 440m away, set to kill the middle man): http://www.youtube.com/watch?v=ea82ejyaa4k&hd=1

    • Like 1

  2. Just a simple carpetbombing script. It's well commented, so shouldn't be too hard to understand.

    Youtube video: http://www.youtube.com/watch?v=TWJX82YftUc&hd=1

    //**************************************************************************************************************
    //Script: carpetbomb.sqf
    //Version: 0.1b
    //Author: The Darkbird
    //Date: 04/2011
    //Usage: _null = ["startmarker", "endmarker", ripples, bombs, spreadx, spready, totaltime] execVM carpetbomb.sqf
    //Example: _null = ["start", "end", 50,5,15,170, 4] execVM "carpetbomb.sqf";
    //***************************************************************************************************************
    
    //Parameters
    _startmarker = _this select 0; //Marker to start bombing from
    _endmarker = _this select 1; //Marker to end bombing
    _ripple = _this select 2; //Number of bomb ripples
    _bombs = _this select 3; //Number of bombs per ripple
    _xspread = _this select 4; //Randomness in x-axis
    _yspread = _this select 5; //Randomness in y-axis
    _time = _this select 6; //Total time to complete the carpet bomb (indicative, due to overhead)
    
    //Location init
    _x1 = getMarkerPos _startmarker select 0; //Start x
    _y1 = getMarkerPos _startmarker select 1; //Start y 
    _x2 = getMarkerPos _endmarker select 0; //End x
    _y2 = getMarkerPos _endmarker select 1; //End y
    _z = getMarkerPos _startmarker select 2; //z, which is always the same
    
    //Calculations
    _deltax = (_x1 - _x2)/(_ripple-1); //Calculate delta x (= movement per ripple)
    _deltay = (_y1 - _y2)/(_ripple-1); //Calculate delta y (= movement per ripple)
    _delay = _time /_ripple; //Calculate delay between ripples
    
    if (isServer) then //Random function is local, so only execute on server in MP
    {
    for [{_i=0},{_i < _ripple},{_i = _i +1}] do //For every ripple do
    {
    		for [{_j=0},{_j < _bombs},{_j = _j +1}] do //For every bomb do
    		{
    			_gbu = "Bo_Mk82" createVehicle [_x1 + (random -_xspread) + (random _xspread), _y1 + (random -_yspread)+ (random _yspread) , _z]; //Make bomb
    			_gbu setDamage 1; //Detonate bomb
    		};//end for every bomb
    		_x1 = _x1 - _deltax; //Move x-position
    		_y1 = _y1 - _deltay; //Move y-position
    		sleep _delay; //Delay
    };//end for ever ripple
    };// end if
    


  3. The goal is to destroy all buildings of a base by lasing every building nearby. It works, however, the weak point is the laserpointer height: if it's located in a building (instead of on top), the bomber aircraft can't see it and it doesn't work.

    So basically it would be necessary to place the laser exactly on top of buildings...

    hideObject baselocation; //Hide base object
    hideObject marker;	//Hide marker object
    while {(getPos baselocation) distance (getPos marker) < 100} do //Only take out buildings near the baselocation object
    {
    _building = nearestBuilding baselocation; //Select the nearest building
    marker setPos (getPos _building); //Move the marker object to that building
    _lase = "LaserTargetW" createVehicle [getpos marker select 0, getPos marker select 1, 0]; //Make a laser
    _lase attachTo [marker, [0,0,3]]; //Attach the laser to the marker object, but 3 units higher ([b]WEAK POINT[/b])
     waitUntil {!alive _building}; //Let air vehicles bomb it to pieces
     deleteVehicle _lase; //When destroyed delete the laser 
     //Rinse and repeat
    };
    hint "Done lasing";
    

    Suggestions for improvement?


  4. EDIT: Nevermind, I just found out my stupid mistake. Function is ok, I just feeded it units instead of groups.

    I'm having this function to move enemy groups to the player position when an alarm is raised. It works like: [group1, group2, group3] execVM "movetoplayer.sqf"

    The problem is it only sets a waypoint for the first group in the array, not the others. All groups are identical (apart from their name). After spending hours on it, I really can't find it. Ideas?

    //For every group feeded to this function do
    for [{_i = 0}, {_i < count _this}, {_i = _i+1}] do
    {
    //Copy group to _group var
    _group = _this select _i;
    //Delete group's existing waypoints
    while {count waypoints _group > 0} do 
    {
    	deletewaypoint (waypoints _group select 0);
    };
    //Add waypoint to player location
    _group addWayPoint [position player, 0];
    //Set waypoint properties	
    [_group, currentWaypoint _group] setWaypointBehaviour "COMBAT";
    [_group, currentWaypoint _group] setWaypointSpeed "FULL";
    [_group, currentWaypoint _group] setWaypointType "MOVE";	
    };
    


  5. They can't come up with EVERY scenario. That's WHY you learn scripting !

    Next you'll be saying you want INTELLIGENT AI :bounce3:

    True, but they could have made some functions work better (i.e. more consistent), like setFriend or joinSilent in this case. I've been doing some mission editing for OFP: DR as well, and their system is better (but their game lacks realism, that's why I stick to Arma).

    The AI is hopeless, I won't even bother bringing it up :p


  6. The best thing to do, is have all of the civilians start as blufor by attaching each civilian to a group with a blufor who outranks them (a private attached to a colonel). Then make the bluefor have a probility of pressence to 0.

    Then put in each init "this setcaptive true" and then the trigger set them all to "civilian5 setcaptive false"

    Fast reply. Thanks a lot, it works :)

    Bad points for Bohemia tho. Things like this make mission editing a pain.


  7. EDIT2: Solved! (see post below this one).

    EDIT1: civ_unit addRating -10000 works, however, BLUFOR will kill the CIVILIANs as well. Since BLUFOR is around, this is not acceptable.

    First post here, since I've found all other solutions myself before. So yes I used the search function.

    What I want is fairly simple (I would think): OPFOR moves into a town (trigger), which suddenly makes them hostile to CIVILIANs. However, whatever code I put in the trigger action box does not work. Not setFriend, not joinSilent WEST, no nothing.

    Initlines, init.sqs and mission.sqm work, I know that. But that doesn't let you change sides during gameplay.

    (Background: I want a storyline of seemingly friendly troops getting in a town, acting all nice and friendly, then suddenly start killing people. Ok, kinda harsh, but... that could be life in a war torn country.)

    Thanks in advance.

    Slightly frustrated,

    B.

×