Home   Help Search Login Register  

Author Topic: script wont work  (Read 854 times)

0 Members and 1 Guest are viewing this topic.

Offline Zombie

  • Members
  • *
  • Beware the night, the zombie walks among you
    • USI
script wont work
« on: 23 Jul 2003, 21:48:36 »
I'm trying to make my buildings invulnerable.  They were created using gamelogics and named bu1...bu6.  I have been fighting this script for an hour now, help!
?!(local Server): Goto "end"
#check
_bu=[bu1,bu2,bu3,bu4,bu5,bu6]
_bu select 0
?((getdammage _x foreach _bu) >.2):goto "fix"
#fix
"_x setdammage 0" foreach _bu
goto "check"
#end
exit

max_killer_payne

  • Guest
Re:script wont work
« Reply #1 on: 23 Jul 2003, 22:06:04 »
You use the foreach command, correct? So this means the script thinks the buildings are in a script. Maybe it only saves one of the buildings. I aint very good in the getdamage department. But perhaps you could put:

[bu1,bu2,bu3,bu4,bu5,bu6] join bu

Offline .pablo.

  • Former Staff
  • ****
  • When in doubt, empty the magazine.
Re:script wont work
« Reply #2 on: 23 Jul 2003, 22:23:09 »
I'm trying to make my buildings invulnerable.  They were created using gamelogics and named bu1...bu6.  I have been fighting this script for an hour now, help!
?!(local Server): Goto "end"
#check
_bu=[bu1,bu2,bu3,bu4,bu5,bu6]
_bu select 0
?((getdammage _x foreach _bu) >.2):goto "fix"
#fix
"_x setdammage 0" foreach _bu
goto "check"
#end
exit


try this:
"?(damage _x > .2) : (_x setdammage 0)" foreach _bu
« Last Edit: 23 Jul 2003, 22:23:44 by pablo_m123 »

Offline Zombie

  • Members
  • *
  • Beware the night, the zombie walks among you
    • USI
Re:script wont work
« Reply #3 on: 23 Jul 2003, 22:51:22 »
as you typed it I get an invalid number in expression error, without the quotes, no error but no function either.  I am calling the script from the init.sqs

?!(local Server): Goto "end"
#check
_bu=[bu1,bu2,bu3,bu4,bu5,bu6]
_bu select 0
?(damage _x > .2) : (_x setdammage 0) foreach _bu
goto "check"
#end
exit

deaddog

  • Guest
Re:script wont work
« Reply #4 on: 24 Jul 2003, 01:44:31 »
Try it this way instead:

{if (getdammage _x > .2) then {_x setdammage 0}} foreach _bu

Offline Zombie

  • Members
  • *
  • Beware the night, the zombie walks among you
    • USI
Re:script wont work
« Reply #5 on: 24 Jul 2003, 01:52:06 »
nope, the buildings get destroyed
?!(local Server): Goto "end"
#check
_bu=[bu1,bu2,bu3,bu4,bu5,bu6]
_bu select 0
{if (getdammage _x > .2) then {_x setdammage 0}} foreach _bu
goto "check"
#end
exit

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:script wont work
« Reply #6 on: 24 Jul 2003, 18:03:31 »
dont bother checking to see if they are damaged, simply repair them on each script loop

I use the following script on all my maps for the likes of ammo crates etc


Init.sqs entry

damconarrayA=[bu1.bu2.bu3.bu4.bu5]
damconarrayB=[bu6,bu7,bu8,bu9,bu10]
damconarrayC=[bu11,bu12,bu13, bu14, bu15]
[]exec "Damcon.sqs"

-------------------------------------------------------------------------------------------------------------------
If there are a lot of objects that you need kept in a good state of repair then create more Damconarrays
__________________________________________________________________________

then the script itself
;;Damcon.sqs
#START
?(Time>=Param1):exit
~3
{_x Setdammage 0} forEach damconarrayA
~3
{_x Setdammage 0} forEach damconarrayB
~3
{_x Setdammage 0} forEach damconarrayC
goto "START"
#End
Exit


use whatever ~wait period you want between the setdammage statements, i wouldnt run it any faster than ~1, especially if you have a lot of other scripts running
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline Zombie

  • Members
  • *
  • Beware the night, the zombie walks among you
    • USI
Re:script wont work
« Reply #7 on: 24 Jul 2003, 18:32:26 »
Still wont work, I've attached my mission so maybe you can help debug it.  I am only using the resistance tank to test whether the middle hangers, bu3,bu4, are indestructable.  I have pounded the other buildings with the tank and they won't die anyway, it's just the hangers

Offline .pablo.

  • Former Staff
  • ****
  • When in doubt, empty the magazine.
Re:script wont work
« Reply #8 on: 24 Jul 2003, 18:50:35 »
_bu select 0

what is that line in there for?

Offline Zombie

  • Members
  • *
  • Beware the night, the zombie walks among you
    • USI
Re:script wont work
« Reply #9 on: 24 Jul 2003, 18:57:19 »
not sure exactly, I tried it without and things didn't work either.  I kinda based the script on 1 of Karrilions and he had that line in there too

Offline .pablo.

  • Former Staff
  • ****
  • When in doubt, empty the magazine.
Re:script wont work
« Reply #10 on: 25 Jul 2003, 06:08:55 »
Quote
?!(local Server): Goto "end"
#check
_bu=[bu1,bu2,bu3,bu4,bu5,bu6]
_bu select 0
{if (getdammage _x > .2) then {_x setdammage 0}} foreach _bu
goto "check"
#end
exit

nevermind what i posted, i tried it and it doesn't work...
i'll post when i get it to work

edit: tried this and it worked, strange why the if-then wasn't working...

Quote
?!(local Server): Goto "end"
#check
_bu = [bu1,bu2,bu3,bu4,bu5,bu6]
"_x setdammage 0" foreach _bu
~1
goto "check"
#end
exit

just looked at your mission, the reason it wasn't working was because you named the gamelogic bu#, not the hangars.

in the init of the gamelogics, replace house with bu#, and delete bu# from the name field of the gamelogic.  tried it and it worked perfectly.

Quote
bu3 = "ResHousehangar_2" createVehicle getPos this;
« Last Edit: 25 Jul 2003, 07:01:39 by pablo_m123 »

Offline Zombie

  • Members
  • *
  • Beware the night, the zombie walks among you
    • USI
Re:script wont work
« Reply #11 on: 25 Jul 2003, 14:20:02 »
DOH!!!!  I KNEW it was something so simple it was easy to miss.  I never even considered the way I named the buildings!  Thanks a lot!  Now I can get rid of all the aborted scripts and get this thing finished!