5133p39 16 Posted January 5, 2006 First of all, i have tried it with a clean installation of OFP Platinum - no addons besides the one i created. I am sure as much as i can, that my computer is virus free, and i don't have any other problems than this one. ------------------------------------------------------------- I made a unit derived from the "Civilian" class and added the following userActions into the class definition in its config.cpp: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class UserActions { class JoinMe { displayName="Join unit"; position="roura"; radius=5; condition="(Alive this) and (Count Units Player < 2) and (Leader this != Player)"; statement="[this] Join (Group Player)"; }; class FreeMe { displayName="Free unit"; position="roura"; radius=5; condition="Leader this == Player"; statement="[this] Join GrpNull"; }; }; When i try it on dedicated server (1.96) it will ALLWAYS crash the client to the desktop, and sometimes even the server crashes. This is what causes the CTD: 1. i will aproach the unit and use the "Join unit" action. 2. i release the unit by activating the "Free unit" action. 3. i kill the unit, and my OFP client will crash to desktop. If i kill the unit before i force it to join my group, everything is ok. If i kill the unit while it is still in my group, everything is fine. The CTD occurs ONLY when i kill the unit after releasing it from my group. ANY suggestions? Am i doing something wrong? I have run out of ideas. Share this post Link to post Share on other sites
UNN 0 Posted January 5, 2006 What happens if you make the Civ part of your group in the mission editor, then release him, then kill him? Or you could even try moving the rest of the group, to a new group. Leaving the Civ behind. If you can get away with it? <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">statement="(Units This)-[This] Join GrpNull"; Share this post Link to post Share on other sites
5133p39 16 Posted January 5, 2006 i don't know what's going on, when i tried it today, it worked. First i tried what UNN suggested, i grouped the civilian with me in the mission editor, and there was no crashes. I wanted to be sure, so i loaded the original mission state where the civilian isn't grouped with me, and... IT WORKED TOO. You must be thinking i am crazy, but yesterday i tested it 20 times or maybe more, and it ALLWAYS crashed. Now it works ok. And i am not talking about crashes only on my computer - i has been testing the mission with my firends on their dedicated server, when the CTD occured on one of the client, we tried it again and then the CTD occured on other client, we tried again and then the CTD occured on the first client AND on the Server. ...that was how i found about this ?error? and what actions caused it, so i was able to reproduce this error. Then i was testing the mission on my dedicated server, and EVERY TRY resulted in the CTD. Yesterday i was little sleepy, so maybe i forgot some little change i made, that's probably why it works now. I feel like complete idiot, i'll try to find what i did to remove the error, or what i must do to reproduce this error again. Share this post Link to post Share on other sites
5133p39 16 Posted January 5, 2006 Ok, i am sorry, i was really exhausted and i forgot the BIG changes i made :-))) I realized that the problem is probably in the fact that the Join command is executed on the clients too, and not only on server, so i changed the "statement" values like this:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class UserActions { class JoinMe { displayName="Join unit"; position="roura"; radius=5; condition="(Alive this) and (Count Units Player < 2) and (Leader this != Player)"; // statement="[this] Join (Group Player)"; statement="eJP = this; PublicVariable ""eJP"""; }; class FreeMe { displayName="Free unit"; position="roura"; radius=5; condition="Leader this == Player"; // statement="[this] Join GrpNull"; statement="eJN = this; PublicVariable ""eJN"""; }; }; There is a script called "event_listener.sqs" which is run from the 'init.sqs' on both, server and clients, and which is then 'listening' for the variables 'eJP' and 'eJN', where 'eJP' is the unit which was ordered to join the player, and 'eJN' is the unit which was released from the player group. The "event_listener.sqs" is like this:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">eJP = ObjNull; eJN = ObjNull #loop ... ? not isNull eJP : [eJP] exec "_events\join_player.sqs"; eJP = ObjNull ? not isNull eJN : [eJN] exec "_events\join_null.sqs"; eJN = ObjNull ... ? not GAME_OVER : goto "loop" exit So when the eJP is not Null, it's passed to the "join_player.sqs" script. And here is the most important part - the "join_player.sqs" will check whether it is run on the server, and if not, it will exit. If it is run on the server, then it will find the player nearest to the 'eJP' unit and then it will do <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[_eJP] Join _nearestPlayer The "join_null.sqs" is much simpler:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_u = _this select 0 ? (Local Player) and not (Local Server) : exit [_u] Join GrpNull exit And this works. You can join/release/kill the civilian however you like, and it won't crash. EDIT: It worked until now, now the crashes are back. I am starting to think the Join command is somewhat bugged. Nobody experienced any problems with it??? And one more question: What do you think about the "event_listener.sqs" loop ? Is it better to have loop with <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? not isNull eJN : do_something; call_some_script or it would be better to have a SWITCH for this? What is more resource firendly? 10 switches, or one loop with 10 conditions? I think the second is better, but i may be wrong. Share this post Link to post Share on other sites
UNN 0 Posted January 6, 2006 Quote[/b] ]You must be thinking i am crazy, but yesterday i tested it 20 times or maybe more Lol...Not at all. it's a common experience with OFP (well at least for me). Sometimes I do a complete shutdown and restart, just to make sure all the changes I've made have been applied. Quote[/b] ]It worked until now, now the crashes are back. I am starting to think the Join command is somewhat bugged. Nobody experienced any problems with it??? The reason I asked about the Civ in the mission editor. I did wonder if the join command is local or global? And if your trying to get an AI to join your group, that AI is local to the server. So do you execute the join command just on the server, just on your client or on both? Once the AI has joind your group, it's then local to your client? So again, when you want to release it, who runs the join GrpNull command. Hmm...I can only give you more questions than answers I'm afraid If I were you I would setup a basic test mission. Make it, and the scripts as simple as possible, and try using useractions to run the scripts. If it still crashes, try the same scripts using Radio Triggers, I think they execute on all clients and the server. Share this post Link to post Share on other sites
Chris Death 0 Posted January 6, 2006 hmm - i ain't got any chances for testing for myself so i can only guess. On a dedicated server there's no player If you join a unit on server to player (who's not there) this could probably be the cause of a ctd - and maybe in your case it's got also something to do with that issue, when trying to leave the group of who doesn't exist serverside. ~S~ CD Share this post Link to post Share on other sites
5133p39 16 Posted January 6, 2006 hmm - i ain't got any chances for testing for myself so i canonly guess. On a dedicated server there's no player If you join a unit on server to player (who's not there) this could probably be the cause of a ctd - and maybe in your case it's got also something to do with that issue, when trying to leave the group of who doesn't exist serverside. ~S~ CD Well, to be exact i am not joining the AI unit to the player by using the 'Player' variable on the server - i know that it doesn't exists on the dedicated server. I am publishing the AI unit name to the server, where is then run a script which will find the player unit not by the 'Player' variable - that would be nonsens - but by iterating through ALL units, searching for a specific unit type (it's for the 'Psycho Killer' mission, so the players can be the type of 'policeman' or 'killer', and there are no AI 'killers' or 'policemans', so it's easy to determine which units are player controlled) which is NEAREST to the specified AI unit, and the AI unit is then added to the group of the NEAREST 'policeman'/'killer' unit. So i don't see anything that could cause any problems. But i agree this is not very good aproach, so i will be sending the player unit to the server too, just to be sure - but in the end, it will execute the same commands as it was executing before. And about the 'trying to leave the group of who doesn't exist serverside': i am not referencing ANY specific unit to leave it's group, it is done through the "_unit Join GrpNull", where (as you probably know) the "grpNull" is a system variable which value is something like "not a group" or "no group at all", something simmilar to the system variable "ObjNull". And it's perfectly legal to use this for a unit to leave it's current group (and i even think it was made especially for this purpose). Thanks for the tips, and keep them comming please. Share this post Link to post Share on other sites
5133p39 16 Posted January 6, 2006 The reason I asked about the Civ in the mission editor. I did wonder if the join command is local or global? And if your trying to get an AI to join your group, that AI is local to the server. So do you execute the join command just on the server, just on your client or on both? Once the AI has joind your group, it's then local to your client? So again, when you want to release it, who runs the join GrpNull command. I am not sure how exactly the "Join" command behaves, but i think it will be perfectly logical to exec this command ONLY on the server, because then it is up to the server to publish the result to all the clients (which is done automaticaly by the OFP). So i am sending the name of the "unit-to-be-joined-to-the-player" to the server through the "PublicVariable ""eJP""", then o nthe server, the variable 'eJP' is catched by the 'event listener' script, and it will execute all the needed commands (more in my previous post). Share this post Link to post Share on other sites
5133p39 16 Posted January 7, 2006 I tried the last idea. It didn't worked. I ensured that the Join command was run on the Server only: I heard the command for the AI to join my group (2 follow 1), then the command bar was shown (you know, the F1 - F12 unit icons on bottom of the screen), but after a second it disappeared. It seemed that the AI is still somehow in my group, but ONLY on the server, like if my client didn't knew about it. I think so, because there is a script running on the server, which is making the AI wander randomly and which stops only when the leader of the AI is some other unit and continue run only when the controll is given back to that AI unit - but the script has stopped and didn't run again! So i think, the "Join" should be run on ALL the machines - all clients and server. I am going to try it now. Share this post Link to post Share on other sites
UNN 0 Posted January 7, 2006 Quote[/b] ]I heard the command for the AI to join my group (2 follow 1), then the command bar was shown (you know, the F1 - F12 unit icons on bottom of the screen), but after a second it disappeared. Out of curisoity, how are the civilians created? Is it done with CreateUnit or are the placed in the editor? Sounds like your on the right track, if just joining up with a Civ can cause a CTD. Share this post Link to post Share on other sites
5133p39 16 Posted January 7, 2006 Out of curisoity, how are the civilians created? Is it done with CreateUnit or are the placed in the editor? Initialy they are placed in the mission editor. But when are they killed, they will be created again in case the unit which killed them was a policeman. The respawning is now obsolete. In the historic versions of the "Psycho Killer" the kills made by The Killer were counted, and when the count reached some predefined value, then The Killer won the game. So i needed to prevent renegade human cops from killing the civilians in order to sabotage the mission of The Killer, because when he got no civies to kill he couldn't win the game. But no more - the decision whether The Killer won the game, depends now on the count of civilians left and not on the count of kills. So if some cop kill a civilian, he would only help the killers. Share this post Link to post Share on other sites
5133p39 16 Posted January 7, 2006 I HAVE FOUND THE CAUSE OF THE CRASHES! It's the respawning of the killed civilian, which is causing the crashes! When i removed the respawn, there were no more CTDs, and when i put it back the CTDs were back too. Because the CTD happened only when killing a unit which was previously joined with the player, it must be something related to the group specified in the CreateUnit command. I was using the group of the dead unit, which is working ok, until the unit is joined with someone, and then released (when killed before released, it was still ok). Because now, with the changed methods of the "gameover-decision", i don't need the civies to respawn at all, i will get rid of the respawn => cause solved. Thank you all for your efforts, without this 'brainstorming' i wouldn't find it. Share this post Link to post Share on other sites
UNN 0 Posted January 7, 2006 Quote[/b] ]Because the CTD happened only when killing a unit which was previously joined with the player, it must be something related to the group specified in the CreateUnit command. It did sound familiar to a problem I came across is SP. If you create an AI, with an invalid group, i.e. using createvehicle or, createunit with grpnull. Then try and join it to your group, OFP locks up. There are probably ways round the problem of respawning civs, but if you have it working then no need Share this post Link to post Share on other sites
5133p39 16 Posted January 7, 2006 There are probably ways round the problem of respawning civs, but if you have it working then no need Sure, i could put AI unit somewhere safe, and use it only to have some valid group to spawn the "respawned" AI into it, and then execute "_respawnedUnit Join grpNull". ...some time ago, i made addon of a immobile, invisible and indestructable unit, only for this prupose. But as you wrote, i don't need that now. Share this post Link to post Share on other sites