Guest Posted September 7, 2007 Hey Ive got this hide/spawn script, which takes units within a trigger, and stores their info into an array, then hides them. Later on when player group units get near enough to that area, the scripts show those stored units. Problem, Ive seen repeatedly in certain areas units that are spawned end up standing there spinning in circles, and this is not the worst of it. I cannot get these units to do jack thru the scripts, doStop, doMove, nothing even affects them, except one 'freak' fix I found... LOL Check this out - I identified a particular spot where a few units got stuck every time upon respawn - and this is out in the wide open, no buildings between them and their wp pos - I figure this is due to the maps positioning system for valid areas to be able to move units .. anyhow - I found thru testing that I *can* get them to move, by using the nearObjects command, and using the player as the position for the command to search from : nObject = position player nearestObject "Man";hint format ["units name is%1",nObject];nObject doMove getPos nObject This worked thru a trigger in game, every time that guy (or guys) were stuck, id just walk up, hit the trigger and bam, they carry on. Now. Nothing else works. I tried in the script to just use their direct local reference name to get them to doMove their own pos, failed, doStop, failed, in fact, I simply could not do anything with these spawned stuck units - Im like waht the @#(*$ is going on here - Then it dawned on me, what if nearObjects is picking up this "screwed up" spawned unit and telling the game engine he's there, and then commands worked on him.. So I implimented the same code from the trigger test right into the spawn script, used a nearby marker as the nearObjects center point and bam, after he was picked up thru nearObjects, it worked - Why ive really put this in here, is I would like to know if other people, anyone, has seen spawned units getting stuck like this, and after 2 days of diving big time into finding a fix, this is the only one ive found, at least I finally found a fix - by pure chance really.. Share this post Link to post Share on other sites
VictorFarbau 0 Posted September 8, 2007 Sounds like one of these lovely problems you'd only have in Arma My question would be: what is the command sequence you use on your troops when you "hide" them? Also, can you provide a x,y,z location where units show this behaviour? Cheers, VictorFarbau Share this post Link to post Share on other sites
Guest Posted September 8, 2007 All qualifying units in a trigger have their info stored in an array, then at the end, after all units are put into temp arrays to be deleted for the "hide" - {if (_x != player) then {deleteVehicle _x}} forEach _NonGunnersToBeDeleted Exit I also tried deleting the group leaders first, then other units, made no difference here. Now all units that are spawned later in these now deleted units places, are put back into proper groups, in Arma the only thing that destroys a group is making the last unit in a group join another, therefore all groups here, even with all units deleted, still exist, as do their waypoint plans as well. Now in the spawn area, it seems to matter not what sort of command is used to create units, ive tried the old Ofp CreateUnit and the new arma CreateUnitArray, same results, units can get stuck with either. It is important to note also so far I am only seeing this occur with spawned units in a group that has previous waypoint plans, in a group that has all units deleted, I dont know if units that were still left in the group might cause the stuck thing not to happen, either way, its still a problem. Exact pos recorded from the stuck unit (sometimes both of this 2 man patrols get stuck, and at a certain point another patrol gets stuck at well) Rahmadi [X 2573.41, Y 2553.75, Z 0.00106239] Of course Z is not really relevant, and I did try setting their z value upon spawn to zero, made no difference. The test line in the script that works to get him to move: _nObject = getMarkerPos "doMoveTest" nearestObject "Man";hint format ["units name is%1",_nObject];_nObject doMove getPos _nObject I put a marker near where this guy gets stuck named doMoveTest which that line uses. Thats about the most I can provide, suprised really no one else has seen this, possible it could be related to rahmadi only? Even if so, gotta address it myself just in case. Share this post Link to post Share on other sites
Guest Posted September 8, 2007 let me put this in here, to exactly replicate the scenario: Make a group of 2 units on the Rahmadi map, east or resistance Give a group name to reference Place them close together, leader at pos [2557.65,2552.91,0] Give them waypoint plan, place the first waypoint at pos [2598.61,2558.95,0] , in this waypoint put in safe, formation column. Then put in a waypoint N of there at pos [2601.79,2606.95,0], and another one anywhere, my waypoint plan for this group ends with a cycle waypoint back at the first waypoint, prolly doesent matter tho. Then put in a marker to show where to delete them, at pos [X 2573.41, Y 2553.75, Z 0.00106239] (from previous post) And once they walk to that point, generally, delete them both. then create them again putting them in same group name, and either at the position they were deleted or at the nearby marker pos, either will prolly do it. That *should* totally replicate scenario. And of course lastly the nearObjects command can be used to free them up, more often than not the leader gets stuck but his partner runs on, sometimes they both get stuck tho as well. Thanks for the interest in this issue ive brought up, hopefully this should reveal same stuck units that im seeing. Share this post Link to post Share on other sites
Guest Posted September 9, 2007 My apologies, this has turned out to be an error in my script, I can get the units to move now via any reference to the unit.. Again, sorry guys, this one was just hard to spot and got mislead. Ending topic Share this post Link to post Share on other sites
VictorFarbau 0 Posted September 9, 2007 I use the very same method in one of my older Arma scripts creating dynamic enemies. It works perfectly well even though I preserve the group name whereas you seem to want to destroy it... Anyway, I see you solved it - was the error by any chance a reference to a non-existing group? Cheers, VictorFarbau Share this post Link to post Share on other sites
Guest Posted September 10, 2007 Actually no, the error was a simple line missing from my scripts that ended up causing certain units with waypoint plans to end up being considered 'static' units by accident, and caused them to be put into an incorrect reference array, and also forced a doStop on them as well. There is a *substantial* difference here between Arma and Ofp in groups remaining after all units have been killed or deleted tho man Quite a few months ago I already confirmed through heavy testing, Arma does *not* delete groups and their adjecent waypoint plans if that group has had all its units deleted or killed. This is of course unlike Ofp, where a "placeholder" unit had to be set aside. Try it out, you can make a severely complex waypoint plan for a group in Arma, then go and delete every single unit. Then make a new unit (or units) and join them to that old group, suprise, they follow that groups waypoint plan to a "T". This is why I have no concern for deleting all units in even important groups in Arma. In fact this has made hiding/showing units *hugely* easier. There is one thing that destroys a group in Arma (aside from deleteGroup). That is to take the last unit in that group and join him to a new group, this is an exception, it destroys the old group, and its waypoint plan. Honestly this *significant* difference in Arma groups should be declared in bold print somewhere, anyone making a spawn/hide script that works with editor placed units and their waypoint plans would have a much easier job knowing they dont have to worry about saving a unit from a group to keep that groups name and waypoint plan existant in Arma. Share this post Link to post Share on other sites
VictorFarbau 0 Posted September 10, 2007 Quote[/b] ]Arma does *not* delete groups and their adjecent waypoint plans if that group has had all its units deleted or killed. Yep confirmed. And luckily so since this was always a reason for heavy workaround scripting in OFP; I am very happy with the createGroup command. Quote[/b] ]you can make a severely complex waypoint plan for a group in Arma Confirmed as well I also make use of this exact behaviour, it's quite brilliant in fact that nothing gets lost when the last unit dies. So I just got you wrong there and thought you wanted to delete the groups. Which wouldn't make sense seeing the above stated behaviour anyway that we agree on. Well, glad you found your error there, hands down. Cheers, VictorFarbau Share this post Link to post Share on other sites
Guest Posted September 10, 2007 Heh, ya, i hear ya. No, never deleted group names, just the units - Worst thing about posting in regards to sometimes complex scripted scenarios is misunderstandings, on both sides often, learning to accept this tho, it happens - and im not always as descriptive as I should be, although in this particular case I really thought I had the issue pinned, but was wrong.. Ya, its awsome groups are not deleted in Arma like they were in Ofp, veryyyy thankfull, and, seemingly alike you, Ive also made huge use of this in many, many scenarios - its just a little spooky having to watch out when using the 'join' command with important group units, to be sure that last unit doesent get joined to another group and wipe out that important group, this here caused me a good deal of complexity in some scripts man, that otherwise would have been easier. Thanks for joining in the topic here, sorry it got a little overly (alot) complex for what turned out to be a missing line in my script (amazing what *1* missing line can do.. ) - Thanks again Victor Share this post Link to post Share on other sites
VictorFarbau 0 Posted September 11, 2007 You forgot "and thanks for nothing" Either way, if my ignorant questions caused you to scrutinize your script again and by chance find this error then the purpose of this forum has been served. The tough part is that there's no real good debugger which would forsee incorrect references and variable states during programming. A lot of things have to be tested by trial&error; subsequently a lot of errors occur. Gotta live with that. Best way around it is to abstract tested code and make it re-useable. Cheers, VictorFarbau Share this post Link to post Share on other sites