Advertisement

Author Topic: Flipping a hummer (ACCEPTED)  (Read 5351 times)

0 Members and 1 Guest are viewing this topic.

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Flipping a hummer (ACCEPTED)
« on: 21 Jul 2008, 19:11:36 »
Hi guys,

I'd always see on the news about another ied attack and would see pictures of hummers, upside-down and burning.

So here is a script that replicates that, comeplete with readme and demo mission.

Thanx...as always.

Luke


OFPEC DOWNLOAD
« Last Edit: 10 Aug 2009, 18:41:59 by hoz »
Pesky Human!!
Wort Wort Wort.

Offline tateyou

  • Members
  • *
Re: Flipping a hummer
« Reply #1 on: 21 Jul 2008, 20:04:28 »
Got it,thanks!

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Re: Flipping a hummer
« Reply #2 on: 21 Jul 2008, 20:09:47 »
Glad to help!!

Luke
Pesky Human!!
Wort Wort Wort.

Offline tateyou

  • Members
  • *
Re: Flipping a hummer
« Reply #3 on: 21 Jul 2008, 20:28:42 »
I was working on a big explosion and wants a lot of beautiful effect just like this :),and is it possible to make a global effect of this kind of thing?
« Last Edit: 21 Jul 2008, 20:30:15 by tateyou »

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Re: Flipping a hummer
« Reply #4 on: 22 Jul 2008, 00:09:41 »
Um... Look over there, a five-legged white rhino!!
(runs away)  :D

Sorry, never knew how to do the whole local/global thing,

I'll have to call some admin power here.

Please hold,

Luke
Pesky Human!!
Wort Wort Wort.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Flipping a hummer
« Reply #5 on: 22 Jul 2008, 01:01:52 »
Depends how you make the explosion happen. The easiest way would be to create a global object that then exploded which would affect everyone on the server. If you want to use particle-effects to create your own explosion effect, then that is a lot more complex and, since particles are local to the client and so you'd need to tell all the other clients to make an explosion there then they'd have to make it (addPublicVariableEventHandler would be useful for that and/or reading our OFPEC guide to MP scripting).

Searching the forum for "explosion" will get you a lot of info on creating things which will blow up for you without needing to worry about MP scripting.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline tateyou

  • Members
  • *
Re: Flipping a hummer
« Reply #6 on: 22 Jul 2008, 16:12:30 »
Got it,thanks!
Waiting for more awesome scripts :D
« Last Edit: 22 Jul 2008, 16:14:11 by tateyou »

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Flipping a hummer (TESTING)
« Reply #7 on: 28 Jul 2008, 19:26:56 »
A few suggestions for this after I tested it:
  • Please put demos for scripts on the Rahmadi map , unless they really need the size of Sahrani (or even South Sahrani) to work. This saves everyone a few minutes waiting for the map to load just to look at the demo. This is especially an issue for this demo, since you actually put it on the Rahmadi island on the Sahrani map!
  • The example IED triggers in the demo are specific to the vehicles that will explode on them. Fine, perhaps, for movie-makers, but not so much for mission-makers who would probably want a more generic solution. I would suggest reducing the trigger area a fair bit, not grouping the trigger with a specific vehicle, and using:
    Activation: ANY PRESENT ONCE
    Condition: ({ _x isKindOf "LandVehicle" } count thisList) > 0;
    (Wait until there is a vehicle, not a man or aircraft, in the trigger zone).
    OnAct:  { if (_x isKindOf "LandVehicle") exitWith { [_x] exec "flipied.sqs"; }; } forEach thisList;
    (Flip the first appropriate vehicle currently in the trigger zone).
  • I tested it with 5-ton trucks and other cars and the effect looked fine to me, so I think selling the script as "flipping a humvee" is selling it a bit short. Perhaps you could check in the script if the vehicle isKindOf "Car" (car or truck, so flip as you do now) or isKindOf "Tank" (just bounce it up a bit, but don't flip) or isKindOf "Motorcycle" (remove riders and flip the bike and crew separately). You could also alter the flip speed of the vehicle based on its sizeOf, so a truck spins a bit less than a skoda.
  • A screenshot or two showing the effect in action would be nice.
  • If you really want to be clever, explode the ied at the centre of the trigger zone and flip the vehicle in a direction based on its position and speed relative to the explosion.
As for the script, I think it is a pretty good idea. A few tweaks and we can add it as a resource.

EDIT: You might also consider using this instead of creating an AT missile:
Code: [Select]
_bang = "bomb" createVehicle (getPos _pos);
_bang setDamage 1;
Since that creates an explosion more predictably, rather than hoping the missile goes off at exactly the right time & location.
« Last Edit: 28 Jul 2008, 19:46:41 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Re: Flipping a hummer (TESTING)
« Reply #8 on: 30 Jul 2008, 02:18:26 »
@ Spooner,

  • Fixed
  • Only done this way for demonstration, you have to figure out the uses!!  :P
  • Fixed, though sizeof doesn't work to reliably
  • Done
  • Working on it! :good:
the "EDIT":unless its an air vehicle, don't think we need to worry. :P (plus the bomb is a little "too" destructive)

Luke

EDIT: put the new one in the first post.

@ Spooner,
does the "sizeof" command measure the length or the width of the vehicle in question?
Is there a way to measure the other dimention?
And is there a way to get/does a "mass" value/command?
what command would I use to get the center of a trigger?

Answeres to these questions would be neccessary for the work of the last point you requested.
« Last Edit: 20 Aug 2009, 04:15:11 by hoz »
Pesky Human!!
Wort Wort Wort.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Flipping a hummer (TESTING)
« Reply #9 on: 30 Jul 2008, 17:55:06 »
I haven't actually ever used sizeof, so I can't say what it actually measures or how accurate it is. If you want something more likely to be accurate and giving all 3 dimensions, look at boundingBox. Pretty sure there isn't any kind of mass command, so you're best off measuring the boundingBox dimensions and using isKindOf to get a best guess of what has hit the trigger. You might also like to cause the secondary explosion on the underneath of the vehicle (use boundingBox and modelToWorld for that), rather than at the normal getPos position, which is at the lowest point of the vehicle. This way, it will look like the fuel/engine, rather than the roof-rack, that is exploding after the vehicle has flipped :whistle:

Sadly, I don't think you can find out the location of a editor trigger from within it without var-naming it and referring to that variable.
Name: myTrigger
Activation: ANY PRESENT ONCE
Condition: ({ _x isKindOf "LandVehicle" } count thisList) > 0;
OnAct:  { if (_x isKindOf "LandVehicle") exitWith { [_x, getPos myTrigger] exec "flipied.sqs"; }; } forEach thisList;

Regarding how the triggers are implemented, I do think it would be best to include the most generally useful version of the trigger (an IED that can be triggered by absolutely any vehicle; useful in movies or missions), rather than a very specific version (an IED that can only be triggered by a specific vehicle; fine for movies, but useless in a real mission). Remember that most mission-makers are not experts and just want something that is plug-and-play when they get something from OFPEC. Try to please most of the people, most of the time ;P

[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Re: Flipping a hummer (TESTING)
« Reply #10 on: 31 Jul 2008, 00:54:44 »
@Spooner,
Never understood model to world (i.e. please explain!!  :P)

Bounding box is exactly what I needed!!!  :good:  :clap:

Rather than use a trigger under the unit, I am trying to use a [bomb,target] array, get the various distances, angles, etc.
and have been working round the clock with torque, accelleration, force, and all that stuff to a point of migrane,
plus I can't focus (ADD for those who know ;) ) and have reading for school, so might be a while on that last point (maybe .5 - 3 wks). :sorry:

Let me know what you (personnaly) think of the script, as is and will update once I finish this. 

Do get back on me about model to world!!

Luke

Pesky Human!!
Wort Wort Wort.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Flipping a hummer (TESTING)
« Reply #11 on: 31 Jul 2008, 01:32:59 »
You don't have to implement all my suggestions. I'm just trying to help you improve things to make them more useful to the community or to give you ideas that you might not have thought of. "and have been working round the clock with torque, accelleration, force, and all that stuff to a point of migrane,": Again, you don't have to go as far as I've requested if this doesn't seem like a good idea to you ;P

modelToWorld takes coordinates that are in the model space (so [2, 0, 0] in model space is 2m to the right of the centre of the vehicle) and converts them into world coordinates (the coordinates you get from getPos and use in setPos). So, to find out where the point which is 2m to the right of the centre of the vehicle is in the world right now:
Code: [Select]
_pos = _vehicle modelToWorld [2, 0, 0];

What I think you want would be something like:
Code: [Select]
_box = bounddingBox _vehicle;
_minZ = (_box select 0) select 1;
_underneathVehicle = _vehicle modelToWorld [0, minZ, 0];

Remember, though, that this is probably going to be a position a bit below the chassis, so you might need to do stuff to encourage the missile to blow up, like giving it a high velocity towards the vehicle. Play about with this a bit and see if it is any better than just having the secondary explosion on the ground under the vehicle.

Remember that model coordinates are in [x, z, y], not the more normal [x, y, z], format. No idea why, but always catches me out!
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Re: Flipping a hummer (TESTING)
« Reply #12 on: 31 Jul 2008, 02:28:05 »
You don't have to implement all my suggestions. I'm just trying to help you improve things to make them more useful to the community or to give you ideas that you might not have thought of. "and have been working round the clock with torque, accelleration, force, and all that stuff to a point of migrane,": Again, you don't have to go as far as I've requested if this doesn't seem like a good idea to you ;P
Despite the brain-pain, I thoroughly enjoy it!!  :D

Thank you for modelToWorld, boundingbox, and all your responses!!

I will fill you guys in as often as possible!!

Thanx for all, to the community!!!

Luke

EDIT: Guys,

Dunno if that local/global thing was solved, so...

would creating a ammotype vehicle with an underscore (_) i.e.

Code: [Select]
_bomb= "rpg7vr" createvehicle getpos _thepos
would that be created locally or globally?

If the latter, how do you use createvehicle to make a global vehicle? or is it the ammo type?
« Last Edit: 31 Jul 2008, 04:23:44 by Luke »
Pesky Human!!
Wort Wort Wort.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Flipping a hummer (TESTING)
« Reply #13 on: 31 Jul 2008, 11:53:53 »
The variable you use (local or global) doesn't affect the locality of any object put into it. In fact, local and global variables are completely different to local and global objects (see our MP tutorial for more details). To create global objects, you use createVehicle, to create local ones, you use createVehicleLocal.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Re: Flipping a hummer (TESTING)
« Reply #14 on: 02 Aug 2008, 06:50:12 »
@Spooner,

IF (and only IF  :D) you think and the other ED staff it's ready, tack it on the resources, and I will let you when the more physics-intensive one is done and ready.

Luke
Pesky Human!!
Wort Wort Wort.