Home   Help Search Login Register  

Author Topic: resurrecting objects  (Read 758 times)

0 Members and 1 Guest are viewing this topic.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
resurrecting objects
« on: 15 Dec 2004, 15:42:47 »
okay, i've had no luck searching through the scripts in the editor's depot, and i see no reason why what i'm doing shouldn't work, so here we all are.

apologies if you've seen this thread on the general scripting board.

scenario. tanks rolling down the hill, they hit a trigger which calls a script telling them to fire upon target barrels. fine. that works. this is all just so i can have the tanks peppering the area. i know about artillery scripts and such, but i want it done this way for simplicity's sake.

there's a trigger set up to detect the damage on the barrels, and if it goes any higher than 0, a script is called to set the damage back to 0 and replace the barrels on their spots (with a wee bit of random placement for variety).

problem being, once the barrels are dead, they don't want to be brought back to life, at least not through a normal trigger. wondering what was going on, i assigned the reset script to a radio channel and noticed something quite odd - when the barrels are hit, naturally they fly off into the air and such, and when i hit the reset command, the barrels would be replaced no problem, but they'd immediately continue flying. very veird.

i assume this is why the script wasn't playing along automatically, that the barrels still have a flying-through-the-air animation to complete before coming to rest. but even waiting until they're completely motionless before resetting them, the tanks no longer recognise them as targets, perhaps because they know they've already been blown up?

any ideas? i've been pointed at invincibility scripts, but can't find any listed in the scripts section, and this head scratcher is slowly turning me green.

thanks in advance
bedges

StonedSoldier

  • Guest
Re:resurrecting objects
« Reply #1 on: 15 Dec 2004, 15:53:46 »
flying barrels eh??

barrelname setvelocity [0,0,0]

and to make the barrels invincible.

trigger : continous

condition: damage barrelname > 0.5
activation : barrelname setdamage 0.0

or you could once the barrel was destroyed just camcrate another fresh barrel
« Last Edit: 15 Dec 2004, 15:55:03 by StonedSoldier »

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:resurrecting objects
« Reply #2 on: 15 Dec 2004, 16:30:15 »
hmm right, no more flying barrels, that works fine, as does the replacment on their spots. it seems the trigger for invincibility is what's not working, not even when i call a script setting damage to 0. the barrels return to their spots, but they're still blowed up.

as for camcreating.... i'm a noob in that respect, although looking at the syntax it appears i can only create a seagull. i'm using version 1.96 but without any mods or addons.

bored_onion

  • Guest
Re:resurrecting objects
« Reply #3 on: 15 Dec 2004, 21:33:25 »
newbarrel = "whateverthenameofabarrelis" camcreate [x,y,z]

the xyz refers to the position of the placement

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:resurrecting objects
« Reply #4 on: 16 Dec 2004, 01:08:41 »
You can camCreate pretty much anything.     I think there is an example in the online version of the comref.    You are right that the actual comref itself is not very clear.

Grabbing stuff that is dead can be tricky.   It is usually ok when the object/unit has only just died, but it seems to be the case that once something has been dead for a while, the game "forgets" that its name ever existed.    At least sometimes or in some circumstances.
Plenty of reviewed ArmA missions for you to play

RedHouse

  • Guest
Re:resurrecting objects
« Reply #5 on: 16 Dec 2004, 01:13:53 »
it can be any of these:
newbarrel = "Barrel1" camcreate [x,y,z]
newbarrel = "Barrel2" camcreate [x,y,z]
newbarrel = "Barrel3" camcreate [x,y,z]
newbarrel = "Barrel4" camcreate [x,y,z]

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:resurrecting objects
« Reply #6 on: 16 Dec 2004, 17:20:14 »
thanks for the syntax there redhouse - i was wondering whateverthenameofabarrel was :P

the only other question i have concerning this is, is it possible to dynamically create variables? the problem i foresee is that requiring a named target as <dofire> does, once the first set of barrels is dead, i need to create another set with script, and they all need names which can then be passed to <dofire>.

i have experience in programming, but am just getting into the syntax of the opf language, so might an incremented array do the trick? i've spotted the <format> bit of code to add bits of variables and strings together, so would that work? i just need something that will let me create foo1, foo2, foo3 etc.

no biggie really. i'm content to have the tanks fire off a few shots to announce their arrival, and frankly if they were to carry on shelling the town my guys wouldn't stand a chance, and there's only five of them, poor guys.

thanks meantime
b

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re:resurrecting objects
« Reply #7 on: 16 Dec 2004, 18:12:30 »
Check out the FAQ and tutorials for vehicle creation. The command is CreateVehicle.

To use Format to create new variables something like the following would do the trick:

Code: [Select]
Call Format["foo%1 = %2",_foox, _fooy]
or

Code: [Select]
fooArray = []
_i = 0
{Call Format ["foo%1 = %2 ; fooArray = fooArray + [foo%1]",_i, (SomeCommand _x )]; _i = _i + 1} ForEach Unit tankgroup

In OpFL-speak they are called metavariables, and may also be invoked using ForEach and Count. Dinger's Variable and Array Tutorial has examples of this, but predates the Call command.  It is a good idea to pass metavariable names into an array as you create them so that you can keep track of them.


the only other question i have concerning this is, is it possible to dynamically create variables?i've spotted the <format> bit of code to add bits of variables and strings together, so would that work? i just need something that will let me create foo1, foo2, foo3 etc.
« Last Edit: 16 Dec 2004, 18:13:15 by Mr.Peanut »
urp!

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:resurrecting objects
« Reply #8 on: 16 Dec 2004, 20:12:50 »
strange the sound effects created in my head when trying to understand stuff like this. lots of clunking and whooshing and grinding.

i think bit by bit as i go through even the above line of code, i'm beginning to see what needs to be done. thanks for the pointer.

bedges

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re:resurrecting objects
« Reply #9 on: 17 Dec 2004, 15:39:50 »
Yes, it does hurt.  And the pain never fades completely...Sometimes the solutions required are damn awkward...

Hmmm... never realised damn was so controversial a word.    Damn damn damn damn damn damn damn damn damn damn damn         :P

Let's see if felch and santorum pass the language filter test.   Heh!  :-*
« Last Edit: 17 Dec 2004, 23:35:43 by Mr.Peanut »
urp!