Jump to content

Koni

Member
  • Content Count

    458
  • Joined

  • Last visited

  • Medals

Posts posted by Koni


  1. I'm trying to move a unit from one location to another, backwards and forwards, in a loop.

    Been trying with this for a few hours and not much luck . lol

    This is the result I'm trying to get.

    unitname setPos (getPos loc1);
    
    sleep 5;
    
    unitname setPos (getPos loc2);
    
    sleep 5;
    
    unitname setPos (getPos loc1);
    
    sleep 5;
    
    unitname setPos (getPos loc2);

    etc etc, but in a better format, without needing endless gibberish

    Thanks


  2. Place a game logic and name it AKM and put this in it's init field.

    AKM = "WeaponHolder" createVehicle getPos this; AKM addWeaponCargo ["AK_47_M",1]; AKM setPos [getPos this select 0,getPos this select 1,0.78]; AKM addMagazineCargo ["30Rnd_762x39_AK47",2]; AKM SETDIR 90

    That will give you a floating AK-47 0.78 Meters of the floor with 2 magazines.

    Now you need to place a table under your game logic for the ak47 to look like it's on the table.

    Depending on the height of the table, adjust the height of the spawned AK47.

    The AKM SETDIR 90 means the AK will be placed at that amount of angle, change according to your needs.


  3. heh, here we go again with Animals.

    This time Goats.

    I've changed it so it works on Goats now, but instead of snatching any coloured Goat and just one type spawning back at the farm, I wanted to try and make the goats that spawn back at the farm different colours.

    So I have been playing around with this to spawn random goats back at the farm.

    islookingforgoats = true;
    
    vehicles = ["Goat01_EP1","Goat02_EP1", "Goat"];
    _goats = vehicles select (floor random 3);
    
    while {islookingforgoats} do {  
       _cTarget = cursorTarget;
       if (_cTarget isKindOf "Goat" && player distance _cTarget < 2) then { 
           deleteVehicle _cTarget; player say2d "goat"; _goats createUnit [getMarkerPos "hens", superhen,"shen4 = this;", 0.6, "corporal"];
    };
       sleep 0.5;
    };

    This works for deleting a black goat or whatever coloured goat you capture, and will spawn a random coloured goat back at the farm, but for every goat after that you capture, it will be the same coloured goat that spawns everytime again, so it's only choosing a random goat class for the first one spawned, and sticking with that goat class for everyone afterwards.

    Where am I going wrong please.

    edit: Figured it out

    islookingforgoats = true;

    while {islookingforgoats} do {

    _cTarget = cursorTarget;

    if (_cTarget isKindOf "Goat" && player distance _cTarget < 2) then {

    deleteVehicle _cTarget; player say2d "goat";

    vehicles = ["Goat01_EP1","Goat02_EP1", "Goat"];

    _goats = vehicles select (floor random 3);

    _goats createUnit [getMarkerPos "hens", superhen,"shen4 = this;", 0.6, "corporal"];

    };

    sleep 0.5;

    };

    Just needed to move the random info in the script for it to run everytime.

    Thanks

    p.s

    Or even better, can you get the class type of the unit you capture and use that same class as the spawned unit ?

    That's going a bit to far now, lol


  4. As part of one of my tasks, the player has to find some hens, run close to them and they delete as if you've shoved them in your pocket or bag or whatever, and then when needed they respawn back at your base.

    For this I have been placing named hens with triggers that detect when player is less than 1m away from them with

    player distance hen4 <= 1

    is there a way to have this happen without naming the hens, so it happens when the player gets near any un-named hen ?


  5. If you have a lot of triggers that need to be activated for one final trigger that's counting them off before completing a task, is there a shorter way of doing the condition instead of

    TriggerActivated triggername AND TriggerActivated triggername AND TriggerActivated triggername AND so on... ?

    Like Triggersactivated [trig1, trig2, trig3, trig4]

    I know that won't work, but can anything remotly similar be used ?


  6. For my current mission, I have a number of tasks\side missions that the player needs to complete as they play through the whole mission.

    Quite a few of the tasks need the scene setting with sometimes a large amount of objects and units being spawned in the area that the side mission\task takes place in.

    Once the side mission\task is completed, there's either a cutscene, or the player will be travelling away from the task area, while a trigger will activate a simple script to tidy up the place by deleting dead units\groups and objects that are no longer needed.

    This is the part that I could do with some pointers\help on.

    Deleting dead units\groups and objects is simple enough, but when there's sometimes quite a lot to delete I would like to know if there is a more economical way of deleting everything.

    Like groups. Say there's 20 groups of units that have either some dead, all alive or all dead in them, I am currently using

     {deleteVehicle _x} forEach units civgroup1; deleteGroup civgroup1;{deleteVehicle _x} forEach units civgroup2; deleteGroup civgroup2; deletevehicle objectname; deletevehicle objectname; deletevehicle objectname; 

    and so on, and on etc.

    Now I find sometimes the "deleteGroup" can take effect before the "{deleteVehicle _x} forEach units groupname" has finished deleting all the units to start with, so I can end up having a couple of units left on the map after they should have been deleted, even that it is ran afterwards, so I end up making large lists with groups and objects that need deleting, but putting sleeps inbetween most things to slow the process down a bit, so things don't get missed out.

    Is there a better way of doing this, like having a trigger large enough to cover the whole area needed, and have it delete everything like units, alive or dead, including the groups and editor placed objects with a small amount of code, etc ?


  7. For the AT group, I might be reading your code wrong or you may not be showing it here, but are you storing the group you are creating with BIS_fnc_spawnGroup to a variable that you can then refer to in BIS_fnc_taskPatrol like you do with the patrolunits example? It should look like this (see the green -- name the group whaterver you want):

    ATGroup = [getMarkerPos "Spawn1", side player, (configFile >> "CfgGroups" >> "Guerrila" >> "BIS_TK_GUE" >> "Infantry" >> "TK_GUE_ATTeam")] call BIS_fnc_spawnGroup;

    [ATGroup, (getPos patrolarea),50] call BIS_fnc_taskPatrol;

    Perfect, mate, that's brilliant, didn't think of adding that to the code :thumbsup:

    Works just fine now thanks


  8. Place the marker as empty in the editor, then when you want to show the marker use

    "MarkerName" setMarkerTypeLocal "select";

    All your tasks are showing as completed already because you have

    taskObj3 setTaskState "Succeeded";

    in everyone from the start, so they show up completed straight away.

    That bit needs to be in the trigger that detects if the task has been completed,.

    This is one of my tasks

    "bombfactory" setMarkerTypeLocal "select";

    tskbombfac = player createSimpleTask["Truck Bomb the Taliban HQ"];

    tskbombfac setSimpleTaskDescription["Now we have access to a large Chemical truck, we can turn the tables on those Taliban Bomb makers.<br/><br/>Drive the Armed Chemical truck to the Taliban Bomb makers HQ and destroy the building.", "Blowup Taliban HQ", "Taliban HQ"];

    tskbombfac setSimpleTaskDestination (getMarkerPos "bombfactory");

    taskhint ["New Task!\nDrive the Bomb Truck", [1, 1, 1, 1], "taskNew"];

    taskhint ["Task Assigned!\nBlowup Taliban HQ", [1, 1, 1, 1], "taskCurrent"];

    So when the task is triggered to show, the marker becomes visible, and the map will move to the location when double clicked on.

    tskbombfac setTaskState "Succeeded"; taskhint ["Blowup Taliban HQ !\nTask Complete", [0.600000,0.839215,0.466666,1], "taskDone"]

    This is then in a trigger for when the task is completed.


  9. I've tried so many I'm forgetting what I've done already.

    Tried, GUER, resistance, Guerilla, Independent, nothing works.

    I must be doing something very basic wrong here...

    Got it working...

    The way you spelt Guerrila is what was wrong with mine, I was spelling it Guerilla, which dosen't work, but your way of spelling it does work :thumbsup:

    ---------- Post added at 03:45 PM ---------- Previous post was at 03:29 PM ----------

    Right... that now works for just pre set teams of units, it still dosen't fix my original problem of spawning units using this below but with Takistani units

    patrolunits = 2 + Random 5;patrolgrp = [getPos aPos, resistance, 5] call BIS_fnc_spawnGroup; [patrolgrp, (getPos patrolarea),50] call BIS_fnc_taskPatrol;

    as with this way, the group can be refered to, to add the taskpatrol function..

    I have tried this, but it dosen't work, funnily enough..

    [getMarkerPos "Spawn1", side player, (configFile >> "CfgGroups" >> "Guerrila" >> "BIS_TK_GUE" >> "Infantry" >> "TK_GUE_ATTeam")] call BIS_fnc_spawnGroup; [grp, (getPos patrolarea),50] call BIS_fnc_taskPatrol;

    That obviously spawns the TK_GUE_ATT team, but I don't know how to add the call BIS_fnc_taskPatrol for that created group spawning the unit this way.

    So that's two problems now, lol


  10. Yes, I have been reading the wiki till my head hurt and I have had that working no problem, but using that you have to enter every single soldier into the code line, where as the way I am trying to get working does not, it just picks random units.

    Maybe it isn't possible to do what I'm trying to do, the way I am trying to do it.

    Looks like I need to start learning how to make arrays, and call random arrays, and what not... my heads already hurting at the prospect, lol

    ---------- Post added at 02:50 PM ---------- Previous post was at 02:18 PM ----------

    Been trying this in a trigger, or as a script and nothing will work.

    [getMarkerPos "Spawn1", side player, (configFile >> "CfgGroups" >> "Resistance" >> "BIS_TK_GUE" >> "Infantry" >> "TK_GUE_AATeam")] call BIS_fnc_spawnGroup

    I have a marker down called Spawn1, I have a few guys set to 0% probability of presence of all sides , I am an Independant TK Militia Unit as well, also I have a Functions Mod placed on the map... what am I doing wrong please ?

    This from the wiki works just fine

    [getMarkerPos "tankSpawn", side player, (configFile >> "CfgGroups" >> "West" >> "BIS_US" >> "Armored" >> "US_MGSPlatoon")] call BIS_fnc_spawnGroup

    But when I try and change it to Resistance units, nothing happens.


  11. patrolunits = 2 + (Random 5);
    patrolgrp = [getPos aPos, WEST, 5] call BIS_fnc_spawnGroup; 
    [patrolgrp, (getPos patrolarea),50] call BIS_fnc_taskPatrol;
    

    Dunno what exactly will be spawned (US/USMC), but they are west!

    Btw you had an ; too much in the last line.

    Yeah, I just edited my post a few times before actually posting it, and ended up with 2 ;; on here.

    Yeah I know about using EAST, WEST, Resistance etc, it's the defining which units from that faction that gets spawned that's my problem mate.


  12. Trying to get my head round the BIS_fnc_spawnGroup:

    Been looking through the search results for ages and I can't get this right.

    I found one method which quite suits me, by spawning a random set of units and off they go and patrol an area, but I can't exactly choose the kind of units it spawns.

    I like this as it cuts down a massive amount of lines of code compared the the old very basic way I normally spawn units and send them off patroling.

    patrolunits = 2 + Random 5;patrolgrp = [getPos aPos, resistance, 5] call BIS_fnc_spawnGroup; [patrolgrp, (getPos patrolarea),50] call BIS_fnc_taskPatrol;;

    This works fine for Arma2 Resistance, but what do I use to have it spawn say Takistani Locals, or OA US Army etc.

    I've been playing around adding things like BIS_TK, BIS_US

    BIS_TK_GUE, and so on, and I can't get anything to work like that.

    Thanks

×