| Author |
Topic: a little question for the pros |
| WHC_Grassy |
General Member Since: Apr 20, 2005 Posts: 1426 Last: Aug 25, 2007 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Thursday, Jul. 6, 2006 01:19 pm |
 |
Nice thread, good info for others to learn from.
My simple method used in UO for barrels,
for a detector use a trigger damage as you were,
then for the damage to players when a barrel explodes use radiusdamage command.
If you are spawning in the entities rather than making them in the map, you can create a clip of sorts by spawning a script origin at the barrels origin like so....
*note* the size below is just a guess, the size is from the origin xx.xx, yy.yy, zz.zz so (10,10,20) would end up 20 units wide, 20 units deep and 40 units high.
clip1 = BarrelClip(barrel1.origin, (10,10,20));
BarrelClip(origin,size)
{
ent = spawn("script_origin", origin);
ent setbounds( ((0,0,0)-size), size );
ent setcontents(1);
}
Then delete the clip when the barrels blow.
clip1 delete();
Hope this helps you any :)
Grassy |
 |
|
|
| WHC_Grassy |
General Member Since: Apr 20, 2005 Posts: 1426 Last: Aug 25, 2007 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Thursday, Jul. 6, 2006 01:36 pm |
 |
Just re read the thread,
Quote: The above code spawns a trigger_damage, but it only can be triggered by throwing a nade to the most negative x,y corner. No bullets trigger it though.
This means the trigger gets spawned as an entity, just giving it shape is still to solve =p
Without setmodel it does not work.
You can use setbounds( ((0,0,0)-size), size ); to define the trigger size.
And you need to set the triggers spawnflags, easiest way is to make a trigger damage in the editor and set the damage types. this will then generate what spawnflag you need for for the script.
Grassy |
 |
|
|
| sentchy |
General Member Since: May 6, 2006 Posts: 212 Last: Oct 31, 2006 [view latest posts] |
|
|
|
|
| FlesyM |
General Member Since: Jul 24, 2005 Posts: 399 Last: Jan 24, 2008 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Thursday, Jul. 6, 2006 07:34 pm |
 |
aight, I've debugged my code, avoided all deadlocks (as its tread based) .... well I sure hope so. havent got errors since a while now.
here's a little demo for ur viewing pleasure, with the debug lines so you can see how it works.
cod2 exploding barrel by FlesyM demo
note the spark sound you here in the background isn't part of the barrel effect ... it's another close one that isn't in the view.
also note all barrels are independent and only react to damage and other barrels around them. I've also put some randomness in it all. that means it'll blow up differently every time and that the general effect is dictacted by how the mapper places barrels in the map. physic scripting baby !
and don't worry folks, I'll release the code eventually.... along with the map that you see in the demo. (btw that was the first official sneek peak of it). the code is not perfect yet tho... well I mean I have to try implementing the great ideas you've just put foward grassy.
speaking of which... i'm not really about that clip spawning ... if I undertand correctly this would spawn an entity that has a certain size... but it wouldn't be a clip per say right ? and the player cannot go through that entity ?? (so like you said ...acting like a clip of some sort ?) also, is the function to set flags on a trigger setflag or setspawflag ? or rather the flags goes into the third argument to the spawn function ?
edited on Jul. 6, 2006 03:38 pm by FlesyM |
 |
|
|
| FlesyM |
General Member Since: Jul 24, 2005 Posts: 399 Last: Jan 24, 2008 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Thursday, Jul. 6, 2006 08:10 pm |
 |
******* script compile error *******
unknown function: (file 'maps/mp/barrels.gsc', line 40)
ent setbounds( ((0,0,0)-size), size );
*
************************************
![[ohwell]](images/BBCode/smilies/ohwell.gif) |
 |
|
|
| sentchy |
General Member Since: May 6, 2006 Posts: 212 Last: Oct 31, 2006 [view latest posts] |
|
|
|
|
| FlesyM |
General Member Since: Jul 24, 2005 Posts: 399 Last: Jan 24, 2008 [view latest posts] |
|
|
|
|
| FlesyM |
General Member Since: Jul 24, 2005 Posts: 399 Last: Jan 24, 2008 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Thursday, Jul. 6, 2006 10:55 pm |
 |
wow you were right, the spawning was real easy.
I just copied these triggeron/off functions from the _ulility.gsc file, and renamed them :
Code: entityOff()
{
if (!isdefined (self.realOrigin))
self.realOrigin = self.origin;
if (self.origin == self.realorigin)
self.origin += (0, 0, -10000);
}
entityOn()
{
if (isDefined (self.realOrigin) )
self.origin = self.realOrigin;
}
as this work for any entity, I call it on the script_model, trigger, and script_brushmodel whenever I want to remove them or put them back in. I needed nothing else. I'm amaze how simple this is. btw couldn't you have use that for the gameplay specific script you've made not long ago ? |
 |
|
|
| sentchy |
General Member Since: May 6, 2006 Posts: 212 Last: Oct 31, 2006 [view latest posts] |
|
|
|
|
| sentchy |
General Member Since: May 6, 2006 Posts: 212 Last: Oct 31, 2006 [view latest posts] |
|
|
|
|
|
|
mp_TempleCall of Duty: Mods: Multiplayer (624.12Kb)
|