Home   Help Search Login Register  

Author Topic: Help with Public variable to init MP script  (Read 1221 times)

0 Members and 2 Guests are viewing this topic.

magnar

  • Guest
Help with Public variable to init MP script
« on: 22 Mar 2004, 12:17:16 »
I have read through the forums and the tutorials in this site, and I think I have an idea what I need to do, but I'm unsure how to go about it.    I have a script initialized by an addaction, works fine, but as you can guess it only works for the server.  I believe it takes the use of the publicVariable "NAMEOF SOMETHING" to do this, but I dont know the correct way to do this.  My scripting knowledge is very limited, and I am unsure of how to go about this.  I believe it takes a condition to be true to get this done, but I'm not sure what goes where, as far as does something go in a trigger?  Also, what do I put in the script to have it be shown to all players?  I guess I kinda need a step by step explanation...sorry for my lack of experience with this......... Hope I've explained this correctly, and if anyone can give me the easiet or simplist explanation I would greatly appreciate it.  Thanks in advance...    
 

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:Help with Public variable to init MP script
« Reply #1 on: 22 Mar 2004, 13:53:14 »
Quote
as you can guess it only works for the server
actually for the one who did the action.. could be a client too.

To get a script running for all clients and server:

1. in your init.sqs execute the script which you want to be run when the action is used. [] exec "myactionscript.sqs"

2. type in the beginning of myactionscript.sqs the line @myvariable and after that hint "can everyone see this or just me?!"

3. make a new 'help' script. myactionhelpscript.sqs

4. type in your myactionhelpscript.sqs mypublicvariable = true and after that line a line with publicvariable "mypublicvariable"

5. make the action activate the help script. myaction = player addaction ["test action","myactionhelpscript.sqs"]


   The way it works is that the init field executes a script to run on all clients and server. The script waits for a variable to be set to true before continuing. When the action is used, it executes a script which sets the variable to true and sends it's value to every client and the server. When the clients and the server receive the true value of the variable the script that waited will continue.

 :)
« Last Edit: 22 Mar 2004, 19:33:20 by Artak »
Not all is lost.

magnar

  • Guest
Re:Help with Public variable to init MP script
« Reply #2 on: 22 Mar 2004, 19:05:26 »
Thank you, I am at work right now, so I'll give it a go this evening. :D :D

magnar

  • Guest
Re:Help with Public variable to init MP script
« Reply #3 on: 23 Mar 2004, 07:48:59 »
Ok, Ive been trying to figure this out, but I think its because of the way Ive got the mission set up I'm not able to think "outside the box".  I'm sure my lack of programming/scripting doesnt help......your pateience is greatly appreciated, I might add.....What I have is a trigger that adds an action to a gate guard when you approach him.  Because you are near him, you can execute the action.  (actually there are two different guards, but Ive got it set so if one is there, the other is deleted, so in essence, each guard adds a different script, so two different things could happen).  Just for simplicity, I'll just go with one of the scripts, its called "Papers1.sqs".  If this guard, named "Guard1" is present when the player approaches, the Papers1.sqs is added to the guard, then available to the player.   In the beginning of Papers1.sqs I would put the line @myvariable.  Ok, for me, so far so good.  From there.......I am just not getting it.........due to no fault of the advisor, Its all my bad.  I think I'm mostly confused because of the way I picture it working.....If you are willing to, I can email you a copy of the user mission and you can take a look at it.  I think your expertise could solve this very quickly, especially when you see the way the mission plays.  If i designed  this just as a  single player mission, It would be good to go.  But, I want to do it right so its enjoyable for others too.  Please dont think I'm not willing to try this on my own, Ive been trying to apply it to my mission for the past couple of hours.  I know if I just did this as you have laid it out it would work perfectly, I just cant seem to apply it to what I've got.  Thanks very much for your help, and I will continue to try to work with it............... :help:        

magnar

  • Guest
Re:Help with Public variable to init MP script
« Reply #4 on: 30 Mar 2004, 20:54:36 »
got it...finally.  Thanks again