OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Sniperwolf572 on 13 Sep 2005, 01:14:39

Title: ECP Hand Grenades and CamCreate
Post by: Sniperwolf572 on 13 Sep 2005, 01:14:39
Hello everyone,

Problem:

I'm making a cutscene for a campaign and I need to create ECP's Fuse Hand Grenade (Hand Grenade that bounces around and detonates after a while).

This is the situation:
There is Soldier named gerksk1 hidden behind stack of crates, there are some soldiers shooting at him (they don't hit him) but they're behind camera so lets forget about them. Now I want to create ECP's Hand Grenade with CamCreate and make it look like it came from behind the camera over the crates and near the soldier, wait for a while and detonate. But, as you can see I can't figure out how to create ECP's Grenade.

Someone help me out please.
Title: Re:ECP Hand Grenades and CamCreate
Post by: Tyger on 13 Sep 2005, 02:41:07
First find the classname of the ECP Hand Grenade.

Then just type this in where you want the grenade to explode in your script:

Code: [Select]
_grenade1 = "ECPGrenadeClassName" camCreate [getMarkerPos "grenadepos" select 0,getMarkerPos "grenadepos" select 1,0]

Then place an empty marker at the spot where the grenade is to go off and name it
Code: [Select]
grenadepos
Title: Re:ECP Hand Grenades and CamCreate
Post by: Blanco on 13 Sep 2005, 02:44:40
AFAIK an ECP grenade has the same classname as a normal BISgrenade

Code: [Select]
"grenadehand"But when you camcreate it, it will explode immediately.
Title: Re:ECP Hand Grenades and CamCreate
Post by: Sniperwolf572 on 13 Sep 2005, 02:51:58
Problem is that there is not ECP Grenade Class name, Grenade you throw in OFP is classed as regular bis grenade, but I suspect that ECP team has used fired event handler to replace default grenade and substitute it with their model witch is probably thing class (Witch would explain rolling and animation).

In the meantime, I managed to make a simple script to do the desired effect, might me kinda complicated but here it is:

Code: [Select]
; Create ECP Grenade model and setpos it 4m above Nade1 unit (Invisible H in my case)
ECP_GRENADE= "ECP_MKIIDummy" CamCreate  [(getpos Nade1 select 0), (getpos Nade1 select 1), (getpos Nade1 select 2)+4]
; Rotate the grenade 90 degrees so grenade is sideways
ECP_GRENADE setdir 90
; "Bump" the grenade to the right and up a bit
ECP_GRENADE setvelocity [10,0,1]
; It should take grenade 1.05 seconds to reach the ground (in my case)
~1.05
; Bump the grenade again to achieve bouncing effect
ECP_GRENADE setvelocity [5,0,2]
; And again
~0.38
ECP_GRENADE setvelocity [3,0,1]
; After 2 Seconds create explosive BIS grenade to simulate explosion
~2
EXPLOSIVE_GRENADE= "GrenadeHand" CamCreate  [(getpos ECP_GRENADE select 0), (getpos ECP_GRENADE select 1), (getpos ECP_GRENADE select 2)-0]
; Delete the "fake" grenade
deletevehicle ECP_GRENADE
exit

Needs a little tweaking on detection when grenade has hit the ground but generally thats it.

EDIT: I'll leave the thread unsolved because someone might find out ECP's way or make simpler script than mine.
Title: Re:ECP Hand Grenades and CamCreate
Post by: Kyle Sarnik on 13 Sep 2005, 03:39:04
Bah, who needs ECP, if you grab my Grenade Pack you can get realistic time fused bouncing grenades. All sorts of throwables are included, like the M67, M61, Mk2, ANM8 smoke, M18 smoke, and a few flashbangs. You can grab it here (http://ofp.gamezone.cz/index.php?showthis=8760).

Now I can help you:

Code: [Select]
_unit = _this

_pos = (getpos _unit)
_grenstart = [_pos select 0, (_pos select 1)+5,(_pos select 2)+1.5]
_grenvel = [0,-11,8]

_grenade = "BD_M61" createvehicle _grenstart
_grenade setvelocity _grenvel
[_grenade,_grenade] exec "\BD_GrenadePack\firedM61.sqs"
exit

Just mess with the rel pos and velocity a bit, or tell me the desired distance and direction (north, south, east, or west) of the grenade in relation to the unit (the guy behind the crates) and I can try and calculate it.
Title: Re:ECP Hand Grenades and CamCreate
Post by: Triggerhappy on 13 Sep 2005, 05:32:18
WHO NEEDS ECP?!?
Have you tried ecp?? its fookin awesome! ::) :-X
Title: Re:ECP Hand Grenades and CamCreate
Post by: Kyle Sarnik on 13 Sep 2005, 20:56:17
WHO NEEDS ECP?!?
Have you tried ecp?? its fookin awesome! ::) :-X

I don't believe in those eye-candy conversion mods, its just extra lag and HD space. I'm not trying to make ECP look bad, I am just saying that its only for the "unenlightened" ones among us. Anyways I garentee you will have better results with my grenade pack than with the ECP one  ;)