Home   Help Search Login Register  

Author Topic: Flak  (Read 1716 times)

0 Members and 2 Guests are viewing this topic.

Zahael

  • Guest
Flak
« on: 15 Oct 2002, 17:23:35 »
Anyone know of any script ideas for flak?  I am making a parachute mission and as my para's come down, I'd like flak to expode around them, though not actually kill them.

Thanks for any help

Zahael

seanver

  • Guest
Re:Flak
« Reply #1 on: 15 Oct 2002, 17:34:30 »
From the OFP Editing FAQ:

Quote
ADVANCED ENHANCEMENTS: Creating Explosions ( (Beginner) Submitted by: toadlife   Credits: Sui
QUESTION:Anyhow I was wondering if there is a way to create an explosion in midair?
ANSWER: If you want to get ordinance exploding in mid air, try camcreateing two of the ordinance at exactly the same position. Eg:

_big_bang = _ordnance camCreate [x1,y1,z1]
_big_bang = _ordnance camCreate [x1,y1,z1]

Due to the two shells being in the same place, they will explode. Looks good as flak, especially at night.

Mike

  • Guest
Re:Flak
« Reply #2 on: 16 Oct 2002, 03:08:09 »
Im sorry for "stealing" the thread.. but:

_big_bang = _ordnance camCreate [x1,y1,z1]


_big_bang(what does the _big_bang mean? and what can I change it to or what is its purpose) = _ordnance(I figure _ordanance is the object u want to create "a bombshell in this case") camCreate [x1,y1,z1](then create it and position it..)

Just want to know what the _big_bang is all about, or any name before a Create Spell..?

Offline Black_Feather

  • Former Staff
  • ****
  • I'll never forget you Daisey.
Re:Flak
« Reply #3 on: 16 Oct 2002, 04:03:14 »
bigbang is just a name given to the camcreated object.

Offline DrStrangelove

  • Members
  • *
  • Mr.Creative
Re:Flak
« Reply #4 on: 16 Oct 2002, 13:20:15 »
I guess that CamCreate returns an object and something needs to 'take over' this data, so _big_bang is just a dummy data container.

I don't think you can do anything with _big_bang because both objects will be Null after the explosion, or ?

david-p

  • Guest
Re:Flak
« Reply #5 on: 16 Oct 2002, 14:37:51 »
_big_bang could be _banana or _sausage, thats just a name, as DrStrangeLove said, the game needs to name its data. And yes in this case the name is uselss to us at it will null soon after being created. but that is a good thing, as u can easily put a loop in, and its ok using the same name over and over.

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:Flak
« Reply #6 on: 17 Oct 2002, 00:02:17 »
If you want to make a flak field around a specific object, but don't want that object to ever be hit by the flak, you will need to check the co-ordinates in relation to the object before you camcreate the flak.

As an example, here's what I used in one of my missions:

Code: [Select]
#loop
_tim0r = random 0.7
_tim0r = _tim0r + 0.2
~_tim0r
#rechoose
? (heli1hit): fir setpos [(getpos heli1 select 0) - 5, getpos heli1 select 1, (getpos heli1 select 2) + 2]
_xrand = random 500
_yrand = random 500
? (_xrand > 242) and (_xrand < 258): goto "rechoose"
? (_yrand > 240) and (_yrand < 260): goto "rechoose"
? (((getpos (leader heligrp1) select 0)+(_xrand - 250)) > ((getpos heli2 select 0) - 25)) and (((getpos (leader heligrp1) select 0)+(_xrand - 250))  < ((getpos heli2 select 0) + 25)): goto "rechoose"
? (((getpos (leader heligrp1) select 1)+(_yrand - 250))  > ((getpos heli2 select 1) - 25)) and (((getpos (leader heligrp1) select 1)+(_yrand - 250))  < ((getpos heli2 select 1) + 25)): goto "rechoose"
_boom = "shell73" camcreate [(getpos (leader heligrp1) select 0)+ (_xrand - 250),(getpos (leader heligrp1) select 1) + (_yrand - 250), getpos (leader heligrp1) select 2]
_boomer = "heat73" camcreate [(getpos (leader heligrp1) select 0)+ (_xrand - 250),(getpos (leader heligrp1) select 1) + (_yrand - 250), getpos (leader heligrp1) select 2]
? not (flakstop) and (alive heli2): goto "loop"
exit

The flak field was centered on a helicopter (leader heligrp1) and was made to never shoot down this helicopter. The player was riding in another helicopter (heli2), this too was avoided at all costs.
These two lines:
Code: [Select]
? (_xrand > 242) and (_xrand < 258): goto "rechoose"
? (_yrand > 240) and (_yrand < 260): goto "rechoose"
Make the flak avoid the first helicopter (as between those co-ords is the center of the flak field, or the position of leader heligrp1)
And this code:
Code: [Select]
? (((getpos (leader heligrp1) select 0)+(_xrand - 250)) > ((getpos heli2 select 0) - 25)) and (((getpos (leader heligrp1) select 0)+(_xrand - 250))  < ((getpos heli2 select 0) + 25)): goto "rechoose"
? (((getpos (leader heligrp1) select 1)+(_yrand - 250))  > ((getpos heli2 select 1) - 25)) and (((getpos (leader heligrp1) select 1)+(_yrand - 250))  < ((getpos heli2 select 1) + 25)): goto "rechoose"
Detects if the co-ords are within 25m of the second helicopter (if they are, it rechooses them).

Happy editing ;)

Zahael

  • Guest
Re:Flak
« Reply #7 on: 21 Oct 2002, 06:21:16 »
Hey thanks for tha tcode sui.  How do I use it in the game ?  Obviously I have to call a script, but what parameters do I use?

Thanks

Zahael

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:Flak
« Reply #8 on: 21 Oct 2002, 10:26:45 »
Hmm... if you really want to use that snippet, you could without passing anything to the script.

However you would need to have a helicopter called heli1, and another called heli2 both in a group called heligrp1.

I suggest you go through and replace those names with ones you have in your mission (use the replace all function in notepad)... you may experience mixed results though.

I generally write code specific to my missions, and trying to transfer it to another mission could bring headaches. Give it a go as suggested above, and see if it suits your purposes ;)

red devil

  • Guest
Re:Flak
« Reply #9 on: 21 Oct 2002, 17:20:55 »
try this skript the flak follows u so u dont have to worry about anything

Zahael

  • Guest
Re:Flak
« Reply #10 on: 22 Oct 2002, 06:25:05 »
Hey, thanks mate, its an awesome script and I want to use it, but my mission is for paratroopers.  I want My guys to be under fire as they float down but not actually be hit.  Could you adapt your script for those purposes.

REgardless, I tried your script to see what it was like and it didn't seem to work that well for me.  Can you give me an example mission?

Thanks for your time.

Zahael

Zahael

  • Guest
Re:Flak
« Reply #11 on: 23 Oct 2002, 13:35:22 »
your script doesn't work