Home   Help Search Login Register  

Author Topic: "Pull the cables out"  (Read 1937 times)

0 Members and 1 Guest are viewing this topic.

Egwal

  • Guest
"Pull the cables out"
« 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.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:"Pull the cables out"
« Reply #1 on: 26 Jun 2004, 16:33:28 »
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.
Plenty of reviewed ArmA missions for you to play

Egwal

  • Guest
Re:"Pull the cables out"
« Reply #2 on: 27 Jun 2004, 09:18:58 »
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?

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:"Pull the cables out"
« Reply #3 on: 27 Jun 2004, 12:45:42 »
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"
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:"Pull the cables out"
« Reply #4 on: 27 Jun 2004, 14:59:11 »
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.
Not all is lost.

Egwal

  • Guest
Re:"Pull the cables out"
« Reply #5 on: 27 Jun 2004, 16:35:28 »
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" :)

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:"Pull the cables out"
« Reply #6 on: 27 Jun 2004, 16:48:57 »
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.

« Last Edit: 27 Jun 2004, 16:53:15 by macguba »
Plenty of reviewed ArmA missions for you to play

Egwal

  • Guest
Re:"Pull the cables out"
« Reply #7 on: 27 Jun 2004, 19:06:26 »
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.




Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:"Pull the cables out"
« Reply #8 on: 27 Jun 2004, 19:57:02 »
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
Quote
_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
Quote
#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ö  :)
« Last Edit: 27 Jun 2004, 19:58:02 by Artak »
Not all is lost.