OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Egwal on 26 Jun 2004, 16:06:59
-
Im making this MP mission which takes place in a farm. Theres a streetlight that I havent placed myself, it came with the "island"(FDF eastborder).
Id like the players to be able to shut down the streetlamp, eg. pulling the cables out, so you cant put it on anymore. I guess a script is needed which shows an action in the action menu to shut the lamp down when you are <1m from the pole.
So something distance <1 do inflame false and so on.
Some serious scripting help is needed.
-
I don't know much about MP so I can't speak for the MP part, but here's a few clues.
The lamppost should have an object ID: zoom in really close in the mission editor. Then you can write somewhere:-
? object 1234 distance player < 1: lampAction = player addAction ["Disconnect lamppost", "lampout.sqs"]
and then in the script lampout.sqs
object 1234 inflame false
player removeAction lampAction
exit
But as I say, that's only clue (syntax not guaranteed) and I know scripting is not MP friendly so there may be a better way. Remember to remove the action if the player moves away again from the lamppost without pulling the plug.
-
Thanks macguba, thats just what i was after. But the syntax is wrong somewhere, and theres still the problem to remove the action from the player when he moves away.
Any hints on this?
-
add the action to the lampost
and have the script it then runs remove the action
Give the action a variable name
eg. tx_switch = addaction blah blah
then object ID removeaction tx_switch
the correct command for turning a lampost off is
object ID switchlight "Off"
-
remember that in the action executes the script for the one who performed the action only, so everything you do in the action script will be done for the one client only. if you have something that needs to be done on all clients you'll need to use publicvariable to run another script from the action script, which runs on all clients.
-
remember that in the action executes the script for the one who performed the action only, so everything you do in the action script will be done for the one client only. if you have something that needs to be done on all clients you'll need to use publicvariable to run another script from the action script, which runs on all clients.
This goes a little over my understanding. It would be nice if you could bend the instructions to me with "rautalanka" :)
-
What it means, roughly, is that when the script runs it will turn out the lamp only on the computer of the player who turned it out. As far as the other players are concerned the lamp will still be on.
To tell all the other computers (aka "clients") in the game what's happened you'll need to run a second script. This is where the "publicvariable" bit comes in.
-
What it means, roughly, is that when the script runs it will turn out the lamp only on the computer of the player who turned it out. As far as the other players are concerned the lamp will still be on.
To tell all the other computers (aka "clients") in the game what's happened you'll need to run a second script. This is where the "publicvariable" bit comes in.
What Im trying to say that i can understand what the script does but thats about it. Please explain it and every single detail like to a 5-year old child.
-
Try barbwire instead of "rautalanka" ;)
Here's how I'm doing it in one of my missions.
server.sqs gets executed by the action and client.sqs is activated on mission start from init.sqs
in server.sqs
_unit = _this select 1
comlinkfixer = _unit
comlink2 removeaction comlink2action
comlink2var = true
publicvariable "comlink2var"
publicvariable "comlinkfixer"
_unit playmove "combattomedic"
~3
_unit playmove "combattomedic"
~3
_unit playmove "combattomedic"
~3
_unit playmove "combattomedic"
~3
_unit playmove "combattomedic"
exit
in client.sqs
#pre
?comlink2var: goto "start"
~5
goto "pre"
#start
comlink2 say "staticE"
~7
comlink2 say "alterE"
~4
comlink2 say "noise"
~6
comlinkfixer sidechat "This can't be done. It's all fried up and the volcano is interfearing with the signal"
exit
So what happens in the above is that when the server.sqs script is activated on the persons computer who did the action, it sends a signal to the other script running on all machines, to continue from a check loop.
There's much information about this in some previous posts. Try a search with keywords client, action, server, publicvariable and those sorts of words. And lykkyä tykö :)