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

Members Online

»
0 Active | 16 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
sentchy
General Member
Since: May 6, 2006
Posts: 212
Last: Oct 31, 2006
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Wednesday, Jul. 5, 2006 11:20 pm
Ok, I tried everything. I can spawn trigger_radius, script_models, weapons, etc perfectly but not the trigger_damage.

The trigger_damage never reacts since you cannot specify what extend the trigger_damage should have.

The second parameter is optional on the notify, I think you can have as many as you want.

edited on Jul. 5, 2006 07:22 pm by sentchy

edited on Jul. 5, 2006 07:23 pm by sentchy
Share |
FlesyM
General Member
Since: Jul 24, 2005
Posts: 399
Last: Jan 24, 2008
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Wednesday, Jul. 5, 2006 11:37 pm
yeah I've experienced the same with the trigger_damage spawning.

errr... what's a trigger_radius ? and could it, or other stuff, be used instead as a trigger_damage ?
Share |
sentchy
General Member
Since: May 6, 2006
Posts: 212
Last: Oct 31, 2006
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Wednesday, Jul. 5, 2006 11:41 pm
Ohh, almost got the trigger_damage working . Just finishing some experiments.

trigger_radius is a trigger that gets triggers when someone enters it height/radius.
Share |
FlesyM
General Member
Since: Jul 24, 2005
Posts: 399
Last: Jan 24, 2008
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Wednesday, Jul. 5, 2006 11:42 pm
cool keep me posted ! [casanova]

I would be baffled if you ever find a way to give some dimension to it [rocking]
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 12:03 am
Code:
  precacheModel("xmodel/prop_firebarrel");
  part = spawn("trigger_damage", (0, 0, 50), 32);
  part setmodel("xmodel/prop_firebarrel");

  println("spawned trigger origin:", part.origin);  

  part waittill("trigger");
  println("^1 spawned trigger got hit!!!");


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.

edited on Jul. 5, 2006 08:07 pm by sentchy
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 01:03 am
that would be elegant, but really I think i'll go for the trig.target approach you proposed earlier as this is working real well.

I'm now testing with all possibilties (lots of barrels close together, barrels exploding at the same time, etc, etc) then I'll test on my real map (was only working on a test map up to now) I'll add the sound lines as well as adjusting the .csv. and then I'm done !

I really want to share to code with you guys .... but I was wondering.... should I release that code only at map release ?

thx a lot to all that provided help here, it's really appreciated. you'll see these barrels will kick some arse.

edit : hooo I almost forgot: is there an easy way to make script_models clippable without the use of a clip brush ?

edited on Jul. 5, 2006 09:06 pm by FlesyM
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:06 am
Nope to your last question.

The only shortcut you can take is take a look at the collmaps folder and see if there is matching collision map in their for the model you want to work with and use that as a prefab starting point.

Personally if you use certain models frequently, I would create a prefab with the model and clipping.
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 02:27 am
but then I would prolly have to make the clip a script_brushmodel so it can be removed after the barrel blows up (player won't get clipped after explosion). unless I can associate it with the script_model somehow ...

also, since every barrel I put in there have a different targetname, it's kind of useless to make a prefab for this case doesn't it ?
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 02:46 am
so yeah I made a script_brushmodel with a clip, target = barrel#, associate it with the proper barrel in script like we did for the triggers. at the end, at the barrel explosion, I delete the trigger, the brushmodel, then the script_model.

and the effect is pretty sweet, all thx to the folks at modsonline.com ![cool]

now I'm hoping it's error free [tongue] the next few days will tell that.

I'll figure out how to respawn barrels later on ...

edited on Jul. 5, 2006 10:47 pm by FlesyM
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:51 am
Congratz!

Spawning barrels is easy. First you need to precache the barrel models or the later setmodel will result in a script error. You have to precache before any wait statements occur, so typically the first thing you do even before calling the stock load function:

Code:
precacheModel("xmodel/prop_firebarrel");


Then, when you want to spawn one, all you need is an origin:

Code:
part = spawn("script_model", origin);
part setmodel("xmodel/prop_firebarrel");


An example of IW code from sd.gsc is:

Code:
level.bombmodel = spawn("script_model", plant.origin);
level.bombmodel.angles = plant.angles;
level.bombmodel setmodel("xmodel/mp_tntbomb");
level.bombmodel playSound("Explo_plant_no_tick");


The issue though remains is the clip brush_model.

A better idea than deleting the triggers and scrip_models is to move them out of the way rather than deleting them.

The trigger on and off in maps/mp/_utility.gsc is a good example of that pattern. The property realOrigin is used to store the original location of the script_model so with triggerOn it can be repositioned back where it belongs.

Code:
triggerOff()
{
	if (!isdefined (self.realOrigin))
		self.realOrigin = self.origin;

	if (self.origin == self.realorigin)
		self.origin += (0, 0, -10000);
}

triggerOn()
{
	if (isDefined (self.realOrigin) )
		self.origin = self.realOrigin;
}


To use that approach you would have to write your own exploder code though, most parts you find are in the _utility.gsc starting at the exploder function. The second part you have to mod or rewrite is the _load.gsc part.

It is actually fun to read through the code to learn how the exploders are done.

To mod the exploder code I would copy the _load.gsc and the _utility.gsc code to your personal versions. Then adjust the way exploders are handled in myutiltiy.gsc to not delete the barrels but rather use the TriggerOff method of moving them out of the way.
edited on Jul. 6, 2006 07:53 am by sentchy

edited on Jul. 6, 2006 07:58 am by sentchy
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

»