Home   Help Search Login Register  

Author Topic: some variable problems  (Read 690 times)

0 Members and 1 Guest are viewing this topic.

charunks

  • Guest
some variable problems
« on: 27 Dec 2003, 16:33:01 »
Hi guy' s , glad that the forum is online again.

I am currently building an rts/shooter mission on opfl.
Each side has ONE money pool. But if a friend of mine builds something, his money decreases and mine remains the same.
How do I change it so if someone else buys something your money decreases too (public variable)?

kinda the same problem,
If a player builds a building, sometimes actions are added to them.
Only the person who has build the building ses them. How do you change it so others can too?

thnx for helping me out!

EDIT no II:

ok.. I' ve been digging into the site and found this command:

PublicVariable "VariableName"

I' m not sure but I think it will solve my shared money variable problem.

can I use this command for adding actions (for instance)
PublicVariable "actionheal"

actionheal= this addaction ["heal me","healme.sqs"]

This way, is everybody going to see the actions?

edit III:

ok... making actions public doesn' t work as strings can' t be public.
I ' ve modified my script:

if (WestRecource>499) then { goto "build" } else { goto "no" }


#build
PublicVariable "varPoshp"
varPoshp=[(varPosbuilder select 0) + 8, (varPosbuilder select 1) + 8]

helip= "HeliH" createvehicle varPoshp
;buildheli exec "hhelibuild.sqs"
_rearm = "Truck5tRepair" createvehicle [(varPoshp select 0) + 8, (varPoshp select 1)]
_rearm lock true
_refuel= "Truck5tRefuel" createvehicle [(varPoshp select 0), (varPoshp select 1) + 8]
_refuel lock true
_repair= "Truck5tRepair" createvehicle [(varPoshp select 0) + 8, (varPoshp select 1) + 8]
_repair lock true
WestRecource=WestRecource-500
WestPower=WestPower-150
hint "Helipad build"
goto "addaction"

#addaction
if (WestPower<0) then {goto "check"}
buh60 = helip addaction ["Build UH60 $200", "builduh60.sqs"]
bCobra= helip addaction ["Build Cobra $600", "buildcobra.sqs"]

#resah64
if (ResAH64==1) then {goto "addAH64"} else {goto "check"}

#check
~5
if (WestPower<0) then {goto "removeaction"} else {goto "live"}

#powercheck
~5
if (WestPower<0) then {goto "powercheck"} else {goto "addaction"}

#addAH64
bAH64= helip addaction ["Build Apache $1000", "buildah64.sqs"]
; removing AH64 tag, so it will be added once
ResAH64=2
goto "check"

#removeaction
helip removeaction buh60
helip removeaction bCobra
if (ResAH64==2) then {helip removeaction bAH64}
ResAH64=1
goto "powercheck"

;ending the script
#no
hint "not enough funds SIR"
exit

#live
~1
if (alive helip) then {goto "resah64"} else {goto "end"}

#end
WestPower=WestPower+150

#delveh
deletevehicle helip
deletevehicle _rearm
deletevehicle _repair
deletevehicle _refuel
exit

never mind all the loops... basically it says build some building and add some actions.
The building is created for every player... But only the builder get' s to se the actions...

1) How come?
2) my problem is still there :S  :P .. and I' m running out of idea' s...  8)
hopefully someone can help me out while I grab a beer

thnx
« Last Edit: 29 Dec 2003, 14:09:51 by charunks »

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:some variable problems
« Reply #1 on: 04 Jan 2004, 13:47:08 »
I dont know if you can PV an addaction, never tried it.

Posibly have to activate it may work as triggers are local to every machine

If not have every client running a looping script that is waiting for a boolean to become true

eg
Action_A = true; Publicvariable "Action_A"

and other scripts waiting as in

@ Action_A: []exec "Scriptname.sqs"

or a trigger
condition: Action_A
On Activation: [] exec "Scriptname.sqs"
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123