Doolittle 0 Posted August 7, 2005 I was trying to get a script to run for just AI people. I had the server doing a test for if a game player (played by AI) was local to them, then it ran a script. Â Like: ?local _p : _p exec "foo.sqs" However this didn't work. Â It would appear to be the case that all objects are local to the server at time 0, when everyone clicks "I'm Ready", then player objects become local to the players only. Is this assumption correct? Â That would mean the fix would be just: ~0.5 ?local _p : _p exec "foo.sqs" Thanks for any help... Doolittle P.S. Here's something else I can't figure out: not everyone seemed to "register" onMapSingleClick when I called it from init.sqs. Â I have a delay of 1 second from when the map starts to where I call onMapSingleClick. init.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">~1 onMapSingleClick {[_pos, _units, _shift, _alt] exec "scripts\mapclick.sqs"; false} How could some people miss that?? Â Should I put more delay in there or call it several times so that their system "registers" the fact that when you click on the map I want mapclick.sqs run?? Share this post Link to post Share on other sites
korax 4 Posted August 7, 2005 However this didn't work. It would appear to be the case that all objects are local to the server at time 0, when everyone clicks "I'm Ready", then player objects become local to the players only. No, I dont think this is correct, AI are always local to the server unless the AI is in a group in which a player is the leader In your case, if the player slots all end up in one group, the AI will usually be local to the leader of the group, if the slots are all in seperate slots than it should be local to the server. As for the onmapsingleclick command, I'm not sure but try making the 1 second delay a little longer, sometimes the start of a mission can be slightly choppy Share this post Link to post Share on other sites
Doolittle 0 Posted August 7, 2005 Hmmm...well all the players are seperate. Â This is actually the line: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?local _p and player != _p : _p exec "scripts\build.sqs" When I test on my own system (where I am client and server) this works like it should: if the player is AI controlled the build.sqs runs, otherwise it doesn't. I do know about this code: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">playerobject = player ?call format ["""%1""", player] == "<NULL-object>" : playerobject = objNull You know.... this trick to see if we are a dedicated server or not. Â I think what is happening is that on my dedicated server, the line "local _p and player != _p" is really "local _p and objNull != _p"...player variable is null on a dedicated server (right!?). Â So something about doing a comparison to a null object screws up and it runs. Ok, here's the question then, if reading all the above is confusing: how do I run a command if a certain player is AI controlled (and in their own group)? Â For some reason seeing if they are local doesn't work. Â Ack I'm confused. Doolittle Share this post Link to post Share on other sites
korax 4 Posted August 7, 2005 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? local Server && local _man : goto "AI" Thats probably the easiest method to check if its an AI, but you must have a game logic named Server placed on the map Share this post Link to post Share on other sites
Doolittle 0 Posted August 7, 2005 Okay, I just was able to actually test this over MP. Having the ~0.5 in there before the code actually fixed it!! Which means all objects are local to the server at time 0. As soon as you start the mission the players become local only to themselves. Thanks for assistance though Korax. Doolittle Share this post Link to post Share on other sites
raedor 8 Posted August 7, 2005 yes, i experienced similar things. "player" is not local or not initialised in MP at 0... or soemthing like that. it just doesn't work. Share this post Link to post Share on other sites
UNN 0 Posted August 8, 2005 Quote[/b] ]Okay, I just was able to actually test this over MP. Â Having the ~0.5 in there before the code actually fixed it!! Which means all objects are local to the server at time 0. Â As soon as you start the mission the players become local only to themselves. This was the first problem I came across when I stared my very first attempt at MP scripting. http://www.ofpec.com/yabbse....d=23968 I can only talk about this in terms of init events within addons. If you try and launch a function from the addons init event (time 0), the Group command will not work and neither will the local command. It's as though it waits to create everything required for the mission. Before passing it onto the Multiplayer code, to decied what belongs where and who it belongs to. But rather than give it a fixed delay, I used the rating command to flag when all the inital network traffic (cant think of a better way of describing it) had finished. http://www.flashpoint1985.com/cgi-bin....t=46743 But you might be able to do the same with @!(IsNull (Group Player)). Share this post Link to post Share on other sites
cleanrock 0 Posted August 8, 2005 dolittle, i reg my onMapSingleClick 0.1 s after game start .. work fine so far my guess is that some of the players use some addon or mod that also calls onMapSingleClick which will override ur Share this post Link to post Share on other sites