Nielsen
-
Content Count
203 -
Joined
-
Last visited
-
Medals
Posts posted by Nielsen
-
-
You can just give them 'addweapon "throw";'. Then they will be able to throw rocks without pulling out an AK when out of stones. ;)
-
@Shk:
Awesome as allways man. I'll finish my dinner and episode of South Park, and then I'll try to wrap my head around the code and implement it. Will report back once tested.
@Kylania and ST DUX:
Thanks for trying to help out. Basically I need to do exactly what I said. I spawn a civ, and then I want to know which player is closest to that civ. No more and no less.
:)
-
No the ai is civilian and friendly to the player.
I'm not sure how I would use the nearestObjects to achieve this. Any help?
-
Well the title says it all..
Or actually it does not have to be all that simple, if anyone would show me a way to do this.
The 'nearestObject' does not seem fit for this, or I am using it wrong.
Any thoughts?
Regards,
-
If it does not show under the correct island, then the problem is most likely that you have not put the demo mission in the correct folder.
Just to check, you do realize that you should not actually put it in "Arrowhead\other Profiles\Yournick\Missions", but rather the (similar) path that fits your Arma installation?.
It should be put in your missions directory (NOT in the main arma folder). Where that folder is depends on your OS and if you are using STEAM or not.
If you dont know where it is, go into the editor, put down a player unit and save the mission with a name that is distinct. Then go back to windows, and search for that name in files and folders. It should locate the correct folder where your editor missions are stored, and where you should put the mentioned demomission.
Also, make sure that you dont copy the entire unzipped dir into the folder. There should only be one folder with the island prefix in the end (e.g. demomission.zargabad). Within this folder the mission.sqm should be located.
If you can locate any mission you have saved, you could also just copy and replace that mission.sqm with the mission.sqm from the demomission you downloaded. Now if you open your saved mission, it should be the demomission.
Hope it helps.
-
I would prefer something a little more aesthetic ;)
-
I've been browsing the forums for a "follow solution" that suit my needs, but to no avail. I hope some of you will share some insight.
What I am trying to accomplish is this:
I want to spawn a group of hostile civilians within a certain radius, and have them follow the playergroup within a certain area, at a set distance, while throwing rocks at them.
I spawn the civilians in an 'east' group, and give them 'throw-weapon' and rocks. This works. They throw rocks en masse. They cant hit for sh!t, but I can live with that :p. The problem is, that I want them to follow BLUEFOR. Idealy they would follow whatever player was closest to them, but my scripting skills limit me to have them follow 'player1' atm.
The problem is:
I need them to follow but keep their distance. If i use 'doFollow' or just make them attack, they rush to my position - getting right up in my face - but not throwing rocks as they are too close.
For some reason I'm having a really hard time figuring out a solution that works. I thought I had it figured out. I made the script (look below) such that the group is given a waypoint that never completes, and then do a loop that moves the waypointPos to my position +20m on the x-axis, and then sleeps 15, so they have time to throw some rocks.
This kinda worked. If I stood still until the group was fully spawned and had reached their waypoint, they would continue to follow me at 20m. But if I was in motion while the script ran, then they would gather at the first waypoint, and never move from there. This is obviously not a viable solution. In addition, now it suddenly does not work. They dont follow me at all, even though I havent changed anything I can think of.
This is my script:
angryCivTest.sqf:
//Virker kun ordentligt hvis man venter på at gruppen får samlet sig før man løber. hint "script started"; sleep 2; //sleep (240 + (random 120)); if (DangerZone) then { [nil,nil,rHINT,"Some of the locals are getting agitated. Stay alert."] call RE; } else { if(true) exitWith {}; }; sleep 2; //sleep (120 + (random 120)); if (DangerZone) then { _grp = createGroup east;sleep 0.05; _unit = _grp createUnit ["TK_INS_Soldier_5_EP1", getPos player1, [], 50, "NONE"];sleep 0.05; [_unit] join _grp; _unit2 = _grp createUnit ["TK_CIV_Takistani04_EP1", getPos player1, [], 50, "NONE"];sleep 0.05; [_unit2] join _grp; _unit3 = _grp createUnit ["TK_CIV_Takistani04_EP1", getPos player1, [], 50, "NONE"];sleep 0.05; [_unit3] join _grp; _unit4 = _grp createUnit ["TK_CIV_Takistani02_EP1", getPos player1, [], 50, "NONE"];sleep 0.05; [_unit4] join _grp; _unit5 = _grp createUnit ["TK_CIV_Takistani05_EP1", getPos player1, [], 50, "NONE"];sleep 0.05; [_unit5] join _grp; _unit6 = _grp createUnit ["TK_CIV_Takistani01_EP1", getPos player1, [], 50, "NONE"];sleep 0.05; [_unit6] join _grp; _unit7 = _grp createUnit ["TK_CIV_Takistani06_EP1", getPos player1, [], 50, "NONE"];sleep 0.05; [_unit7] join _grp; _unit8 = _grp createUnit ["TK_CIV_Worker02_EP1", getPos player1, [], 50, "NONE"];sleep 0.05; [_unit8] join _grp; _unit9 = _grp createUnit ["TK_CIV_Worker01_EP1", getPos player1, [], 50, "NONE"];sleep 0.05; [_unit9] join _grp; hint format ["group is: %1",_grp]; { _x setVehicleInit "this addEventHandler [""killed"", {civkilled = civkilled + 1; PublicVariable ""civkilled"";}];"; removeAllWeapons _x; _x addWeapon "throw"; _x addMagazine "HandGrenade_Stone"; _x addMagazine "HandGrenade_Stone"; _x addMagazine "HandGrenade_Stone"; _x addMagazine "HandGrenade_Stone"; _x addMagazine "HandGrenade_Stone"; _x setMimic "Angry"; _x setUnitPos "UP"; } forEach units _grp; sleep 0.05; processInitCommands; _grp setBehaviour "COMBAT"; _grp setCombatMode "RED"; _grp setSpeedMode "FULL"; _waypoint = _grp addWaypoint [[((getpos player1 select 0) + 10),((getpos player1 select 1) + 10),2], 0];sleep 0.05; [_grp, 1] setWaypointType "SAD"; //[_grp, 1] setWaypointFormation "LINE"; [_grp, 1] setWaypointStatements ["targetcheck", ""]; while {DangerZone} do { [_grp, 1] setWaypointPosition [[((getpos player1 select 0) + 20),getpos player1 select 1,2], 0]; //_waypoint = _grp addWaypoint [[((getpos player1 select 0) + 20),getpos player1 select 1,2], 0];sleep 0.05; //nul = _grp addWaypoint [[((getpos player1 select 0) + 20),getpos player1 select 1,2], 0]; { _x addMagazine "HandGrenade_Stone"; _x addMagazine "HandGrenade_Stone"; _x addMagazine "HandGrenade_Stone"; _x doTarget player1; _x doFire player1; } forEach units _grp; sleep 15; }; } else { if(true) exitWith {}; }; hint "script done";Note: The 'DangerZone' variable is set to true/false in a repeated trigger. The 'targetcheck' condition in the waypoint is just to block it from completing, so I dont have to create new waypoints but can just move the active one.
I have tried a solution I found in another thread with a 'doFollow.sqf' function. But that does not seem to work for me. Also, as mentioned, I dont want them to rush my position, but stay at a distance.
A couple of things. Firstly the OPFOR groupleader does not seem to appear. I do not know why, but apperantly he does not spawn. The civilians spawn though, and they are indeed hostile, as they are throwing rocks at me, which is why I spawned an OPFOR leader in the first place, so I'd rather keep it that way. I dont know why he does not appear though. Secondly, the '_x setUnitPos "UP";' does not seem to work either. But that is also not a great concern.
I've played around with various combat/behaviour modes with no effect.
I put in a hint to check the WPPos, and it seems that the waypoint do get updated on every loop, the civilians just dont move to the waypoint. Also, they seem a little shaky, almost as if they want to move but cant. They kinda twitch (for lack of a better word) around.
I would really appreciate any thougts on the matter.
Regards,
Nielsen
-
@Shk:
Thanks man. I'll propably go with the taskhint version for the most part. I actually do think its a neat feature, I was just illustrating a point.
As for the processing thing - AHA!. That is good to know. In that case, I figure it would be a good idea making the script a "higher priority". But as I said, I trust your judgement regarding if it is needed or not.
EDIT: Btw, what happens if you delay your script. I mean does the 3ms rule disregard sleep commands and such? Or is that something I should take into consideration when making functions?
@MuzzleFlash:
Yeah. I do have -showscripterrors on though. I remember when I first discovered that command some months back. I was like: WTF have I been doing! Spending countless hours looking through scripts for a missing ';' is something every missionmaker could surely do without. I dont really wanna think about what I could have accomplished with the time I've spent looking for scripterrors like the coding noob that I am, not knowing that this command (of course!) existed. :rolleyes:
-
Hmm. You want proof?... - You cant handle the proof! :D. Seriously, you might be right about the init.sqf. I will add some diag_log to the init.sqf. When I see the problem again, I will check if that was the issue and get back to you.
Regarding the update. Good point. I'm allways a fan of optimizing performance :). On the other hand I dont know how much of a (potential) performance boost we are talking about. I have no knowledge of the impact that init.sqf has on cpu performance.
setPostMode DevilsAdvocate 1;
I would say that unless you think that there would be a significant gain, then it might be better to keep the script (and implementation) simple. No need to include the placing of objects and init-lines, unless it is performance wise well founded (not saying that it is not). If - in your considered oppinion - the performance boost would be noticeable, and the suggested way might noticeably help to weed out potential problems, then I think it is a good idea. Otherwise I would prefer it the way it is.
As to make it 'playable units' based, I'm not sure that is such a good idea. I'm quite sure that I will be using this script in all my mission. I dont see myself making missions where units have various briefings in the near future. However, I feel that keeping options open is a solid approach. I'm not sure how valid a concern this is, but I'm mentioning it because I felt that your implementation of task hints took something (just a little bit) away from the overall usefullness of the script. The implementation of "custom" tasknames, and the option to do failed (etc.) tasks greatly improved the overall usefullness of the script. But even though the automatic taskhints are convenient, they feel a bit restrictive. I often do more informative taskhints than just "task created" and "task completed", but having two taskhints right on top of each other looks rather messy imo... This is not a great concern, and I'm gladly using the taskhint version, having deleted my own taskhints. I'm just saying this, cause I figure alot of people are using it or going to. It would be a shame if such a great/usefull script left people feeling hindered in any way.
setPostMode DevilsAdvocate 0;
Well, whatever you come up with, I'm sure it will be great. I just think the true beauty of this scripts is the "simplicity" (not that it is simple to me), and the solid functionality.
-
@Wiggum: Thats because the script uses "player createSimpleTask". What you need to do is change 'player', so that the tasks get created for all units on the given side, instead of just the player unit. I can not remember the command, as I have never done it (I feel switching units breaks immersion for me). But I am farely sure that it is straight forward, and can be done by replacing 'player' in the script with something like 'side west' or something like that. Do a search ad you should solve it in a min.
@Shk:
As I was browsing the forum, I saw someone stating that on JIP, sometimes the client just wont run the init.sqf. If this is true (as I suspect it to be), then that is propably the cause of my issues. It certainly explains why neither tasks, weather nor time gets updated on JIP every now and then, and why it can be fixed with a reconnect. If this is the case, then I guess compiling the script in init.sqf will do no good... Just a heads up before you spend time reworking the code.
EDIT: After rereading your post I am unsure if you were actually sugesting to compile it once in the init.sqf. I've only just started to look into compiling scripts, and havent yet figured out when/how to use the different commands in this regard.
Regarding the issue, I figure an editor solution would be to put a trigger to check if the init has been initialized, and execute the init.sqf it the client has not allready done so. I'm not sure if this would pose a problem in the sequenze of things. I guess it would be a problem if the trigger starts activating the init.sqf before the client has a chance to do so. I understand that the init.sqf fires quite late on JIP, when the client is allready ingame, and I wouldnt want it to run twice.
-
Well if you think that would make a difference, I'm all for it.
But as I said, I do not consider this a problem. I think this script is awesome as it is.
But yeah, you're the expert, and I'm sure alot of less experienced scripters like myself are having (and will have) so much use for this script. So if you think a rework is worth your time, then I'll be waiting for the update ;).
-
Allright. I've done some more testing with my buddy.
My results are this.
The script works like it should when JIP. After doing a lot of connects and re-connects we've found, that the tasks get updated as they should most of the time. However, sometimes when a player JIP's he wont get the tasks. I have realized that it is not your script (or my implementation of it) that seems to cause this, as it effects several things. I implemented weather selection in my mission, and when the tasks fail to update on JIP, the weather is also not updated correctly.This is 100% consistent in my tests, and it can be cleared with a reconnect. I'm not sure what is causing this, but it seems that neither you nor I am to blame for this (I am keeping the door open on the "I" though ;)). Also, as it seem to be clearable with a reconnect I do not really see it as a major concern. One thing we noticed though is, that the problem only arises when my buddy have disconnected and attempts to reconnect to the same character/unit. This might just be coincidental, I'm not sure.
Well whatever. As I said, with a reconnect there's no problem, so I dont worry about it. I just figured, that when you have taken the time to code this for the community, the least I could do was to get back to you on this issue now that I had some time to test it more.
The bottom line. The script works - and I love it! Thanks.:)
-
AHA! So that's it.
I remember seeing the use of double "" before, but I never knew when to use it.
It's funny how problemsolving little specifik issues, helps you understand scripting in general much better. Thanks man

BTW: If what you say is allways true, then shouldnt the code really be:
{ _x setVehicleInit "this addEventHandler [""killed"", {killedno = killedno + 1; PublicVariable [color="Red"]"[/color]"killedno"[color="Red"]"[/color];}];"; } forEach units _grp;:)
-
I'm spawning some units and I want to set their init.
Normally I would do this with the "type createUnit unitInfo" command, and set the init there. But I need to spawn them in a 100m radius og the player. I only know how to do this with the "group createUnit []" command. And this command does (AFAIK) not allow to set the vehicle init.
I then try to set the vehicle init afterwards with the setVehicleInit command:
{ _x setVehicleInit "this addEventHandler ["killed", {killedno = killedno + 1; PublicVariable "killedno";}];"; } forEach units _grp;I spawn the group with this code:
_grp = createGroup east;sleep 0.05; _unit = _grp createUnit ["TK_INS_Soldier_HAT_EP1", getPos player1, [], 100, "FORM"];sleep 0.05; [_unit] join _grp; _unit2 = _grp createUnit ["TK_CIV_Takistani03_EP1", getPos player1, [], 100, "FORM"];sleep 0.05; [_unit2] join _grp; _unit3 = _grp createUnit ["TK_CIV_Takistani04_EP1", getPos player1, [], 100, "FORM"];sleep 0.05; [_unit3] join _grp; _unit4 = _grp createUnit ["TK_CIV_Takistani02_EP1", getPos player1, [], 100, "FORM"];sleep 0.05; [_unit4] join _grp; _unit5 = _grp createUnit ["TK_CIV_Takistani05_EP1", getPos player1, [], 100, "FORM"];sleep 0.05; [_unit5] join _grp; _unit6 = _grp createUnit ["TK_CIV_Takistani01_EP1", getPos player1, [], 100, "FORM"];sleep 0.05; [_unit6] join _grp; _unit7 = _grp createUnit ["TK_CIV_Takistani06_EP1", getPos player1, [], 100, "FORM"];sleep 0.05; [_unit7] join _grp; _unit8 = _grp createUnit ["TK_CIV_Worker02_EP1", getPos player1, [], 100, "FORM"];sleep 0.05; [_unit8] join _grp; _unit9 = _grp createUnit ["TK_CIV_Worker01_EP1", getPos player1, [], 100, "FORM"];sleep 0.05; [_unit9] join _grp;
I get a scripterror in line 42, the line of the setVehicleInit. It says i'm missing an ;. But I can not see that I do. However I have tried all variations of ; in the sentence that I can think of, and it does not work.
Can anybody tell me what I have missed?
Thanks in advance.
-
@shk:
Allright now it gets really weird.
Got my buddy online to test, and everything works fine!
This is SO weird. I've tested it with him many times, as late as yesterday, and nothing got updated on JIP. Now he joins and every task is spot on! The only thing I've changed since last nights test, is that I optimized an old script called by an addaction, and which I did'nt even call during the tests. The script does not contain any taskscreation/updating. You dont think having an unrelated script with excessive "if - if - if" statements could have been the problem do you? I simply can not comprehend this enigma. When checking his .rpt I find that '_JIP' is 'true' and _jiptasks contains an array with the relevant tasks as should be. So I guess everything is good, although it makes me kind of nervous that it suddenly works, when I have no idea what made it work.
Unfortunately I did not have the possibility of making several checks, as my buddy did not have time, and when we set up another try he got kicked straight to debrief when entering. This has been a problem for us before, and I never could figure out why. But the .rpt gave me a clue. It said "Unit slot not found", so I guess I'll have a look at that next.
Anyways. The .rpt did report another anomalous thing.
When he entered my game on creation (not JIP) the .rpt did not report: False and []. Instead of giving an empty array it read:
"Briefing.sqf Started running!" false "Briefing.sqf Finished running!" Error in expression < }; diag_log SHK_Jiptasks_JIP; diag_log SHK_Jiptasks; diag_log "Briefing.sqf Fi> Error position: <SHK_Jiptasks; diag_log "Briefing.sqf Fi> Error Undefined variable in expression: shk_jiptasks File mpmissions\__CUR_MP.Baghdad\briefing.sqf, line 293
The taskarray should have been stated right below 'false'. The line (293) it refers to, is the "diag_log SHK_Jiptasks;". My .rpt read an empty array. Is this because I'm server and defining the empty array, and is this normal? If so I guess I have no more problems as long as my mission does not shift gear on me again.
Thanks for your help man, I really appreciate it!
-
I'm also looking very much forward to the English version.
-
Of course. I should have thought about that.
I will test it as soon as my buddy is online.
Obviously when I tried it by myself SHK_Jiptasks_JIP returned false and SHK_Jiptasks returned [].
-
Thanks for the info.
The "diag_log" will certainly come in handy in the future.
Unfortunately it did not help me solve my current problem.
I dont get it. I get no script errors. The briefing.sqf is running from start to finish (confirmed with diag_log). And I get nothing in the .rpt that gives me a clue as to what might be causing this. I am calling the script from triggers or from scripts executed by triggers, so that should be allright also.
I'm so depressed about this. I've spent so much time and put a lot of work into this mission. When I implemented your script, and it worked I was like
x10.I then finished up the mission, and all of a sudden the JIP does not work. At first I thought that it was propably a syntax error, and started to debug. But now - getting no error or other indication of what is going on - I'm getting really frustrated. Especially cause I know I'm at fault, since I've seen the script work.
Now, I know that you are not running a help desk, but I could sure use a bit more help if you've got the time.
Would you agree, that since none of the tasks get either created nor updated on JIP, the problem must lie within the briefing.sqf (where I run the script)?
If so, can you tell me if anything is wrong with this:
Briefing.sqf:
diag_log "Briefing.sqf Started running!"; SHK_createTask = { // "name" call SHK_createTask if isserver then { SHK_Jiptasks set [count SHK_Jiptasks,_this]; publicvariable "SHK_Jiptasks"; }; if !isdedicated then { /* -- add extra tasks below -- */ switch _this do { //Tasks created by civilian information! case "Hideout1": { taskHideout1 = player createSimpleTask ["Hideout1"]; taskHideout1 setSimpleTaskDescription ["Clear insurgent hideout, and neutralize any insurgent presence.", "Neutralize hideout", "Neutralize hideout"]; taskHideout1 setSimpleTaskDestination getPos hideout_1; taskHideout1 setTaskState "Assigned"; }; case "Hideout2": { taskHideout2 = player createSimpleTask ["Hideout2"]; taskHideout2 setSimpleTaskDescription ["Clear insurgent hideout, and neutralize any insurgent presence.", "Neutralize hideout", "Neutralize hideout"]; taskHideout2 setSimpleTaskDestination getPos hideout_2; taskHideout2 setTaskState "Assigned"; // I have a lot of similar tasks here, all copy pasted and corrected from the above tasks. }; /* -- add extra tasks above -- */ if !SHK_Jiptasks_JIP then { call compile format ["task%1 call SHK_showTaskHint",_this]; }; }; }; SHK_showTaskHint = { // Task call SHK_showTaskHint private "_p"; _p = switch (tolower(taskstate _this)) do { case "created": { [localize "str_taskNew", [1,1,1,1], "taskNew"] }; case "current": { [localize "str_taskSetCurrent", [1,1,1,1], "taskCurrent"] }; case "assigned": { [localize "str_taskSetCurrent", [1,1,1,1], "taskCurrent"] }; case "succeeded": { [localize "str_taskAccomplished", [0.600000,0.839215,0.466666,1.000000], "taskDone"] }; case "failed": { [localize "str_taskFailed", [0.972549,0.121568,0.000000,1.000000], "taskFailed"] }; case "canceled": { [localize "str_taskCancelled", [0.750000,0.750000,0.750000,1.000000], "taskFailed"] }; }; taskHint [format [(_p select 0) + "\n%1", ((taskDescription _this) select 1)], (_p select 1), (_p select 2)]; }; SHK_updateTask = { // ["name","state"] call SHK_updateTask if isserver then { SHK_Jiptasks set [count SHK_Jiptasks,_this]; publicvariable "SHK_Jiptasks"; }; if !isdedicated then { call compile format [" task%1 settaskstate ""%2""; task%1 call SHK_showTaskHint; ",(_this select 0),(_this select 1)]; }; }; SHK_Jiptasks_JIP = false; if isserver then { SHK_Jiptasks = []; } else { if (isnull player) then { SHK_Jiptasks_JIP = true }; }; if !isdedicated then { [] spawn { waitUntil {!isnull player}; player createDiaryRecord ["Diary",["About","<br />Version: 20100703<br />Made by: Shuko of LDD Kyllikki<br />Contact: shuko@Quakenet<br />www.kyllikki.fi"]]; /* -- add briefing tasks below -- */ taskInitial = player createSimpleTask ["Initial"]; taskInitial setSimpleTaskDescription ["Patrol the streets of Baghdad.","Patrol","Patrol"]; taskInitial setTaskState "Assigned"; player setcurrenttask taskInitial; /* -- add briefing tasks above -- */ if SHK_Jiptasks_JIP then { waituntil {!isnil "SHK_Jiptasks"}; { switch (typename _x) do { case (typename ""): { _x call SHK_createTask }; case (typename []): { call compile format ["task%1 settaskstate ""%2""",(_x select 0),(_x select 1)] }; }; } foreach SHK_Jiptasks; SHK_Jiptasks_JIP = false; }; }; }; diag_log "Briefing.sqf Finished running!";It should be just a copy of your script, with my own tasks-template pasted into it. What I dont get is that the initially created task (taskInitial) is created just fine on JIP. I guess that would suggest that the problem is in the "extra tasks" section. But I have checked, double and tripplechecked my task names etc. They should be correct.
Do you have any insight into what type of error could result in my symptoms (total breakdown of a part of the script)?
-
To be more specific.
Add:
"YourMarkerName" setMarkerAlpha 0;
To your init.sqf.
-
Name your ACM modules: BIS_ACM
Put this in the bottom of your init.sqf.
//ACM settings [] spawn { waitUntil {!(isnil "BIS_fnc_init")}; sleep 10; [["BIS_TK_INS"], BIS_ACM] call BIS_ACM_setFactionsFunc; ["ground_patrol", 1, BIS_ACM] call BIS_ACM_setTypeChanceFunc; ["air_patrol", 0, BIS_ACM] call BIS_ACM_setTypeChanceFunc; };That should work.
Check out this thread for more info on the ACM. On the last page is all the info on the classes and groups in OA, in case you want to throw some UN patrols in the mix ;).
-
Thanks for the update.
I'm having a problem, and I could need some advise on how to debug it.
I have used the script in one of my missions, and it seemed to work. But all of a sudden none of the created tasks get updated for JIP. The initially created task works fine. I must have messed something up, but I can not locate the error. I get no script errors, and I've looked over the code a thousand times. I cant think of what I might have done to screw it up. I have a few questions that could help me locate it.
If none of the tasks get created/updated on JIP, must not the error then lie in the init.sqf? (or in my case briefing.sqf).
I have A LOT of tasks in my mission. The mission I've done forces me to make nearly 40 seperate tasks (not all of which needs to be completed of course).
Is there a maximum on the number of tasks I can create with this script?
Are there any restrictions on where I can call the create/update task command, and could these result in my symptoms?
How reliable is "-showScriptErrors"? Is it possible that I have a syntax error causing this problem, without me being prompted?
-
Great. Thanks for the info!
-
Thanks for doing the tweaks. Works perfect!
-
@shk:
My buddy is offline atm, so I cant duplicate it. However, I did create the new tasks before updating any tasks.
This is what I did.
I set up the init like you did, and added
case "test1": { taskTest1 = player createSimpleTask ["test1"]; taskTest1 setSimpleTaskDescription ["knock down a radar","radar",""]; taskTest1 setSimpleTaskDestination getPos testunit; taskTest1 setTaskState "Assigned"; }; case "test2": { taskTest2 = player createSimpleTask ["test2"]; taskTest2 setSimpleTaskDescription ["knock down a radar","radar",""]; taskTest2 setSimpleTaskDestination getPos testunit; taskTest2 setTaskState "Assigned"; }; //And so forth.I then made a Radio Alpha trigger with activation:
nul = [] execVM "setup_tasks.sqf";
setup_tasks.sqf
"test1" call SHK_createTask; "test2" call SHK_createTask; "test3" call SHK_createTask; "test4" call SHK_createTask; "test5" call SHK_createTask; "test6" call SHK_createTask;
When I hit Alpha I got the 6 tasks, but he got 12. When I completed the tasks with "["test1","SUCCEEDED"] call SHK_updateTask;" (etc.), the six intended tasks got completed, and stayed as such on JIP. The 6 "ghost tasks" did not update at all.
As soon as I wrapped a "if (isServer) then {};" around the code in the setup_tasks.sqf, everything seemed fine.
Creating before updating might be the problem. I think I'm gonna stick with the isServer check until you get it sorted out. The check shouldnt cause any problems should it?
Is there a simple way to find the nearest player of an ai unit?
in ARMA 2 & OA : MISSIONS - Editing & Scripting
Posted · Edited by Nielsen
@Shk:
Works like a charm!
Hehe, I spent hours on this, and I just could not get it to work. I was in the process of writing this post crying for help, when it dawned on me, that 'playableunits' might not work in the editor :rolleyes:.
It took me a while to fully comprehend the code, even though its not that long and quite simple. It's rather clewer, at least by my standards :). The time I used trying to get it to work was well spent learning.