OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Captain Crunch on 23 May 2003, 23:33:56

Title: Get A Game Logic to set dammage?
Post by: Captain Crunch on 23 May 2003, 23:33:56
Hi everyone!  :D

   I'm trying to build a very small and simple script that will SetDammage anything that comes close to it. Very useful for fires or just to annoy the others!! ;D

I've placed a GameLogic with in it's Init field   [This] Exec "Dammage.sqs"

And the script looks like this:



_Obj = _This Select 0


#Loop

? (_Obj Distance Logic1 < 10) : _Obj SetDammage 1

goto "Loop"


And it does not work! Any idea why? BTW, if I change "_Obj" for the name of the player that walks or drives close to "Logic1", then it works. How could I make ANY units or vehicles or objects get the dammage when they get close to the Logic?

  And even better, how could I make the "SetDammage" command to set only a few dammage to the object every 1 second for example? I tried this but it doesn't work:

   

_Obj = _This Select 0


#Loop

? (_Obj Distance Logic1 < 10) : _Obj SetDammage 0.2

~1

goto "Loop"

Any ideas?

  Many Thanx in advance!

 :D
Title: Re:Get A Game Logic to set dammage?
Post by: macguba on 24 May 2003, 00:19:25
Create a trigger, centered on the danger spot (you don't need the gamelogic) with size as you like - say 10x10.

Activation box:   Anybody present repeatedly
On activation:   "_x setdammage 1" forEach units thislist

syntax not guaranteed.    Alternatively, add a countdown of 1 second (write 1 in each box) and have this

On activation:    "_x setdammage ((getdammage _x)+0.1)" forEach units thislist

Again, you may have to play with the syntax.
Title: Re:Get A Game Logic to set dammage?
Post by: Captain Crunch on 25 May 2003, 17:24:16
Hmm. I get an error message:

Error Type Array, Expected Object, Group

Do You know where I could find the right syntax?
Title: Re:Get A Game Logic to set dammage?
Post by: macguba on 25 May 2003, 17:29:06
It might be forEach thislist, I can never remember.
Title: Re:Get A Game Logic to set dammage?
Post by: Captain Crunch on 25 May 2003, 17:53:22
Yes, thats ForEach ThisList.

Your first works fine: On activation:  "_x setdammage 1" forEach thislist

But the second doesn't:

"_x setdammage ((getdammage _x)+0.1)" forEach thislist


It would be a great deal to get it working. (please ;D) That the object gets a bit dammage every second or so when in the danger area.

I first wanted to use a gamelogic cos the fire will start on a vehicle that was MOVING! So with a trigger it would be imposible. I'm going to try to switch and mix this into a script! :D