Home   Help Search Login Register  

Author Topic: local problem  (Read 1382 times)

0 Members and 1 Guest are viewing this topic.

ROBINO

  • Guest
local problem
« on: 04 Aug 2005, 19:33:15 »
Hi, i'm simply trying to run different scripts on different comps during a MP game, and I have succeded.  However, the code below is running off a server machine as I log-in as a client (when MY unit is named either "play1" or "play2" and the other unit is made AI).  When I log-into the server as the ONLY client I would hope that only 1 action is added to my avatar's action list, but 2 are added!  How is this ?  How can my comp think that both "play1" AND "play2" units are local ?  Why would it think "play2" is a player unit ?

What are the rules of localism ?  Why does the code work when the people logged into the server is >1 ?



Code: [Select]
_unit = _this select 0


? local server: exit
? local _unit && play1 == player && not local server: [0,1,0,0,0,0,1,1,0,0] exec "bf\addaction.sqs"; exit
? local _unit && play2 == player && not local server: [0,1,0,0,0,0,1,1,0,0] exec "bf\addaction.sqs"; exit

exit

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:local problem
« Reply #1 on: 04 Aug 2005, 20:06:14 »
What is in addaction.sqs? The problem might be in there. Or not.

Locally added actions can be seen globally I think. For example, you add an action to player BoB on his computer only. RoB goes near BoB in game and sees the action in his action menu.

It's the same as if you add an action to a flagpole. Everyone can see it in their action menu when they go near the flagpole, no matter on whose computer it's been set up.

Maybe.  :)
Not all is lost.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re:local problem
« Reply #2 on: 05 Aug 2005, 17:33:11 »
If the AI is under your command, will it not be local to your machine as well?  If you put the AI in a different group or make it the leader, does that remove the problem?

If so, search the forums for a thread about differentiating between AI and real players.

My experience with addAction is that it is seen only on the machine on which the command is executed.
« Last Edit: 05 Aug 2005, 17:37:21 by Mr.Peanut »
urp!

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:local problem
« Reply #3 on: 06 Aug 2005, 10:43:17 »
as Mr Peanut stated
If you as a player are the leader of your group
Then all units in that group are under local control on your client
so if you add an action to a unit in your group, that action is local to your client and any effects it causes during the running of the script are only going to be local, unless you public variable or cause a trigger activation through it

Adding action to vehicles (unmanned) or objects is still local but seen by all

eg

if you add an action to an ammo crate, the action is available to all clients when they get near enough.

However if say the action is to createvehicle a crew served mgun then each player will be able to create one, not just 1 machine gun)

and therefore if your intention was to allow the players side the ability to create 1 machine gun in the mission and there are 12 players, they will infact be able to create 12

ofcourse as nearly always in ofp there are workarounds for this
« Last Edit: 06 Aug 2005, 10:50:11 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline Garcia

  • Members
  • *
  • Leeds United is the best football team...EVER!
Re:local problem
« Reply #4 on: 06 Aug 2005, 13:00:23 »
It's always worked for me to only check if the unit I want to have the action is the right one, i.e in the script that adds the action, check if the unit I want to have the action is player, if not exit. And if a action is added on only 1 computer, then it only shows on that computer. I've added actions to vehicle for only leader of a group without anyone else seeing it.