Jump to content

Metal Heart

Member
  • Content Count

    1019
  • Joined

  • Last visited

  • Medals

Posts posted by Metal Heart


  1. Setvelocity can be used on bullets, I just tested it. Vehicles too of course if you want wind on choppers and planes. To make matters even simpler, there's a new command in ArmA which returns the wind vector:

    http://community.bistudio.com/wiki/wind

    Adding wind to rounds is easy. Making it realistic according to the type of projectile however, is not, unless you happen to be a ballistics expert with tons of data on all kinds of rifle rounds, rockets, tank shells etc. Then again, the flight paths are probably incorrect to begin with.

    Example:

    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">// w_rifle.sqf

    _r = _this;

    _w = wind;

    while {!isNull _r} do

    {

    _v = velocity _r;

    _v set[0, (_v select 0)+((_w select 0)*0.2)];

    _v set[1, (_v select 1)+((_w select 1)*0.2)];

    _r setVelocity _v;

    sleep 0.05;

    };

    Sniper's init line:

    this addEventHandler ["Fired", {getPos(_this select 0) nearestObject (_this select 4) execVM "w_rifle.sqf"}];

    Adjust the 0.2 to get more or less effect.


  2. Usually when the precision isn't neccessary, you should use a loop instead of @ because @ checks the condition as fast as it can, like every frame or maybe even faster. With slow loops the condition will use much less cpu as in:

    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_object = _this select 0

    #wait

    ~2

    ?(_object distance player) > 100: goto "wait"

    player setDamage 1


  3. IMO, there's no need for over-complication like less winds behind obstacles, different elevations etc. Taking wind into account could simply be a single vector addition per cycle per flying projectile more, which is not much, and it could be a difficulty option.

    There's already wind in the game that affects particle effects and parachutes. Wind could even be added by a mod using "fired" evenhandlers, if you can use setvelocity on bullets. But a hard-coded solution would be more efficient and accurate on low-fps (I presume the engine runs physics cycles at a set rate which is not affected by low fps unlike scripts. Although, tanks launching into orbit etc might suggest otherwise).


  4. [object] exec "bomb.sqs"

    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">cutText ["Bomb in 30s", "PLAIN"]

    ~20

    cutText ["Bomb in 10...", "PLAIN"]

    ~1

    _i=9

    #loop

    _str = format ["%1", _i]

    cutText [_str, "PLAIN"]

    ~1

    _i=_i-1

    ?_i>0: goto "loop"

    cutText ["Detonation", "PLAIN"]

    _p = getpos (_this select 0)

    _i=0

    #loop2

    "Shell125" createVehicle [_p select 0, _p select 1, (0.1+random 0.5)]

    _i=_i+1

    ?_i<10: goto "loop2"


  5. : is then, as in:

    ?1==1 : player globalchat "1 is 1"

    and the same in human:

    if, 1 is equal to 1, then, execute this command

    ; separates commands on the same line, as in:

    player globalchat "hello"; loon1 globalchat "hi"; loon2 globalchat "hey"

    And there's no need for the gotos and #-tags, you'd only skip the delays (~) if they worked.

    I'm not sure if I recall correcly but you might need to create the bombs a bit in the air for them to explode, like:

    _p = getpos _bomb

    "Shell125" createVehicle [_p select 0, _p select 1, 0.2]


  6. I'd display the hand signals as icons, so the squad might actually notice and understand the orders.

    Not realistic but neither is the lack peripheral vision and men appearing to be about the size of lilliputs on your screen. Or having a bunch of twelve year old ADHD kids on a sugar rush as your squad.


  7. That won't work. _medic and _hurtguy aren't defined and there is no setHealth command.

    Try this:

    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_medic = _this select 0

    _treated = _this select 1

    _actionID = _this select 2

    ?_medic distance _treated > 3: exit

    ?"Man" countType [_medic] > 0: goto "medicman"

    _treated playmove "Treated"

    ~3

    _treated setdammage 0

    exit

    #medicman

    _medic playmove "Medic"

    _treated playmove "Treated"

    ~3

    _treated setdammage 0

    exit


  8. Use only one script for simplicity's sake and no triggers for stuff like distance.

    Something like:

    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

    #check_dist

    ?W_2 distance Civ_1 < 160: goto "w2speak"

    ?W_3 distance Civ_1 < 160: goto "w3speak"

    ?W_4 distance Civ_1 < 160: goto "w4speak"

    ~1

    ?W_2 distance Civ_2 < 160: goto "w2speak"

    ?W_3 distance Civ_2 < 160: goto "w3speak"

    ?W_4 distance Civ_2 < 160: goto "w4speak"

    ~1

    goto "check_dist"

    #w2speak

    W_2 SideChat "Sir, Civilians are coming up the hill from the south."

    exit

    #w3speak

    W_3 SideChat "Corporal, here's a couple walking over the hill trough the zone."

    exit

    #w4speak

    W_4 SideChat "Corporal, Sir! Two persons are coming towards the depot."

    exit

    Start from init.sqs or some single init line.

    And I don't think that corporals are called Sirs anywhere smile_o.gif


  9. Quote[/b] ]Most of the frame count actually goes on running FRAPS itself. You can check this by pressing 'record' and watching the frame count plummet (FRAPS is working harder).

    Uh, really? Capturing video makes the frame rate drop? Oh noes, what an awful program rofl.gif

    Seriously though, if you get a huge fps drop when capturing video, the problem is most likely a slow hard drive, not Fraps itself.


  10. That airstrike script is made for single player. The reason it doesn't work is because the script is only executed on a client when he mapclicks, but a client can't run the script because it exits unless server is local. You would also have as many airstrikes as there are players because the radio trigger that sets up the map click is executed on everyone so each player could start the script once. camCreate created stuff, marker commands, sideChat and setRadioMsg are all local.

    Try naming the players' group and change the radio alpha trigger onActivation so that only the leader gets the mapclick:

    if(player==leader groupname) then {onMapSingleClick{[_pos] exec "airstrike.sqs"}}

    Remove the local server condition and change the camCreates in the script to createVehicle.

    Note that players other than the leader can execute radio alpha, bravo etc by clicking on the radio that's visible on the map screen and then the trigger is activated again for everyone so you might want a global variable to see if the airstrike has been already called. Like a few lines in the beginning of the script:

    ?airstrikecalled==1: hint "No more airstrikes available."; exit

    airstrikecalled=1

    publicvariable "airstrikecalled"

    ...

    The second one, just a guess but try placing an invisible H where the chopper is supposed to land or change the command to:

    helo land "land"

×