Jump to content

jakkob4682

Member
  • Content Count

    252
  • Joined

  • Last visited

  • Medals

Everything posted by jakkob4682

  1. I looked at the locations cfg for Takistan and found there are no actual airports its listed under "NameLocal" but there are a few locations with that type so how would I go about using the actual name of the location in the config? I have waitUntil {(taskCompleted tsk1 && taskCompleted tsk2)}; locations = nearestLocations [getPos hitman,["NameLocal"],25000]; airports = []; { if ((name _x == "AIRFIELD")||(name _x == "Military Base")) then { airport = airport + [_x]; }; }forEach locations; airport = airports select 0; apmarker = createMarker ["ap",position airport]; "ap" setMarkerType "Ellipse"; "ap" setMarkerColor "ColorRed"; "ap" setMarkerText "Operations_HQ"; "ap" setMarkerSize [20,20]; "ap" setMarkerBrush "Border"; transport = [getMarkerPos "ap",360,"UH1Y",group hitman] call BIS_fnc_spawnVehicle; evac = "HeliH" createVehicle getPos hitman; transport doMove getPos evac; waitUntil {(transport distance evac < 10)}; transport land "Get In"; waitUntil {(hitman in transport)}; evac setPos getMarkerPos "ap"; sleep 5; transport doMove getPos evac; waitUntil {(transport distance evac < 10)}; transport land "land"; but the marker never gets created and it spawns the huey at the bottom corner of the screen which if it didn't have a RTB function would be all right but it doesn't :( Error in expression <Move getPos evac; waitUntil {(transport distance evac < 10)}; transport land "Ge> Error position: <distance evac < 10)}; transport land "Ge> Error Type Object, expected Number
  2. hitman = _this select 0; asset = _this select 1; target = _this select 2; { if (typeOf _x == "USMC_SoldierS_Sniper) then { target = _x; }; }forEach allUnits; lets say that the unit hitman dies and I want to reassign the hitman variable to another unit of a certain type how would I do that? I'm not too familiar with setVariable/getVariable command but I suspect thats where this is going to end up.
  3. I know how to create a script and then set the parameter and call it with execVM"somescript.sqf", however what I'm looking for is something like this hitman = _this select 0 asset = _this select 1; target = _this select 0; { if ((faction _x == "USMC")&&(typeOf _x == "USMC_SoldierS_Sniper")&&(isPlayer _x)) then { hitman = _x; }; }forEach allUnits; { if (typeOf _x == "USMC_Soldier_Officer") then { asset = _x; }; }forEach allUnits; if (hitman distance asset < 5) then { tsk1 = hitman createSimpleTask ["contracts","target one"]; tsk1 setSimpleTaskDescription ["Youve been assigned target one a local insurgent recruiter who may have intel on other targets in the area","first target is a recuiter","recruiter"]; { if ((side _x == east)&&(typeOf _x == "TK_INS_Warlord")) then { target = _x; tsk1 setSimpleTaskTarget [target,true]; }; }forEach allUnits; }; if !((alive target)&&(hitman distance asset < 5)) then { tsk1 setTaskState "Succeeded"; tsk2 = hitman createSimpleTask ["contracts","target two"]; tsk2 setSimpleTaskDescription ["Good job on the kill but we have bigger problems now. A local engineer has been making ieds for the insurgents. We need to kill him","Kill the engineer","target two"]; { if (typeOf _x == "INS_Soldier_sab") then { target = _x; tsk2 setSimpleTaskTarget [target,true]; }; }forEach allUnits; }; if ((taskCompleted tsk1)&&!(alive target)) then { tsk2 setTaskState "Succeeded"; }; if ((taskCompleted tsk1)&&(taskCompleted tsk2)) exitWith { "All contracts complete return to base"; }; [hitman,asset,target]; Hitman = compile scriptThis; will this work? basically i want to create a script that does two things, when hitman gets within 5 meters it creates the first task, after that task is done, it checks for the distance again then assigns a second task. The script isn't complete
  4. jakkob4682

    How to call a script?

    Yeah i figured out that I need to put in the waitUntil command thanks for all the help!!! very informative and definitely learned a lot from this
  5. jakkob4682

    How to call a script?

    at the risk of getting humiliated... what exactly do you mean by execute the script again once the first task is complete? I tried using a second waitUntil command to check if taskCompleted tsk1 and not alive target and that didn't work either. ---------- Post added at 20:34 ---------- Previous post was at 20:19 ---------- if !(alive target) then { tsk1 setTaskState "Succeeded"; }; { if (typeOf _x == "INS_Soldier_Sab") then { target = _x; tsk2 = hitman createSimpleTask ["Bomb Maker"]; tsk2 setSimpleTaskDescription ["We found a laptop that had a local ied makers address on it go investigate the address","Local IED Manufacturer","bomb maker "]; tsk2 setSimpleTaskTarget [target,true]; tsk2 setTaskState "Assigned"; hitman setCurrentTask tsk2; }; }forEach allUnits;
  6. The wiki is also very vague on a lot of the commands, which is where it falls short.
  7. jakkob4682

    How to call a script?

    After adding hintSilent "player is within range of asset" it only fires once, the first time i get within range of the officer, added a teleport trigger to go back and forth quickly to and from the asset as well, 2nd task isnt updating, and target doesn't get reassigned. Can I use a setVariable command on the variable target for something like target setVariable ["alive",true,false]; if !(alive target) then { target setVariable ["alive",false,false]; i guess its a question of how do I assign a value to target after the original target is killed.
  8. jakkob4682

    How to call a script?

    For some reason I can't get it to add tsk2 after target is dead. Is it possible to still use target as the variable after the first task? Or do I need to use a different variable for that? i.e. waitUntil {!(alive target ---------- Post added at 03:17 ---------- Previous post was at 02:27 ---------- do i need to add another variable for that such as target1?
  9. I have one trigger that creates a trigger on given marker and then performs one action, and I have another script that needs access to the trigger variable without making it a global variable is it possible to reference the same variable in two different scripts? I am just getting into scripting, and have searched the forums and the wiki, but it all seems kind of latin to me. I kind of get the jist of setVariable/getVariable but how would use those in conjunction with the trigger variable to perform two different actions? Also another question I have is if I use _t = createTrigger ["EmptyDetector",getMarkerPos "someMarker"]; if (triggerActivated _t) then {}; what ever code I put in the code block doesn't execute when the trigger conditions are met, but if I use a waitUntil command it does. How ever I don't want the code to execute only once, I want it to execute each time the conditions are met.
  10. so now the next question is if i use setVariable to make it accessable would it be _variable setVariable ["variable",true]?
  11. jakkob4682

    How to call a script?

    now the problem is the 2nd task isnt updating after I kill the target, I don't want to several different variables for each task, would rather have one variable accessable by all tasks and just change it after the target dies the first time.
  12. jakkob4682

    How to call a script?

    can I call this script from the init.sqf without setting the parameters? since the values are dynamic will it matter? ---------- Post added at 20:06 ---------- Previous post was at 19:41 ---------- It won't create the first task for some reason, and the distance check isn't working. When the mission starts I am more than 5 meters away from asset and it just creates the 2nd task. nothing in the rpt file either. ---------- Post added at 20:20 ---------- Previous post was at 20:06 ---------- still not working, not sure if its something to do with the syntax or not since theres no rpt errors, I'm wonder if the position of ! is the cause of the issue i.e. is there a difference between !((alive target)&&(taskCompleted tsk1)) (!(alive target)&&(taskCompleted tsk1)) ((!alive target)&&(taskCompleted tsk1))
  13. jakkob4682

    Player Distance Markerpos

    I didn't think you could use markerPos for distance checks.
  14. hey Iceman thanks for being helpful in a way that isn't elitist or condescending btw, I'm fairly new to scripting, but I'm learning a lot from other people's examples and from the modules themselves, I get stumped on dynamic variables though : /
  15. jakkob4682

    How to call a script?

    editted script to complete it, to check if target is alive and 1st task is complete. ---------- Post added at 19:37 ---------- Previous post was at 19:27 ---------- The next thing I want to do create another set of tasks once the player reaches another position but I want to be able to call the hitman function from the 2nd script if you know what i mean. So basically if (hitman in _array) then { hitman = compile "hitmantasks.sqf"// the original script that create the tasks call hitman; }; but I want to be able to change the value of target from the 2nd script so that it references different class names/objects etc.
  16. why don't you create a trigger in the script that covers the area you want to check and set its Activation to "East","Present",true/false?
  17. is it possible to do without making the trigger variable global?
  18. I want to make a script that spawns the actual "BIS_ARTY_LOGIC" then if unit is typeOf "M119" synchronize it. So basically an auto synchronization script. On the other topic of what the post was originally about, does commandFire work to get them to only shoot one round if I want, for instance a spotting round? I know theres a ton of AI Artillery scripts out there but I want to know more for my own understanding rather than just using someone else's script. The only addon I know of that does this, is ECHO but theres no user input for that addon.
  19. if setSimpleTaskDescription doesn't work you can systematically add the waypoint to your group on the objects location. _tskWP = _grp addWaypoint [getPos _pos,_radius,_index] and then just add the other waypoint info such as setWaypoint behaviour etc. after you add the waypoint to the group. Keep in mind that all groups start out with a waypoint already so any waypoints added afterwards are going to have an index of 1 or more.
  20. private ["_tanks","_infantry","_Arty"]; _tanks = _this select 0; _infantry = _this select 1; _Arty = _this select 3; while {alive player} do { _trg = createTrigger ["EmptyDetector",getPos Player]; _trg setTriggerArea [750,750,0,false]; _trg setTriggerActivation ["east","present",true]; _trg setTriggerStatements ["east countSide thisList > count units group player","",""]; if ((triggerActivated _trg) && ("tank" countType list _trg > 0)) then { _armor = player nearObjects ["tank",750]; _impact = [getPos (_armor select 0), getPos (_armor select 1), getPos (_armor select 2)]; _tanks move getPos player; [_Arty,_impact,["immediate","he",2,5]] call BIS_ARTY_F_executeTemplateMission; if !(_Arty getVariable "ARTY_ONMISSION") then { player sideChat "ARTY FIRING"; }; } else { if (triggerActivated _trg) then { _infantry move getPos player } }; }; { sleep .3; }; deleteVehicle _trg; almost crashes my comp any ideas?
  21. How do I execute these scripts? i.e. the ARTY_shelltrack.sqf script in the arty module or any other scripts found in the module.pbo?
  22. I know I could just download and hijack someone elses script but I would prefer to learn how to do this myself. I'm fairly new at scripting but was wondering how I would set up a while loop for artillery. i.e. I want to use a findNearestEnemy and run it continuously until FO dies or artillery dies. while the FO is alive I want him to call in artillery every minute on enemy units. I've tried using while {alive FO}and{alive artillery} do {[_battery, _targetPos,_fmTemplate] call BIS_ARTY_F_executeTemplateMission} but it either only runs once or never. Like I said I'm a newb to scripting so just trying to learn. any help would be great or just a simplified example that I could look at.
  23. title pretty much explains what I'm looking for, is there a guide to do this? or a script that will let me do this? Thanks for any help in advance.
  24. Awesome I'll give it a go, those two condition alone I can build pretty decent mission off of. TY again.
×