Home   Help Search Login Register  

Author Topic: Unit name publicVariable and locality  (Read 1509 times)

0 Members and 1 Guest are viewing this topic.

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Unit name publicVariable and locality
« on: 04 May 2008, 22:53:55 »
Hi.

I just started thinking about this, hope you don't think I'm an idiot.

I know how to use publicVariable command quite well (I think). I.e I can make a player get an action that will make him speak (heard by all players) and perform something that will have global effect. However for me the following is still uncertain:

If a unit performing an action gets a new name: (actionguy = _this select 0; publicVariable "actionguy")

If "actionguy" is a player, the player units new (extra) name will be KNOWN by the server but the unit is local only to the player. If you then run a script on the server that includes "actionguy". Will no commands work? or what will not work?

I have read the MP tutorial (which is great), but this is still an enigma to me.

Am I an idiot? If yes, please still answer my question.

Laggy
« Last Edit: 04 May 2008, 23:30:33 by laggy »
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Unit name publicVariable and locality
« Reply #1 on: 04 May 2008, 23:55:48 »
In most cases, any command that affects any attribute of the affected unit will work only if the unit is local (setPos, setDir, serVectorDir, setVelocity, setVectorUP, setFuel, move, doMove). That includes also any command that affect unit behaviour, combat mode or actions. So, the general rule is that you cannot affect via commands a unit that is not local to where the commands are executed.

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Re: Unit name publicVariable and locality
« Reply #2 on: 05 May 2008, 00:29:54 »
Thanks again.

What if I have a complicated script and "just to make sure" run it on all machines. Could that create CONFLICTS beteween machines, or would the global effects like "say" and "playmove" work on all computers (the way I usually do it) and the other commands (demanding locality) work as well, since the script would then only be "effective" on the computer where given unit is local and ignored by all other machines?

I.e if I have a script that runs on all machines that includes:

ServerControlledPublicVariabledguy say "move out"
group ServerControlledPublicVariabledguy move getpos gamelogic
exit

The "say" would be heard by all players but the "move" would only have effect on the server (reason: editor placed gamelogic).

Is there any problems in doing it like this? I just want to make it work.

Is there any reason to do this instead:

ServerControlledPublicVariabledguy say "move out"
? IsServer : group ServerControlledPublicVariabledguy move getpos gamelogic
exit

Cheers

Laggy

And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Unit name publicVariable and locality
« Reply #3 on: 05 May 2008, 01:27:51 »
In many cases you can do it that way, executing it everywhere, the drawback is that in some cases you may overload unnecessary some clients.

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Re: Unit name publicVariable and locality
« Reply #4 on: 05 May 2008, 17:23:10 »
Thank you again.

Laggy
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.