OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: mikkelfh on 14 Jun 2004, 13:40:26
-
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...
-
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
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