Jump to content
Sign in to follow this  
Impavido

Public variables 101

Recommended Posts

In an earlier post I asked about a problem of my triggers not registering on other clients. I was told that I needed to use public variables because triggers are local variables.

Okay, that makes sense, but I can't quite get anything from any references regarding the subject (like on this forum, maybe I'm dumb but whatever I found was very vague). Let me make one thing perfectly clear, I know absolutely SQUAT about threads and all those other newfangled thingys. So plz talk down to my level... wink.gif

So lets take an example, I have a trigger that detects when a player launches a SCUD, the trigger works fine for that player and most of his team, but the other players don't get any message or any function that is activated by that trigger (because it local) So how exactly would I use the Publicvariable command to make that trigger activate on all clients?

PS- Don't mistake lack of talent for genius

LOVE- Impavido biggrin.gif

Share this post


Link to post
Share on other sites

Well, one way to do it is like this: for the trigger that you have that triggers in the scud launch, put something like this:

scudLaunched = true;publicVariable "scudLaunched"

that just sets variable "scudLaunched" to true and broadcasts it to all other clients. Now, when all of the sudden all clients have "scudLaunched" set to true, you just need a second trigger with "scudLaunched" in its condition (without quotes, the trigger gets triggered when scudLauncher is true). In this trigger put all the stuff that you want to happen in scud launching event (messages etc.).

Share this post


Link to post
Share on other sites

Okay, i use variables a lot but u just made things a lot simpler than i expected. Thx a lot, ill test it out now! biggrin.gifbiggrin.gifbiggrin.gifsmile.gifbiggrin.gifbiggrin.gifwink.gifsmile.gif <- Thats me doing the Happy Happy Joy Joy Dance.

Share this post


Link to post
Share on other sites

Imp make some very fun missions. You should throw some of them up on a site to download. I hope you got the info you need.

- Wraith -

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×