Home   Help Search Login Register  

Author Topic: Bit of Gib Script i have  (Read 2242 times)

0 Members and 1 Guest are viewing this topic.

Offline Noobinator

  • Members
  • *
Bit of Gib Script i have
« on: 31 Jul 2009, 23:10:54 »
Hello everyone, ok well i have some script, i can show you, this will gib the npc, but i have no other code, im stuck, i need the conditions, for first, finding out if the npc is dead, and second. is npc moving at a high volocity due to explosion.

Here is the script


Quote

_unit = _this select 0;

_VelocityX = random 10;
_VelocityY = random 7;
_VelocityZ = random 10;
_direc = getDir _unit

~0.0000002

_gib001 = "HEAD_GIB" createVehicle getpos _unit; _gib001 setVelocity [_VelocityX,_VelocityY,_VelocityZ]
_gib001 setpos [ getPos _unit select 0, getPos _unit select 1]
_gib001 setDir _direc

_gib002 = "TORSO_GIB" createVehicle getpos _unit; _gib002 setVelocity [_VelocityZ,_VelocityX,_VelocityZ]
_gib002 setpos [ getPos _unit select 0, getPos _unit select 1]
_gib002 setDir _direc

_gib003 = "LEFT_ARM_GIB" createVehicle getpos _unit; _gib003 setVelocity [_VelocityZ,_VelocityX,_VelocityZ]
_gib003 setpos [ getPos _unit select 0, getPos _unit select 1]
_gib003 setDir _direc

(And so on for the other body parts)

deleteVehicle _unit
 

Any help, would be nice  :)


Noobinator


« Last Edit: 31 Jul 2009, 23:12:27 by Noobinator »

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Bit of Gib Script i have
« Reply #1 on: 02 Aug 2009, 09:55:45 »
Use the the killed eventHandler, that way your code only gets executed when the npc dies.

As for the velocity, you might get by just by checking if the z velocity (upwards) has changed dramatically :dunno:
Code: [Select]
if ((vehicle _unit) == _unit && (velocity _unit select 2)>0)
 then {..gib stuff here...};
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Noobinator

  • Members
  • *
Re: Bit of Gib Script i have
« Reply #2 on: 02 Aug 2009, 17:27:12 »
Thanks buddy for your reply! :D


ok so should the code now look like this;

Quote


_unit = _this select 0;

if ((vehicle _unit) == _unit && (velocity _unit select 2)>0)
 then {_VelocityX = random 10;
_VelocityY = random 7;
_VelocityZ = random 10;
_direc = getDir _unit

~0.0000002

_gib001 = "HEAD_GIB" createVehicle getpos _unit; _gib001 setVelocity [_VelocityX,_VelocityY,_VelocityZ]
_gib001 setpos [ getPos _unit select 0, getPos _unit select 1]
_gib001 setDir _direc

_gib002 = "TORSO_GIB" createVehicle getpos _unit; _gib002 setVelocity [_VelocityZ,_VelocityX,_VelocityZ]
_gib002 setpos [ getPos _unit select 0, getPos _unit select 1]
_gib002 setDir _direc

_gib003 = "LEFT_ARM_GIB" createVehicle getpos _unit; _gib003 setVelocity [_VelocityZ,_VelocityX,_VelocityZ]
_gib003 setpos [ getPos _unit select 0, getPos _unit select 1]
_gib003 setDir _direc

(And so on for the other body parts)

deleteVehicle _unit};
 
 

« Last Edit: 02 Aug 2009, 17:32:02 by Noobinator »

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Bit of Gib Script i have
« Reply #3 on: 02 Aug 2009, 22:07:58 »
You should be able to get some sort of results with that yes (hopefully :P).

But, you have to change it to sqf because sqs (which that script seems to be) does not support formatting like that, everything within the then {}; would need to be on one line if you keep using sqs.

Just remember that the sqf script is executed by execVM and the ~ has to be replaced with sleep, and each line has to end with ;
And btw, that pause is kinda useless because it's way too short to have any effect.
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Noobinator

  • Members
  • *
Re: Bit of Gib Script i have
« Reply #4 on: 03 Aug 2009, 13:45:46 »
Thank you so much for this :D


Now for it to run in game, do i need a config? or can i just use the init line in the editor?



Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Bit of Gib Script i have
« Reply #5 on: 03 Aug 2009, 14:46:38 »
You can use the init line.
Or a config, it depends on how you want to go about doing this..
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Noobinator

  • Members
  • *
Re: Bit of Gib Script i have
« Reply #6 on: 03 Aug 2009, 15:11:56 »
Thanks :D

Could you also explain to me how i implement the (killed eventhandlers)?




Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Bit of Gib Script i have
« Reply #7 on: 03 Aug 2009, 17:02:55 »
For the init field
Code: [Select]
this addEventHandler ["killed",{_this execVM "yourscriptname.sqf"}](should work unless something has changed since A1)

And since this is for Arma2 you have to initialize all the variables you use first, in the beginning of the script.

Also, that velocity part might not be sufficient enough, it may very well be that you have to check the whole velocity and that's where my math skills don't extend to..
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline p75

  • Members
  • *
Re: Bit of Gib Script i have
« Reply #8 on: 04 Aug 2009, 08:21:01 »
I'm also new to scripting (my appologies, trying to learn it), but could you please tell me how do I get this working? I'm mainly interested to get this working for the bullets from the Attack Helicopters. Willl that work?


Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Bit of Gib Script i have
« Reply #9 on: 04 Aug 2009, 09:14:30 »
You would need to have the addon that provides those gib models that are created by the script (unless A2 provides such and afaik it doesn't).

If the helo bullets can throw the guy into the air when hitting then it should work, otherwise it gets much more complex.
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline p75

  • Members
  • *
Re: Bit of Gib Script i have
« Reply #10 on: 04 Aug 2009, 11:34:12 »
Ah, ok, thanks for the reply. I'll let more experienced people play with it for now and hopefully help alter it later. Still it would be nice to see this for say the C-130 gunship and such. Personally, I would like to see some of it in a random fashion for Attack Helicopters.


Offline Noobinator

  • Members
  • *
Re: Bit of Gib Script i have
« Reply #11 on: 06 Aug 2009, 02:08:37 »
Yeah me too, i would love to have this working for helicopters, still no look with this though, and im sick of people telling me its easy lol

Yeah the concept is simple, if the unit is dead, and is moving at a high volicity, activate script. But i just can't do it :(

Btw the helicopter does throw soldiers into the air when they are shot :)


I have the gib models here

http://www.filefront.com/14168235/slx_wounds.zip


Im just gonna have to see if someone else can do this :)