Jump to content

Melmarkian

Member
  • Content Count

    123
  • Joined

  • Last visited

  • Medals

Posts posted by Melmarkian


  1. I actually used a global variable. Because there is only 1 group + a chance of a second reinforcementgroup I return the group created in the function.I created a trigger in the editor which counts the units of the group and a variable which is true as long as the spawn is active.

    patrolactive AND ({alive _x} count units activegroup) < 1

    &

    reinforcementsactive AND ({alive _x} count units reinforcementsgroup) < 1

    works pretty good and if I want more groups it's not too complicated to expand. I am working at the moment on a threat system with enemy patrols from different bases and guessed positions of the player depending on his actions.

    btw: thanks for your SHK_pos. It helped me a lot to create random patrol points around the guessed positions.


  2. The triggerstatement looks like this:

    ["({alive _x} count [b 1-1-D:1,B 1-1-D:2]) < 2","hintc 'Dead!'",""]

    I think this should work because it doesn´t need to change the units inside the count [array]. It just checks if they are alive.

    But i still get the errors:

    Error in expression <({alive _x} count [b 1-1-D:1,B 1-1-D:2]) < 2>
     Error position: <1-1-D:1,B 1-1-D:2]) < 2>
     Error Missing ]
    Error in expression <({alive _x} count [b 1-1-D:1,B 1-1-D:2]) < 2>
     Error position: <B 1-1-D:1,B 1-1-D:2]) < 2>

    seems like the engine doesn´t understand the unit names.

    B 1-1-D:1 

    Edit:

    Tested a bit:

    call compile format ["count [%1, %2]", josh1, operator1];

    works because it actually writes josh1 and operator1 inside the array.

    call compile format ["count %1", (units group player)];

    is the same error as always. It writes the B 1-1-1D:1 type unitnames for the unnamed units. So it would work if all units in the group had set variablenames.


  3. Thank you again! :)

    Edit:

    Still the same problem with the syntax. rpt says:

    Error in expression <({alive _x} count units O 1-1-D) < 1>
     Error position: <1-1-D) < 1>
     Error Missing )

    Seems to be a problem with how the content of _group is written in the text.

    And had to write the format a bit different because it doesn´t work with two strings:

    _triggerStatement = format["({alive _x} count units %1) < 1",_group];
       _deathtrigger setTriggerStatements [_triggerStatement,"patrolactive = false; hintc 'Dead!'", ""];


  4. Hi,

    I am testing now for hours to get a script created trigger to work. I create a group with a function which includes a trigger to check if the unit is still alive. Here are the important parts:

    _group = _this select 0;
    
    _deathtrigger = createtrigger ["EmptyDetector", getpos player];
    _deathtrigger setTriggerArea [0,0,0,false];
    _deathtrigger setTriggerActivation ["BLUFOR", "EAST D", false];
       if (debugshow) then {hintc "deathtrigger!";};
       _deathtrigger setTriggerStatements ["({alive _x} count units _group) < 1","patrolactive = false; hintc 'Dead!'",""];

    I always get the debug hint "deathtrigger!" but the trigger never activates. Could it be that _group is not the same variable in the trigger?

    I also checked the condition seperate with the name of the actually spawned group and the unit counting works.

    Edit:

    Maybe this could work:

    call compile format ["_deathtrigger setTriggerStatements ['({alive _x} count units '%1') < 1','patrolactive = false;',''];", _group];

    but I don´t get the syntax right with all this strings.


  5. Hi,

    I have two questions about a short script I wrote. First here it is:

    heavysupport = [getpos spawn2, EAST, ["T72_TK_EP1", "T72_TK_EP1", "ZSU_TK_EP1", "V3S_Open_TK_EP1"]] call BIS_fnc_spawnGroup;
    engineersquad = [getpos spawn3, EAST, ["TK_Soldier_Engineer_EP1", "TK_Soldier_Engineer_EP1", "TK_Soldier_Engineer_EP1","TK_Soldier_Engineer_EP1","TK_Soldier_Engineer_EP1","TK_Soldier_Engineer_EP1"]] call BIS_fnc_spawngroup;
    
    heavywp1 = heavysupport addWaypoint [getpos spawn2, 0];
    heavywp1 setWaypointType "LOAD";
    heavywp1 setWaypointTimeout [5,5,5];
    
    engineerwp1 = engineersquad addWaypoint [getpos spawn2, 0];
    engineerwp1 setWaypointType "GETIN";
    engineerwp1 setWaypointTimeout [5,5,5];
    
    heavywp1 synchronizeWaypoint engineerwp1;
    
    
    heavywp2 = heavysupport addWaypoint [getMarkerPos "us", 0];
    heavywp2 setWaypointType "TR UNLOAD";

    I create two groups with the BIS_fnc_spawngroup and there is the first problem: The group heavysupport spawns with the vehicles nearly on the same spot. They are almost on top of each other. Is there a way to spread them a bit with the function? Or do I have to spawn them with createunit in different positions?

    Second question:

    I created waypoints to get the engineersquad into the V35 of the heavysupport. I thought I had to use synchronizeWaypoint but they are just ignoring the sync.

    Thanks in advance!


  6. Hi,

    I have something new:

    free = false;
    _civs = [civ1, civ2, civ3, civ4, civ5];
    {_x disableAI "Move"} foreach _civs;
    
    
    civ1 switchMove "ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_Sykes";
    civ2 switchMove "ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_Ohara";
    civ3 switchMove "ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_Cooper";
    civ4 switchMove "ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_Rodriguez";
    civ5 switchMove "ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_Sykes";
    
    
    civ1 addEventHandler ["AnimStateChanged", {civ1 switchMove "ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_Sykes"}];
    civ2 addEventHandler ["AnimStateChanged", {civ2 switchMove "ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_Ohara"}];
    civ3 addEventHandler ["AnimStateChanged", {civ3 switchMove "ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_Cooper"}];
    civ4 addEventHandler ["AnimStateChanged", {civ4 switchMove "ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_Rodriguez"}];
    civ5 addEventHandler ["AnimStateChanged", {civ5 switchMove "ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_Sykes"}];
    
    waitUntil {free};
    
    civ1 removeEventHandler ["AnimStateChanged", 0];
    civ2 removeEventHandler ["AnimStateChanged", 0];
    civ3 removeEventHandler ["AnimStateChanged", 0];
    civ4 removeEventHandler ["AnimStateChanged", 0];
    civ5 removeEventHandler ["AnimStateChanged", 0];
    
    {_x switchMove "";_x enableAI "Move";} foreach _civs;

    This one gives the civs the command to change to the given animation when their animations would change.

    After free is true the eventhandlers are removed.

    Hope that helps you!


  7. Hi,

    I know atleast the first aid modules can be resynced when you create new modules and do the resync with them. I done it like that:

    revivelogicgroup = createCenter sideLogic;
    revivegrouplogic = createGroup revivelogicgroup;
    
    waitUntil {!alive adam};
    
    deleteVehicle ais_reviver1;
    deleteVehicle ais_reviver2;
    deleteVehicle ais_reviver3;
    
    waitUntil {alive adam};
    
    ais_reviver1 = revivegrouplogic createUnit ["AlternativeInjurySimulation", [0, 0, 0], [], 0, ""];
    ais_reviver1 synchronizeObjectsAdd [player];
    
    ais_reviver2 = revivegrouplogic createUnit ["BattleFieldClearance", [0, 0, 0], [], 0, ""];
    ais_reviver2 synchronizeObjectsAdd [player];
    
    ais_reviver3 = revivegrouplogic createUnit ['FirstAidSystem', [0, 0, 0],[],0,'NONE'];
    ais_reviver3 synchronizeObjectsAdd [player];

    But there is one big thing: The injury system works normal for the joined/spawned units but the first aid action will not respond.


  8. so, how you use that anyway? the wiki does'nt explain much :\

    You could for example do it like this:

    In the first mission put this somewhere:

    hello = "hello world"; saveVar "hello";

    In the next mission you can type:

    hint hello;

    And the hint will say: hello world

    Here is an example

    http://www.mediafire.com/?j9n7stryi9v484j

    In the player units init-field is the saveVar defined and in the second mission you return it via radio bravo


  9. so please add in start locations on the briefing screens :)

    and maybe start times as well.

    I wasn´t even aware that you don´t see yourself on the map in higher difficulties! Will add them.

    additionally, in several cases i have seen russian soldiers, napa fighters and some ChDKZ fighters in missions. is this intentional or just an accident?

    i most cases it just seems like you placed the wrong unit in the editor, because these guys are mixed in with the takis

    A few russians should be there because I used their vehicles and didn´t replaced the crews.

    But napa and ChDKZ? Wow, I never noticed them myself. Will fix it if I find them. Thanks!

    So this weekend:

    - check the texts

    - add startmarkers

    - mixed infantry

    - find a workaround for the rifle in mission 4

    How about the gear selection? Enough weapons or already too much?


  10. Thanks for the feedback so far!

    I will have a look at the texts again and see what I can do.

    @that guy

    I added the rifle via addweaponcargo, seems to not working anymore with the patch.

    I did blow him up with a satchel charge the last time

    About the scenario:

    I didn´t like how the US just rolled over Takistan in the OA campaign. I imagined Takistan to be more modern and wanted to make the conflict balanced. Maybe the Takis have the real russian wargear or simply use their home advantage and have good intelligence to counter the US troops.


  11. Hi,

    I finally finished my first campaign. So here it is

    Broken Arrow

    brokenarrow.jpg

    Overview:

    You are Adam Stein, leader of a small team of the US Army in the war against the Republic of Takistan. The first week of the attack was a success. The USA have captured a major Airport in south of Takistan and preparing for the assault into the northern territories. But....

    Features:

    - A revive system for your AI buddys: You will lose the missions when one of your teammembers die. To make this less frustrating they have several "lives". After they died they will respawn in the Agony state. You will have to heal them through your team medic or use the "Heal your men" action on them. First Aid doesn´t respond after they have respawned, so I had to add the extra healaction. Your medic will patch himself up after a short amount of time.

    - Intro/Outro for the missions

    - Your Equipment and your Inventory will be carried from mission to mission.

    - Build a small Teamswitch for the last mission (works different than the BIS one)

    - UPSMON!

    Requirements:

    - no addons required

    - I used the version 1.59 to test the campaign

    Credits:

    Demonized & TWIRLY - for the help in the Scripting Forum

    ToddRivers - for the feedback on my missions

    Monsada & Rafalski - for the great UPSMON

    Norrin - for the inspirations on the revive-system

    Armaholic for the great support of the game!

    I know that the first few missions are already released, but I changed them a bit to spice it up. Difficulty will get higher when you are nearing the end of the campaign. And be sure to check your weapons before you start the mission, as you start with the inventory from the last one.

    I am sure there are some things I have not thought about and will break the missions. So please report any bugs or broken tasks back to me.

    Thanks to the community and have fun!

    Download Broken Arrow

    http://www.mediafire.com/?g25g36dzma4fnfe

    Armaholic mirror:

    - Broken Arrow


  12. Hi,

    Is there a way to sync the spawned and joined units to the first aid modules?

    I found some older threads about the issue and wanted to ask if someone found a solution to the issue?

    I can sync them to newly spawned and joined unit with new created modules and synchronizedObjectsAdd. The wounds work on them (Agony state) but the First Aid action shows up but doesn´t respond. Dragging and carrying works without problem.


  13. I looked over your script and found some errors:

    - It doesn´t work with an Array as _side.

    - At the last part it just checked if undercover was true. Instead it should have checked if caught was true.

    I modified it and this works on my machine (not tested on MP), but just with one side. I will see what can be done with two sides.

    private ["_nearestunitofside","_unit","_random","_alertmessage","_nearestunits","_bomber","_radius","_getaway","_side"];

    _bomber = player;

    _radius = 150;

    _getaway = 300;

    _side = EAST;

    _bomber addEventHandler ["Fired", {_bomber setVariable ["shot", true];}];

    _bomber setVariable ["shot", false];

    _bomber setVariable ["undercover", true];

    _bomber setVariable ["caught", false];

    sleep 1;

    while {(alive _bomber) AND (_bomber getVariable "undercover")} do {

    _bomber setVariable ["shot", false];

    _bomber setCaptive true;

    _bomber setVariable ["caught", false];

    sleep 2;

    while {primaryWeapon _bomber!= ""} do {

    _bomber setCaptive false;

    hintSilent "You carry a weapon!";

    sleep 3;

    };

    _nearestunits = nearestObjects [_bomber,["Man","Car","Tank"],_radius];

    _nearestunitofside = [];

    if(_side countSide _nearestunits > 0) then{

    {

    _unit = _x;

    if(side _unit == _side) then{_nearestunitofside = _nearestunitofside + [_unit]};

    } foreach _nearestunits;

    if ((_bomber getVariable "shot") AND (count _nearestunitofside != 0) AND ((_nearestunitofside select 0) distance _bomber < _getaway - 50) ) then {

    _bomber setVariable ["caught", true];

    hint "Someone must have heard the shot!";

    sleep 4;

    _bomber setCaptive false;

    (_nearestunitofside select 0) domove position _bomber;

    };

    if((_nearestunitofside select 0) distance _bomber < 20) then {

    sleep 4;

    if((_nearestunitofside select 0) distance _bomber < 20 ) then {

    _random = floor(random 3);

    _alertmessage = ["Watch Out!", "Keep Distance!", "Someone´s watching us", "They notice you!"] select _random;

    call compile format ["hint '%1';", _alertmessage];

    sleep 8;

    if((_nearestunitofside select 0) distance _bomber < 14 ) then {

    _bomber setVariable ["caught", true];

    _bomber setCaptive false;

    hint "THEY HAVE FOUND YOU";

    sleep 4;

    (_nearestunitofside select 0) glanceAt _bomber;

    (_nearestunitofside select 0) reveal _bomber;

    sleep 7;

    };

    };

    };

    };

    while {(_bomber getVariable "caught")} do {

    _nearestunits = nearestObjects [_bomber,["Man","Car","Tank"],_radius];

    _nearestunitofside = [];

    if(_side countSide _nearestunits > 0) then{

    {

    _unit = _x;

    if(side _unit == _side) then{_nearestunitofside = _nearestunitofside + [_unit]};

    } foreach _nearestunits;

    hintSilent "Get Away";

    sleep 4;

    if(((_nearestunitofside select 0) distance _bomber > _getaway) OR ((_nearestunitofside select 0) knowsAbout _bomber < 1.4) OR (count _nearestunitofside == 0)) then { hint "You should be safe now"; _bomber setVariable ["caught", false]; _bomber setVariable ["caught", false]; };

    };

    };

    };

    Changed it a bit more and now it works with both sides:

    private ["_nearestunitofside","_unit","_random","_alertmessage","_nearestunits","_bomber","_radius","_getaway","_side"];

    _bomber = player;

    _radius = 150;

    _getaway = 300;

    _side = [WEST,EAST];

    _bomber addEventHandler ["Fired", {_bomber setVariable ["shot", true];}];

    _bomber setVariable ["shot", false];

    _bomber setVariable ["undercover", true];

    _bomber setVariable ["caught", false];

    sleep 1;

    while {(alive _bomber) AND (_bomber getVariable "undercover")} do {

    _bomber setVariable ["shot", false];

    _bomber setCaptive true;

    _bomber setVariable ["caught", false];

    sleep 2;

    while {primaryWeapon _bomber!= ""} do {

    _bomber setCaptive false;

    hintSilent "You carry a weapon!";

    sleep 3;

    };

    _nearestunits = nearestObjects [_bomber,["Man","Car","Tank"],_radius];

    _nearestunitofside = [];

    if(_side select 0 countSide _nearestunits > 0 OR _side select 1 countSide _nearestunits > 0) then{

    {

    _unit = _x;

    if((side _unit == _side select 0) OR (side _unit == _side select 1) ) then{_nearestunitofside = _nearestunitofside + [_unit]};

    } foreach _nearestunits;

    if ((_bomber getVariable "shot") AND (count _nearestunitofside != 0) AND ((_nearestunitofside select 0) distance _bomber < _getaway - 50) ) then {

    _bomber setVariable ["caught", true];

    hint "Someone must have heard the shot!";

    sleep 4;

    _bomber setCaptive false;

    (_nearestunitofside select 0) domove position _bomber;

    };

    if((_nearestunitofside select 0) distance _bomber < 20) then {

    sleep 4;

    if((_nearestunitofside select 0) distance _bomber < 20 ) then {

    _random = floor(random 3);

    _alertmessage = ["Watch Out!", "Keep Distance!", "Someone´s watching us", "They notice you!"] select _random;

    call compile format ["hint '%1';", _alertmessage];

    sleep 8;

    if((_nearestunitofside select 0) distance _bomber < 14 ) then {

    _bomber setVariable ["caught", true];

    _bomber setCaptive false;

    hint "THEY HAVE FOUND YOU";

    sleep 4;

    (_nearestunitofside select 0) glanceAt _bomber;

    (_nearestunitofside select 0) reveal _bomber;

    sleep 7;

    };

    };

    };

    };

    while {(_bomber getVariable "caught")} do {

    _nearestunits = nearestObjects [_bomber,["Man","Car","Tank"],_radius];

    _nearestunitofside = [];

    if(_side select 0 countSide _nearestunits > 0 OR _side select 1 countSide _nearestunits > 0) then{

    {

    _unit = _x;

    if(side _unit == _side select 0 OR side _unit == _side select 1) then{_nearestunitofside = _nearestunitofside + [_unit]};

    } foreach _nearestunits;

    hintSilent "Get Away";

    sleep 4;

    if(((_nearestunitofside select 0) distance _bomber > _getaway) OR ((_nearestunitofside select 0) knowsAbout _bomber < 1.4) OR (count _nearestunitofside == 0)) then { hint "You should be safe now"; _bomber setVariable ["caught", false]; _bomber setVariable ["caught", false]; };

    };

    };

    };

    I hope that helps you


  14. Hi,

    Here is a mission that does something like this.

    http://www.mediafire.com/?lr5d243zevpca64

    One unit will run to the unit wounded, pick him up and run to the SUV. But it looks a bit weird. I used a few animations to simulate this and attached the wounded to the first unit.

    Just dragging the wounded unit would work and look better.

    I tried to find a action for dragging and carrying but it seems there aren´t any.

×