Straw Dog 0 Posted October 8, 2006 Don't give me the "search the forums..." done that needle in the haystack thing to infinity. Trying to fix a simple MP random camcreating script. (Place objects random but at the same spot on all clients and server) SIMPLE QUESTION: Can i use the syntax: publicvariable "_iamverylocal" or must "_iamverylocal" be renamed to "iamverylocal" Thanks in advance! Share this post Link to post Share on other sites
Chris Death 0 Posted October 8, 2006 Locals are local within a script only - this has the reason that you can use e.g. the same script for more than only one object without having to care about variables conflicting eachother. Global Variables without an underscore in front exits everywhere on the network if assigned globally (which should be the case if done properly). So you're last sentence was correct - you have to rename them into globals to be able to publicVariable them. ~S~ CD Share this post Link to post Share on other sites
Straw Dog 0 Posted October 8, 2006 Alrighty thanks. Been trying and wasting most of the sunday to do the following: ATTEMPT: -LAN Server (Not dedicated) is creating a lot of random stuff at the beginning of mission (all camcreated). -Client players trying to read the exact position by recieving the publicvariable created after each random placement. RESULT: -Everythings fine on LAN Server (eg. jeepwreck created at position 100,92,1. -Extremely fluctuating shit. Client either gets nothing or jeepwreck created elsewhere. CONCLUSION: -Giving this up. Sundays passed and gone and everyone's off to their own duties...hooray! Now where's that bottle of whiskey... Share this post Link to post Share on other sites
UNN 0 Posted October 8, 2006 Quote[/b] ]all camcreated The camcreate command only creates objects local to the server and clients it was called on. If your using a random number generator and running the camcreate command on all clients and the server, you will get the copies of the same objects placed at different positions. Add a gamelogic named "SERVER" to your mission. Then and use createvehicle command instead. Something like: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">If !(Local SERVER) Then {goto "Exit"} "YourObject" CreateVehicle _YourRandomPos ... #Exit Share this post Link to post Share on other sites
Straw Dog 0 Posted October 8, 2006 1. I know about camcreate being very local. 2. I can't  use createvehicle because of vast amount of object creation. 3. I have a gamelogic named "server" and it works just fine. I tried it and it separates clients from servers as it's supposed to do. Share this post Link to post Share on other sites
Straw Dog 0 Posted October 8, 2006 I probably gonna have to make a "pending" script for the clients...beautiful. Share this post Link to post Share on other sites
UNN 0 Posted October 8, 2006 Quote[/b] ]2. I can't  use createvehicle because of vast amount of object creation. I can't comment on the difference between Object mutiplied by number of clients with CamCreate. As opposed to Object mutiplied by number of servers with CreateVehicle. Share this post Link to post Share on other sites
Straw Dog 0 Posted October 9, 2006 Quote[/b] ]2. I can't  use createvehicle because of vast amount of object creation. I can't comment on the difference between Object mutiplied by number of clients with CamCreate. As opposed to Object mutiplied by number of servers with CreateVehicle. Trust me, createvehicle in heavy numbers will lag like hell. Createvehicle in small doses works fine tho. I've moved on to other things. Might aswell let this one go... Share this post Link to post Share on other sites
General Barron 0 Posted October 10, 2006 This will be simple to do using the fnRemoteCall function from the CoC's network services: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? !(local server) : exit _pos = [random 100, random 100, 0]; [ [], format[{"objectType" camcreate %1}, _pos] ] call fNRemoteCall If you aren't using NS, and you are doing any amount of scripting in MP, then I HIGHLY, HIGHLY, HIGHLY suggest you use them. It makes problems like yours extremely simple to solve (like in the above example). Spend one sunday figuring out how they work and you'll never spend another sunday trying to solve stuff like this again (you'll do it in two lines of code like I just did). You'll have to ask around for a link though because the version hosted on the Chain of Command website is an old one (v1.1 though the link text says its v2.0). Share this post Link to post Share on other sites