Script Question: key bind to trigger Exploding Barrels
by Frank Dellario · in Torque Game Engine · 03/30/2006 (1:40 pm) · 4 replies
Hey guys, a scripting question. I'm working on making your standard exploding barrel...explode but not the way you normally do in a game (by shooting it). We produce machinima animation (the TrashTalk show www.illclan.com) and I need to make things happen on command generally with a key command by server. Currently to make something explode, we just put someone in a tank off camera and fire at it (hey it's machinima filmmaking, it's all about the quick work around). Would like to take that explosion and attach it to any object and trigger it with a bound key, in this case a nice red barrel that says "Flamable" on it.
Working on a segment where I need to make various barrels and maybe other objects explode. They're static shapes with no mount point (and dont have time to give them one nor do I think I need to, mount goes to centroid). Digging through Maurina's new torque book, and it looks like I can create a script for the barrels that will have all the info, but how do I set up how they're triggered?
I've never created a script on my own, just adjusted the existing parameters in scripts, so I'm starting to feel like I'm over my head. I will also have a lot of barrels so the other problem will be how to have multible barrels explode at different times.
illbixby
Working on a segment where I need to make various barrels and maybe other objects explode. They're static shapes with no mount point (and dont have time to give them one nor do I think I need to, mount goes to centroid). Digging through Maurina's new torque book, and it looks like I can create a script for the barrels that will have all the info, but how do I set up how they're triggered?
I've never created a script on my own, just adjusted the existing parameters in scripts, so I'm starting to feel like I'm over my head. I will also have a lot of barrels so the other problem will be how to have multible barrels explode at different times.
illbixby
#2
Are you sure your barrel shouldn't say "Flammable?" Just asking, because if you're making machinima, then chances are you're making it for other people to view, and you don't want a blatant typo in your final product. :)
04/01/2006 (11:30 am)
Quote:in this case a nice red barrel that says "Flamable" on it
Are you sure your barrel shouldn't say "Flammable?" Just asking, because if you're making machinima, then chances are you're making it for other people to view, and you don't want a blatant typo in your final product. :)
#3
04/01/2006 (1:35 pm)
I think they should have "Exploding Barrel" labelled on them >.>
#4
uh...oh, it's comedy, yeah that's it. doh, you are correct on the spelling sir. Actually, I could see an episode of trashtalk dedicated to the minutia of the exploding barrel: how they should named? painted? all red or with a white strip? etc etc. Why maybe we could visit an exploding barrel factory, much like when they visit factories on the food network or this old house.
Manager: "And this is the 'white room' where we do the quality assurance testing."
Interviewer: "Why is it called the white room, all the walls are red?"
A man in a white smock caustiously taps a barrel with a crowbar
!!BOOOOOM!!
Manager: "Well, it used to be white."
Interviewer: "ohh,I see."
04/02/2006 (1:10 pm)
Thanks paul, gonna try it now. Re: the sim group, is your code referring to adding them to a sim group via the .mis file? I know how to add objects to a sim group in the mission editor and assuming I could add them that way (and avoid breaking the mission file, code scares me, "don't break code, nice code, there you go code, you can do it, syntax error!? you son of a *$@!"), only thing is, I can't find or figure out how to create a new sim group, sounds like hard coding it into the .mis file as you mention is the only way.Quote:Are you sure your barrel shouldn't say "Flammable?" Just asking, because if you're making machinima, then chances are you're making it for other people to view, and you don't want a blatant typo in your final product. :)
uh...oh, it's comedy, yeah that's it. doh, you are correct on the spelling sir. Actually, I could see an episode of trashtalk dedicated to the minutia of the exploding barrel: how they should named? painted? all red or with a white strip? etc etc. Why maybe we could visit an exploding barrel factory, much like when they visit factories on the food network or this old house.
Manager: "And this is the 'white room' where we do the quality assurance testing."
Interviewer: "Why is it called the white room, all the walls are red?"
A man in a white smock caustiously taps a barrel with a crowbar
!!BOOOOOM!!
Manager: "Well, it used to be white."
Interviewer: "ohh,I see."
Torque Owner Paul /*Wedge*/ DElia
new SimGroup(BarrelGroup){ new StaticSha... blah (barrel creation code) }Around the set of your barrel objects. Then in a (server) script file put
serverCmdExplodeBarrel(){ %barrel = BarrelGroup.getObject(0); if(isObject(%barrel)){ %barrel.damage(1000000); BarrelGroup.remove(%barrel); } }Then in your client's default.bind.cs and config.cs add
moveMap.bindCmd(keyboard, "b", "commandToServer('ExplodeBarrel');", "");And this should make the barrel's explode in the order they are listed in the .mis file, one each time you press "b". But this is just thrown together off the top of my head, so don't hold me to it.