Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 9 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Previous Page Next Page
subscribe
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]
Level 8
Category: CoD2 Scripting
Posted: Thursday, Jul. 6, 2006 01:19 pm
Nice thread, good info for others to learn from. [thumbs_up]

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
Share |
WHC_Grassy
General Member
Since: Apr 20, 2005
Posts: 1426
Last: Aug 25, 2007
[view latest posts]
Level 8
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
Share |
sentchy
General Member
Since: May 6, 2006
Posts: 212
Last: Oct 31, 2006
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Thursday, Jul. 6, 2006 02:28 pm
If the setbounds works, that would be marvelous. Opens a lot up for fun coding.

Cannot wait to go home. That way I can autocreate the triggers I used for lamps/lights to make them destroyable.
Share |
FlesyM
General Member
Since: Jul 24, 2005
Posts: 399
Last: Jan 24, 2008
[view latest posts]
Level 5
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
Share |
FlesyM
General Member
Since: Jul 24, 2005
Posts: 399
Last: Jan 24, 2008
[view latest posts]
Level 5
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]
Share |
sentchy
General Member
Since: May 6, 2006
Posts: 212
Last: Oct 31, 2006
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Thursday, Jul. 6, 2006 08:45 pm
I read on IWNation that COD2 does not have setbounds, seems we have to be without spawnable triggers or just create a couple in codradiant, hide them somewhere and move them in place when needed.
Share |
FlesyM
General Member
Since: Jul 24, 2005
Posts: 399
Last: Jan 24, 2008
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Thursday, Jul. 6, 2006 08:52 pm
yup sounds like it.

you've watched the demo ?
Share |
FlesyM
General Member
Since: Jul 24, 2005
Posts: 399
Last: Jan 24, 2008
[view latest posts]
Level 5
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 ?
Share |
sentchy
General Member
Since: May 6, 2006
Posts: 212
Last: Oct 31, 2006
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Thursday, Jul. 6, 2006 11:30 pm
Yes, would have been an alternative for the gametype script. The delete would be a little cleaner since you free up an entity.

The delete could be better since there seems to be a limit on entities you can create. I have seen server error message of max number of entities created before, especially on servers running rain.
Share |
sentchy
General Member
Since: May 6, 2006
Posts: 212
Last: Oct 31, 2006
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Thursday, Jul. 6, 2006 11:32 pm
dumb question, how do I run the demo?
Share |
Restricted Access Topic is Locked
Page
Previous Page Next Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»