Home   Help Search Login Register  

Author Topic: How to make a client-side script exec a script on the server?  (Read 1150 times)

0 Members and 1 Guest are viewing this topic.

mikkelfh

  • Guest
SHORT
How to make a client-side script exec a script on the server?

LONG
I want the client to click on the map (using onMapSingleClick, which works).
When this happens, I want an AI group to move to that position (_pos, which doesn't work).

I think the problem is, that the script is run client-side, and AI commands are server-side only.
How can I make the AI command run server-side, but still let client use onMapSingleClick?

The onMapClick still HAS to be run client-side... (Whole mission folder attached)

If you can find some precious time to delve into this, I would be immensely grateful...

Oh, and btw: you select blue units on map WITHOUT shift, and move them WITH shift-click...
« Last Edit: 14 Jun 2004, 13:43:08 by mikkelfh »

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:How to make a client-side script exec a script on the server?
« Reply #1 on: 14 Jun 2004, 18:27:19 »
Any AI in a group commanded by a player are local to thast players client (I believe)


If its another group, then

have the map click setpos a gamelogic (lets call it tx_moveto)
and public variable a boolean (tx_movenow)

Have your AI group stop at a waypoint 0, with condition: tx_movenow


then script on serverside

Quote
tx_movenow = false
~ (random 5)
#START
~2
?(tx_movenow): got "MOVE"
goto "Start"

#MOVE
;;;; setpos  the groups move waypoint to the gamelogic
[mygroup, 1]setWpPos (getpos tx_moveto)
~3
tx_movenow = false
goto "START"


when the server receives the boolean pv, the groups Position 1 waypoint will be setpossed to the gamelogic, the boolean condition which was prevented from allowing the group to move will then become true and the troops will move to that position.

I reset the boolean to false again, this will then allow yet another map click to move them again

If the groups only have wp 0 and wp 1, then when you setpos the wp1 again, they will simply move to it


UNTESTED, theory only
« Last Edit: 14 Jun 2004, 18:31:08 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123