Home   Help Search Login Register  

Author Topic: Flipping a hummer (ACCEPTED)  (Read 7251 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.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Flipping a hummer (TESTING)
« Reply #15 on: 03 Aug 2008, 11:41:34 »
Nice to see you've implemented several of my suggestions. Bike effect looks OK and the flips look better. Coming along well, but it isn't quite ready, in my opinion.

1) When you setVectorUp, you assume that the vehicle is travelling North to South. If travelling South to North, they spin the opposite way (not a big issue), but when East/West or another angle, they always flip end over end. You need to take into account the current direction of the vehicle, since setVectorUp is in world-space, not model-space!

2) In the flip left code, you goto "loop" rather than goto "left". This means vehicles will always spin in the same direction.

3) You don't take into account the initial ground angle the vehicle is driving over. If the IED is on a slope, then the vehicle will right itself to being perfectly horizontal, before starting to flip (_deg is initially 10, regardless of initial vectorUp). This isn't critical, since IEDs would probably be on flat ground, but would be nice.

4) The most important thing, for me, is that you are still using vehicle-specific triggers which are fine for cut-scenes, but useless for any mission. I realise you didn't intend this to be used within a mission, but it is such a simple change to make this more generally useful.

5) You set _dfact to 1 for all vehicles, after setting it to 3.4 specifically for a truck. Not sure whether that was intended, since the higher value didn't improve the effect. You might also consider flipping the truck onto its side, rather than right over onto its roof, since it is much heavier. Not sure whether that would look better though; maybe try it out?

6) The demo observer is a bit close to the explosions and it is hard to watch what is happening when you are getting shrapnel in the face ;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 #16 on: 03 Aug 2008, 21:01:18 »
Spooner,

1) I agree doesn't matter, they still flip.  :)

2) Need to fix that!

3) Thanx for your keen eye, working.  :good:

4) I told you, I'm working on the physics!  :dry:

5) Thanx for noticing, it was supposed to only flip the truck on its side, but must have gotten out of order, (need to set it before).

6) LOL, K maybe, reduce the strength with a different type of shell.

Working, edit with fixes sometime in the next 8 hours (hopefully!!)

Luke

OK... Its been 10 Hours.

I however, do have the file... :yes:
it's just not at this computer  :no:

Get it to you guys tomorrow

Here it is
« Last Edit: 20 Aug 2009, 04:15:27 by hoz »
Pesky Human!!
Wort Wort Wort.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Flipping a hummer (TESTING)
« Reply #17 on: 03 Aug 2008, 23:07:48 »
4) I meant using a general trigger, not managing the absolute position of the IED in respect to the vehicle and all the complexities thereof ;P The full physics thing is not something that is necessary for this to be a useful resource.

6) Or just move the observer 5m further away ;P

Good luck with this!
[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 (DELAYED)
« Reply #18 on: 22 Aug 2008, 21:41:18 »
Okay,

Here it is,
all done!

Version 1.3 of the hummer_flip

Luke

Edit: Oh, yeah, This IS NOT the physics-intensive version.
I am not gonna even attempt all the physics until school starts. (Then I can ask my teacher to help me!  :D  :P).

« Last Edit: 20 Aug 2009, 04:15:35 by hoz »
Pesky Human!!
Wort Wort Wort.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Flipping a hummer (Ready, once again)
« Reply #19 on: 22 Aug 2008, 23:05:58 »
I get an error every time I start a vehicle moving:
Code: [Select]
?! _hmv iskindof "LandVehicle": exit
which should be:
Code: [Select]
?! (_hmv iskindof "LandVehicle"): exit

Overall, fine, but still struggling with the fact that the triggers are all vehicle-specific and not at all helpful to mission-makers that might want to use your script.
[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 (Ready, once again)
« Reply #20 on: 22 Aug 2008, 23:19:31 »
Overall, fine, but still struggling with the fact that the triggers are all vehicle-specific and not at all helpful to mission-makers that might want to use your script.

I understand, this is simply for example purposes.

Tell you what, Here: I added a second script with a percentage of how much of the time the bomb goes off.

Luke
« Last Edit: 20 Aug 2009, 04:15:43 by hoz »
Pesky Human!!
Wort Wort Wort.