Jump to content

_qor

Member
  • Content Count

    294
  • Joined

  • Last visited

  • Medals

Posts posted by _qor


  1. Hey there,

    I want to add an action to an MTVR when being in triggerlist.

    This MTVR is created by an respawn script so its name isnt fix or known. Besides, I want to add the action to every MTVR in list.

    So I am searching for sth like forEach class "MtvrReammo" list triggerABC or forEach type "MtvrReammo" list triggerABC.

    Or perhaps I can do this in script like _truck = class "MtvrReammo" list triggerABC ...

    Hope you guys can help me!

    Thanks in advance!


  2. Thank you all!

    But although I will use survivorluz's code, I am still asking myself why this array doesnt work.

    I already read the array beginner's guide, but it doesnt answer my question.

    So when using _this = [box1, box2, box3], _this would contain box1, box2 and box3.

    Cant I pass on all this content to a code with one variable?


  3. Hey there,

    I never really worked with arrays, so I have got a simple question about it.

    There are 3 ammocrates and I want to fill them up all with the same weapon gear.

    So I tried to do this:

    _this = [box1, box2, box3];
    
    _this addWeaponCargo...
    _this addMagazineCargo...

    But apparently this is not the way arrays work ;)

    I just want to avoid to paste _this select 1/2/3 to each ~50 lines.

    So is there a way to simplify this with an array, or do I have to achieve it with another code?

    Thanks for help!


  4. Hey there,

    I have got some problem with my script which should evaluate which side currently occupies a checkpoint.

    Just like the battlefield checkpoints.

    __________________________________________________

    __________________________________________________

    Setup:

    HOME1trigger:

    fires when ANYBODY is inside and then executes the script.

    To have a control about start and stop of the script, I set the variable HOME1counter which the trigger sets to true before executing the script.

    script:

    
    
    _trig = HOME1trig;
    _counter = HOME1counter;
    
    
    
    
    while {_counter} do {
    
    
    if (west countSide list _trig > 0 AND east countSide list _trig == 0) then {
    
    	while { (west countSide list _trig > 0 AND east countSide list _trig == 0) } do
    
    	{
    
    	HOME1ratioW = HOME1ratioW +1;
    	sleep 1;
    
    	}; };
    
    
    
    
    
    
    if (east countSide list _trig > 0 AND west countSide list _trig == 0) then {
    
    	while { (east countSide list _trig > 0 AND west countSide list _trig == 0) } do
    
    	{
    
    	HOME1ratioE = HOME1ratioE +1;
    	sleep 1;
    
    	}; };
    
    
    
    
    
    if (west countSide list _trig > east countSide list _trig AND east countSide list _trig > 0) then {
    
    	while { (west countSide list _trig > east countSide list _trig AND east countSide list _trig > 0) } do
    
    	{
    
    	HOME1ratioW = HOME1ratioW +1;
    	sleep 2;
    
    	}; };
    
    
    
    
    
    
    if (east countSide list _trig > west countSide list _trig AND west countSide list _trig > 0) then {
    
    	while { (east countSide list _trig > west countSide list _trig AND west countSide list _trig > 0) } do
    
    	{
    
    	HOME1ratioE = HOME1ratioE +1;
    	sleep 2;
    
    	}; };
    
    
    sleep 3;
    
    
    };
    
    
    

    Another two triggers fire, when HOME1ratioW reaches the value 10.

    Then, HOME1ratioW is reset to 0 and HOME1counter is set to false to stop the script.

    So there are 4 possible scenarios which are represented by the 4 if-statements:

    only west present

    only east present

    west AND east present AND west > east

    east AND west present AND east > west

    __________________________________________________

    __________________________________________________

    Problem

    So far, it works perfectly.

    Unfortunately there is one problem: when one side eliminates the units which occupied the checkpoint, their point counter doesnt act as expected.

    Sometimes 2 points are added, so the side takes the checkpoint too fast.

    Cant get out why this happens, I thought the greater while-loop was the reason, but deleting it showed it isnt...

    Curious is, that this problem only happens in this scenario!

    I am absolutely despairing of it because the longer I try to get the problem the more I think there is none ._.

    //at the moment I think the problem is that the script runs twice. but terminating the script stops the countSide check...

    >got it! I set the HOME1trig to repeatedly. So everytime it fires, another instance of the script is running so that the script may run fivefold...

    update is coming, improvements for the script are still welcomed :)

    Any suggestions to improve the script or the setup are still welcomed.

    Perhaps there is a quite different way to set up this scenario?


  5. Right!

    So when the units within the trigger area die, the trigger should be deactivated. When another unit which is outside the trigger area then enters the trigger area, the trigger should fire again.

    Anyway, this scenario works when I simply do it with a trigger and 2 units inside/outside. But not with this OnAct: hint "active"; HOME1counter = true; script = [] execVM "CHECKPOINTS\takeover.sqf".

    Cant see any other reasons. And dont even see this is a reason...


  6. Hey folks,

    I have got some troubles with a trigger which should fire each time ANYBODY is PRESENT.

    Scenario: enemy units within trigger area activated the trigger once. A group standing outside the trigger area now shoots the enemies and moves inside the trigger area.

    Unfortunately the trigger doesnt get activated when the group moves inside.

    I tried this scenario without my OnAct settings of the trigger and it works as it should. What might prevent the trigger from firing when new units move inside?

    Trigger (HOME1trig)

    OnAct: hint "active"; HOME1counter = true; script = [] execVM "CHECKPOINTS\takeover.sqf"

    takeover.sqf

    HOME1ratioW = 0;

    HOME1ratioE = 0;

    if ((west countSide list HOME1trig > east countSide list HOME1trig)) then {

    while { (west countSide list HOME1trig > east countSide list HOME1trig) AND (HOME1counter) } do {

    HOME1ratioW = HOME1ratioW +1;

    sleep 1;

    }; };

    if ((west countSide list HOME1trig < east countSide list HOME1trig)) then {

    while { (west countSide list HOME1trig < east countSide list HOME1trig) AND (HOME1counter) } do {

    HOME1ratioE = HOME1ratioE +1;

    sleep 1;

    }; };

    Trigger to cycle:

    Condition: HOME1ratioW == 10

    OnAct: playSound "CodeBad"; hint "WEST dominates"; HOME1counter = false; "HOME1_west" setMarkerColor "ColorBlue"

    There is an equivalent trigger for firing when HOME1ratioE == 10


  7. Hey,

    To adapt the respawn to my conveniences, I created a trigger with conditions which executes this simple script:

    _x1 = group SBlogic createUnit ["US_Delta_Force_Assault_EP1", getMarkerPos "respawn_SB", [], 0, "NONE"];
    
    _x1 setDir 245;
    
    addSwitchableUnit _x1;
    
    removeAllWeapons _x1;
    
    disableUserInput true;
    
    sleep 20;
    
    disableUserInput false;
    
    playSound "CodeBad";

    So via team switch I can switch to that spawned unit.

    Unfortunately there came up some disadvantages from this method:

    First of all, I cant set a delay because once the "end" screen pops up, the menu doesnt seem to update. So I cant choose "team switch".

    Therefore I used disableUserInput but menu points like "restart" and "end" are disabled as well.

    But biggest problem is: after switching to the spawned unit, there are no actions at all. Cant switch weapons, cant get in vehicles, no open door action...

    So I guess there must be another respawn method :D

    Guess there is no way to have a condition for that using the description.ext respawn, is it?

    I would welcome to write a simple script on my own.

    How do you guys set this up?


  8. Alright I will try this out!!!

    nearestObjects may be a solution, but I need to have an ellipse not a radius. And a certain angle of that area.

    It is really frustrating that I just cant use the trigger area I already created in the editor by using forEach vehicles thislist !

    So those are all workarounds which doesnt work the way I want it.

    Is there really no way to refer to the list of vehicles inside a trigger?


  9. Hey,

    I want to add an action for each vehicle which is in the list of a trigger. So I would use this code:

    {_x addAction ["LOAD VEHICLE","Support\constructions.sqf","ConStru",1,false,false,"","((_target distance _this) <6)"]} forEach vehicles thislist

    Unfortunately this is not possible. But I dont know what might be wrong with "forEach vehicles thislist".

    In other cases I already noticed that referring to vehicles in triggers is kinda impossible. Hope you can help out!

    Thanks in advance!


  10. Hey,

    I am not sure if I very miss something but I really cant get out how to manage that!

    Lets say my condition is _x isKindOf "LAND". I want the trigger to fire each time a vehicle of this kind is in its list. Even if there already is such a vehicle.

    So I cant use count thislist > 0 and in thislist doesnt work as well.

    Really, how is this possible? 0o

    thanks in advance, I really must have missed something


  11. You cannot switch from the guard waypoint to the next waypoint and then back to the guard waypoint.

    Switching only cancels the guard waypoint and units will move the their next given waypoint if they have. You need to create a new guard waypoint to have them guard again.

    Your question is how to write the code in a script?

    triggername synchronizeTrigger [waypointname];

    The trigger can be created in the editor or by script, you just have to give it a time. I dont know how to give a waypoint a name by editor, so I only use scripted waypoints.

    Remember that the trigger you synchronize to a waypoint must be a SWITCH trigger. Besides, you have to set it to a condition that makes it triggering when the GUARD waypoint should get switched.


  12. You are right!

    My problem was that groups often act strange with GUARD waypoints. Because the GUARD waypoint doesnt end automatically (as MOVE waypoints do when reached), you can use a SWITCH trigger to make the group move to the next waypoint.

    For example: supporting infantry which have a GUARD waypoint, you can make them cancel that support when enemies are gone. Of course this very depends on your scenario!

    You can do this in the editor by synchronizing a trigger with the GUARD waypoint, or by script using the code I already posted.

    The GUARD waypoint is still kinda mystery to me because it seems units do not act always the same.

    In this case, I only send them to a marker which just didnt exist -.-


  13. Hey,

    I have got a problem with GUARD waypoints.

    It seems that this waypoint sometimes causes units to act strangely - or at least I dont get the reason.

    E.g. groups run in any direction through the whole map, perhaps pursuing enemies, but I cant find those.

    But using GUARD waypoints offers the advantage that groups either have a higher awareness or a connection to other groups under attack.

    So they will defend their area by getting information about enemies from near friendly groups.

    After doing so, I would like to have them to stop GUARD. In the editor this works with a SWITCH trigger. But how would I do this with scripted triggers/waypoints?

    Creating a SWITCH trigger by script requires to sync it with the waypoint. Dont know how to do that.

    Thanks for your help ;)

    EDIT:

    okay sorry I found a code for that. I have been misled by another post saying there is no way to do that...

    _trigger synchronizeTrigger [_waypoint];


  14. Hey there,

    this is for a pickup script: I cant find out how to stop the heli on its way.

    The heli has a MOVE waypoint. To cancel the pickup or to give new coordinates, I want to stop the heli in air.

    doStop, commandStop or stop true are all useless codes so far.

    The heli stops with commandStop, but I cant make it go on flying afterwards. I expect the other codes to work if the heli has received a move command, but not with waypoints.

    Even deleting the waypoint doesnt work.

    Would be great if you can help me ;)


  15. There are some patrols with a about 6 MOVE waypoints and a Cycle one.

    When I call a heli which then flies back to base, the AI runs after it through the map.

    I observed them one time until they almost reached the heli. After some "tweaking" it seems that the AI only stays in COMBAT mode indefinitely without running after the heli.

    At the moment it seems to be fixed by waypoint modes.

    But I really dont know what made them pursuing the heli through the whole map 0o


  16. Yaaa I know all that stuff.

    But isnt it wrong that the AI pursuit a heli through the whole map? Yes, I observed them the whole way ;D

    After climbing mountains up and down, they laid down about 2 clicks from the landed heli and.... waited!

    That seems to be really wrong in any set behaviour, combar mode and waypoint type!

    Doesnt it?

    I already noticed this before when a group stayed in COMBAT mode and didnt switch back to AWARE (area clear).

    So they crawled around although there was no enemy for more than 20 minutes.

    It wasnt even possible to set them to AWARE by code. They just stayed in COMBAT mode.

    Have you got a solution for that?

    If not, I am looking for how to get the AI back to their actual waypoint course and "AWARE" mode - or to find out if my AI acts differently from the standard ;)

    Cant find a code for that...

    EDIT

    Possible that waypoint formations like Columne (compact) and Delta make these problems?

    It seems that the game checks the distance between leader and the 2nd groupmember not correctly in these formations.

    Therefore, the leader doesnt go on walking because the 2nd leader isnt within a certain distance.

    The leader waits for his group indefinitely and doesnt give the "area clear" command.

    Known bug? Bullshit?^^

    This wouldnt explain why the AI pursued the heli through the whole map...


  17. Hey,

    I noticed that AI pursuits enemies for unlimited distance and time. Only if the enemy died, AI will switch back to AWARE and will return to given waypoints.

    Did somebody notice the same?

    For my mission this is a really disturbing problem.

    So I want to disable this by creating a trigger which makes groups to not target anything or anybody.

    This would work best by fire the trigger when the enemy is in a certain distance.

    I also tried to make the group doWatch and doTarget objNull. But this doesnt change anything for their behaviour.

    Thanks for your help ;)


  18. Hey, I am trying a little heli extraction script to get out of warzone if necessary.

    The basics work so far but unfortunately only once.

    Requesting the heli a second time, it moves to the marked point on the map but doesnt land.

    Additionally, the "receiving coordinates, we are on the way" side chat appears before I click on the map...

    Here the three scripts:

    playSound "Beep";
    
    player sideChat "requesting air pickup from [sB]";
    
    sleep 9;
    
    
    if (SBair1PU) then {	playSound "Beep";
    
    	SouthBase sideChat "[sB] air pickup has been admitted and waits for your call";
    
    	SBair1call = player addAction ["Call [sB]AirPickup","Supports\Pickups\_pickup.sqf","SBair1",1,false,false,"","((_target distance _this) <4)"]; 
    
    	SBair1PU = false;
    
    	} 
    
    	else
    
    	{
    
    	playSound "beep";
    
    	SouthBase sideChat "[sB] air pickup is currently not available";
    
    	};

    _pickups.sqf

    _recruit = _this select 3;
    
    switch (_recruit) do
    {
    
    
    
    
        case "SBair1": 
    
    
    {
    
    player removeAction SBair1call;
    
    hint "mark LZ position on your map to send coordinates";
    
    onMapSingleClick "PUhelipad1 setPos (_pos); grpSBair1 move _pos; click = true; playSound 'CodeBad'; onMapSingleClick ''; ";
    
    waitUntil {click};
    
    sleep 1.5;
    
    playSound "beep";
    
    SBair1 sideChat "receiving coordinates, we are on the way";
    
    waitUntil {unitReady SBair1};
    
    SBair1 land "PUhelipad1";
    
    waitUntil {getPosATL SBair1 select 2 < 1};
    
    sleep 3;
    
    SBair1clear = SBair1 addAction ["All clear, ready to takeoff","Supports\Pickups\_allClear.sqf","SBair1",1,false,false,"","((_target distance _this) <4)"];
    
    
    
    
    
    
    
    
    
    };

    _allClear.sqf

    _recruit = _this select 3;
    
    switch (_recruit) do
    {
    
    
    
    
        case "SBair1": 
    
    
    {
    
    SBair1 removeAction SBair1clear;
    
    playSound "CodeBad";
    
    grpSBair1 move (getPos SBair1H);
    
    waitUntil {unitReady SBair1};
    
    SBair1 land "SBair1H";
    
    waitUntil {getPosATL SBair1 select 2 < 1};
    
    sleep 1;
    
    hint "extraction done"; 
    
    sleep 10;
    
    SBair1PU = true;
    
    };
    

    okay I gave myself the hint ;)

    the click variable has to set back to false sometime...

×