Home   Help Search Login Register  

Author Topic: hint only seen by player that activates it.. ?  (Read 2516 times)

0 Members and 1 Guest are viewing this topic.

Offline FiLL2d

  • Members
  • *
  • X.x
hint only seen by player that activates it.. ?
« on: 03 Jul 2006, 01:25:10 »
Hi, glad to see the site back up! I missed it :(

I was wondering if anyone can look through this script and give me a solution as to why the player that activates arrest.sqs can only see the hints, I'm not sure but I think I may need to use global/public variables?? If thats the case can you show me where to use them  ???

The menu for arrest is in the init field of a west soldier.

cop1 addaction ["Arrest","arrest.sqs"];

----arrest.sqs--------------------------------------------
_unit = _this select 0

? (cop1 == Player) : Goto "arrest"
? (cop2 == Player) : Goto "arrest"
? (cop3 == Player) : Goto "arrest"
? (cop4 == Player) : Goto "arrest"
? (cop5 == Player) : Goto "arrest"

#arrest
? (civ1 distance _unit < 10) : Goto "civ1arrest"
exit

#civ1arrest
[civ1, "2.5min"] exec "pristime.sqs"

-------------------------------------------------------------

----pristime.sqs------------------------------------------
_unit = _this select 0
_seetime = _this select 1

;jail
_capture = priscapture
_release = prisrelease

;secs
_1sec = 150
_2sec = 300
_3sec = 450
_4sec = 600

;mins
_1min = 2.5
_2min = 5
_3min = 7.5
_4min = 10
goto _seetime

#2.5min
_unit setpos getpos _capture
hint (format ["%1 has been sent to jail for %2 minutes", name unit, _1min])
~ _1sec
? (_unit distance _capture < 10) : Goto "release"
hint format ["%1 was due for release, but has since escaped", name _unit]
exit

#release
hint format ["%1 has been released ", name _unit]
_unit setpos getpos _release

-------------------------------------------------------------

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re: hint only seen by player that activates it.. ?
« Reply #1 on: 03 Jul 2006, 02:17:09 »
addactions are local
therefore the script that it runs is local to the unit that initiated the addaction
your addaction script then calls for the pristime.sqs to run
this script is also only run on the machine that initiated the addaction

if you want a message to be seen by all, then replace the hint format with a custom radio message that needs to be defined in the description.ext

alternatively have a series of repeating triggers waiting on  boolean conditions that run a simple script for your hint/titletext commands

eg to have all clients see
hint (format ["%1 has been sent to jail for %2 minutes", name unit, _1min])

have your addaction script publicvariable
a) the unit
     tx_prisoner = _unit
b) the time period
      tx_time = _1sec
c) the boolean that activates the message trigger
      tx_messageA = true
     {publicvariable _x}foreach ["tx_prisoner", "tx_time","tx_messageA"]



have your trigger
condition: tx_messageA, repeating
that on activation runs
[] exec messageA.sqs

messageA.sqs
Code: [Select]
hint (format ["%1 has been sent to jail for %2 minutes", name tx_prisoner, tx_time])
(leader group player) groupchat format [" << MESSAGE >> "%1 has been sent to jail for %2 minutes", name tx_prisoner, tx_time]
tx_messageA = false

NB>> to use a boolean in a trigger, you should initialise it in the INIT.sqs

eg

INI.SQS
Code: [Select]
tx_messageA = false
I wouldnt particularly see this as an advanced problem.

If you really wanna go the full hog, then implement COC network services, there is a function in it, that allows you to send strings across the network (BIS Publicvariable command wont do this)


« Last Edit: 03 Jul 2006, 02:20:30 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline FiLL2d

  • Members
  • *
  • X.x
Re: hint only seen by player that activates it.. ?
« Reply #2 on: 03 Jul 2006, 02:59:38 »
aha, many thanks for your post. One thing though

Quote
have your addaction script publicvariable

How'd i make an addaction a publicvariable ? Thats the bit i didn't understand.

Mark

  • Guest
Re: hint only seen by player that activates it.. ?
« Reply #3 on: 03 Jul 2006, 03:34:27 »
you'll kick yourself..

goes along the lines of

"publicvariable variable"

me thinks

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re: hint only seen by player that activates it.. ?
« Reply #4 on: 03 Jul 2006, 14:29:43 »
the addaction is placed on a unit in the unit's init field in the mission editor, so everyone will be able to access the addaction, if they get close enough to the unit that has it attached.

however the script it runs will only be run on the players machine that ran the addaction
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline FiLL2d

  • Members
  • *
  • X.x
Re: hint only seen by player that activates it.. ?
« Reply #5 on: 03 Jul 2006, 15:15:39 »
hm, ok I'm usng an addaction just local to that player now. As I don't want people sharing his actions...so

? player == cop1 : cop1arrest = player addAction ["Arrest","arrest.sqs"]

I understand that the code inside arrest.sqs will be local, so I need to use triggers that activate on bolean to display the information globally?

Quote
a) the unit
     tx_prisoner = _unit
b) the time period
      tx_time = _1sec
c) the boolean that activates the message trigger
      tx_messageA = true
     {publicvariable _x}foreach ["tx_prisoner", "tx_time","tx_messageA"]

does 'c)' belong in a tigger?

Please can you tell me which bits of code go where because I'm abit confused, thanks.

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re: hint only seen by player that activates it.. ?
« Reply #6 on: 03 Jul 2006, 19:39:58 »
Quote
have your addaction script publicvariable
a) the unit
     tx_prisoner = _unit
b) the time period
      tx_time = _1sec
c) the boolean that activates the message trigger
      tx_messageA = true
     {publicvariable _x}foreach ["tx_prisoner", "tx_time","tx_messageA"]

it belongs in the addaction script

the trigger  setup would be as follows

Activation, Nobody repeating
condition: tx_messageA
On activation: "" exec "messageA.sqs"
« Last Edit: 03 Jul 2006, 19:41:44 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline FiLL2d

  • Members
  • *
  • X.x
Re: hint only seen by player that activates it.. ?
« Reply #7 on: 04 Jul 2006, 03:18:19 »
thanks, i got the global hint working, although it doesnt remember the player name and doesnt show it, just shows 2 blank spaces instead of the name. I've attached it if you can look at it.

Thanks for helping me, I appreciate it very much

EDIT: fixed, thanks all.
« Last Edit: 04 Jul 2006, 16:21:41 by FiLL2d »

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: hint only seen by player that activates it.. ?
« Reply #8 on: 04 Jul 2006, 15:06:17 »
please only attach zip folders when submitting attachments.