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

Members Online

»
0 Active | 8 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
Next Page
subscribe
Author Topic: Moving a brush by shooting a trigger
hereticia
General Member
Since: Jun 16, 2006
Posts: 31
Last: Apr 16, 2008
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Friday, Aug. 11, 2006 05:28 am
I asked this question in a different category and realized this is probably a better place to ask. Sorry about the double-posting.

I'm trying to get a brush to move when I shoot at a trigger.

I've got these entities:
- a script_brushmodel with targetname "brush0"
- a trigger_damage with targetname "trigger_brush0"

Here are the interesting parts of my gsc file:

Code:
main() {
  thread brush_control ();
}

brush_control () {
  brush = getent ("brush0", "targetname");
  trig = getent ("trigger_brush0", "targetname");
  
  while (1) {
    trig waittill ("trigger");
    brush movey (-128, 2, 0.5, 0.5);
    brush waittill ("movedone");
  }
  return;
}


The odd symptoms I am getting are:
- I have a mounted machine gun that I shoot at the trigger for a very long time and nothing happens.
- If I throw a grenade at the trigger, immediately the brush moves, then if I shoot it with the mounted gun or even my pistol, the brush will move every time. I haven't set any of the values of my trigger except for classname and targetname.

Any ideas? Why would I have to toss a grenade first to "wake up" the trigger? Thanks.
Share |
ArmorMaster
General Member
Since: Mar 30, 2005
Posts: 371
Last: Oct 3, 2009
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Friday, Aug. 11, 2006 05:41 am
Are you sure about the values? Check all your spawnflag values and check marks. In the trigger_damage look for the "pistol_no" "rifle_no" and etc... Because if it does work when you throw a nade at it then most likely it's a spawnflag problem.
Share |
hereticia
General Member
Since: Jun 16, 2006
Posts: 31
Last: Apr 16, 2008
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Friday, Aug. 11, 2006 06:02 am
ArmorMaster writes...
Quote:
Are you sure about the values? Check all your spawnflag values and check marks. In the trigger_damage look for the "pistol_no" "rifle_no" and etc... Because if it does work when you throw a nade at it then most likely it's a spawnflag problem.


Looking at my .map file, these are the only attributes for each of my entities:

"targetname" "brush0"
"classname" "script_brushmodel"

"targetname" "trigger_brush0"
"classname" "trigger_damage"

In Radiant, nothing shows up as checked.
Share |
ArmorMaster
General Member
Since: Mar 30, 2005
Posts: 371
Last: Oct 3, 2009
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Friday, Aug. 11, 2006 06:26 am
Is the .gsc file you posted your map's .gsc file?!

If it is, you might want to throw

maps\_load::main(); in there
Share |
hereticia
General Member
Since: Jun 16, 2006
Posts: 31
Last: Apr 16, 2008
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Friday, Aug. 11, 2006 06:37 am
ArmorMaster writes...
Quote:
Is the .gsc file you posted your map's .gsc file?!

If it is, you might want to throw

maps\_load::main(); in there


Here's my gsc in its entirety:

Code:
main()
{
		
	maps\mp\_load::main();

	setExpFog(0.00015, 0.15, 0.14, 0.13, 0);
	ambientPlay("ambient_france");

	game["allies"] = "british";
	game["axis"] = "german";
	game["attackers"] = "allies";
	game["defenders"] = "axis";
	game["british_soldiertype"] = "normandy";
	game["german_soldiertype"] = "normandy";

	setcvar("r_glowbloomintensity0",".25");
	setcvar("r_glowbloomintensity1",".25");
	setcvar("r_glowskybleedintensity0",".3");

	thread brush_control ();
}

brush_control () {
  brush = getent ("brush0", "targetname");
  trig = getent ("trigger_brush0", "targetname");
  
  while (1) {
    trig waittill ("trigger");
    brush movey (-128, 2, 0.5, 0.5);
    brush waittill ("movedone");
  }
  return;
}
Share |
ArmorMaster
General Member
Since: Mar 30, 2005
Posts: 371
Last: Oct 3, 2009
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Friday, Aug. 11, 2006 02:59 pm
From looking over the script it looks fine. I'm not an experienced scripter, but it doesn't look to me like anythings wrong.

But just to make sure that the script is working fine, do a little test.

Instead of a trigger_damage make it a trigger_once or trigger_multiple or a trigger_use. Just to make sure that the script is infact working.


Another idea (before you do that) is make sure that the grenade_no option is checked, see what happens when the trigger is told to ignore grenades, then shoot it.
Share |
sentchy
General Member
Since: May 6, 2006
Posts: 212
Last: Oct 31, 2006
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Friday, Aug. 11, 2006 05:14 pm
I know of the issues with trigger_damage that you have. I think its a bug in the COD2 engine that would prevent the trigger from triggering if you never were close to it before. The grenade triggers correctly since the grenade itself is a entity that moves through the world and gets close to the trigger before causing damage.

Try one thing out, start the map, run to the trigger, circle it and shoot it with a rifle. THen go to the MG. I bet it will then correctly trigger. If so, then you are a victim of the bug.

I had that issue with a rifle range (and still do). You would go to the shooting pad, some yards away from the trigger, press F to start the scoring, HUD scoreboard comes up, and you could shoot all you want, the trigger would never trigger. If though you ran up to the trigger before, circled it and shot it, the shooting pad functionality worked like a charm.

I have a feeling there is a clipping behaviour in COD2 that does not add a trigger to a players list to check until he was close to it. But I still have to experiment around some more to proof that.

I have a couple thoughts to test, such as using a radius key on the trigger, rotating the trigger brush, etc. but still have to be tested.

edited on Aug. 11, 2006 01:16 pm by sentchy
Share |
ArmorMaster
General Member
Since: Mar 30, 2005
Posts: 371
Last: Oct 3, 2009
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Friday, Aug. 11, 2006 05:27 pm
I'd like to see a rotating or moving trigger brush, LOL. The dilema is, how to give a trigger with a classname of "trigger_multiple" or something, a new classname of "script_brushmodel" while still keeping the old classname of "trigger_multiple". Unless if entities can have two classnames, I don't think that's possible.

And if it was a bug, I wouldn't be surprised. COD2 had good gameplay, but several areas of the game made me feel like the makers were rushing to finish...
Share |
Skyguy
General Member
Since: Feb 8, 2006
Posts: 144
Last: Apr 25, 2009
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Friday, Aug. 11, 2006 05:27 pm
Same problem here......got some targets to shoot at (like a target range idea)......most work....but some don't until you walk near them. Then they work. My colleague even spoke with an [IW] coder about this and even he couldn't figure it out....said our code was absolutely fine.

Obviously a glitch.....too bad it's one that alot of people are being affected by[banghead]
Share |
sentchy
General Member
Since: May 6, 2006
Posts: 212
Last: Oct 31, 2006
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Friday, Aug. 11, 2006 08:07 pm
Skyguy, did you say some work and some do not, all of them being trigger_damage?

If there are really some that work from the distance than we can analyze the difference between the ones that work and those that do not.

I have a feeling it might be orientation of the triggers. I'll try creating a few and see if they can only be shot from a certain direction and not another while circling them from a distance.
Share |
Restricted Access Topic is Locked
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

»