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 4
Category: CoD4 Scripting
Scripting and coding with Call of Duty 4.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: Help With Triggers
DeekCiti
General Member
Since: Mar 13, 2008
Posts: 1293
Last: Jul 9, 2016
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Sunday, Mar. 30, 2008 07:15 am
I haven't found much, if anything on how to use a trigger properly. What I want to do is try and find a shortcut to call my ambient rain mp3. So what I did was right click the 2d window and create a Trigger Multiple. I filled my entire map with the Trigger Brush, so how would I go about calling my file "amb_rain.mp3" from my Soundalias? What would be the targetname? The alias, or the mp3? The alias is "rain". And are there other things I need to add scripting wise... ?
Share |
DeekCiti
General Member
Since: Mar 13, 2008
Posts: 1293
Last: Jul 9, 2016
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Monday, Mar. 31, 2008 04:23 am
Would someone be kind enough to give me some simple steps on how to set up a trigger in Radiant, and how to call that trigger from script... I want to trigger sounds. It can be Any example, I just need an outline to start with... please.
Share |
UB_Dragon
General Member
Since: May 18, 2006
Posts: 155
Last: Mar 14, 2009
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Monday, Mar. 31, 2008 12:15 pm
DeekCiti writes...
Quote:
Would someone be kind enough to give me some simple steps on how to set up a trigger in Radiant, and how to call that trigger from script... I want to trigger sounds. It can be Any example, I just need an outline to start with... please.


Here ya go, this worked for me,

i made a dog house and wanted a dog to bark when you get close to it, also i use an owl "hoot" near certain trees.


http://www.modsonline.com/Forums-top-75265.html

good luck
Share |
DeekCiti
General Member
Since: Mar 13, 2008
Posts: 1293
Last: Jul 9, 2016
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Wednesday, Apr. 2, 2008 11:49 am
Could someone please explain in a simple, detailed, way of setting up a trigger, in particular a sound trigger in radiant... "This includes the brush used, does an origin brush HAVE to be placed inside, stuff like that". Every post I read is completely vague and very frustrating. I just can't seem to make it work even in my test map. Any help would be appreciated.

edited on Apr. 2, 2008 07:52 am by DeekCiti
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Wednesday, Apr. 2, 2008 02:11 pm
i don't think that trigger_multiple is a good idea for the ambient sound. anyway, this might help you:

http://www.modsonline.com/Forums-top-77288-0.html%23619394

what i did in radiant:
made a new brush, right-click trigger -> multiple. Entity editor, targetname ammo_trig. (you may add a wait value too.)
Share |
DeekCiti
General Member
Since: Mar 13, 2008
Posts: 1293
Last: Jul 9, 2016
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Wednesday, Apr. 2, 2008 03:38 pm
Thanks for the reply Sevenz...

What I'm trying to do with it though should work. You remember my post about the indoor/outdoor ambience? Well, I'm still working on it. I got it to work with using (x,y,z) coordinates but the problem with that is (x,y,z) coordinates are little bubbles, depending on how big you make the radius for that sound in your sound alias. In this case my radius was 400 for my null. Here is my Sound alias I'm using for this.
Code:

rain,,amb_elements/amb_rain.mp3,0.5,,ambience,,,,,ambient,streamed,,rlooping,0.00001,all_mp,,,building_null,,,amb_front,,

building_null,,amb_elements/amb_rain.mp3,0,0,element,,,7,400,auto,streamed,,rlooping,master,all_mp,,,,,,amb_front,,0.8


Then I would have these lines in my _fx.gsc
Code:

//Rain
maps\mp\_fx::loopSound("rain", (32.0, 1760.0, 240.0), 0);

//Null
maps\mp\_fx::loopSound("building_null", (-210.0, -72.0, 140.0), 0);
maps\mp\_fx::loopSound("building_null", (130.0, -72.0, 160.0), 0);
maps\mp\_fx::loopSound("building_null", (410.0, -72.0, 160.0), 0);
maps\mp\_fx::loopSound("building_null", (944.0, 88.0, -424.0), 0);


So you see, working with a radius bubble on a square building won't really work because some of the bubble will land outside the house and the rest inside. So if I was standing on the edge of the house "outside" I would hear the null of no rain, which isn't what I want. So it worked, but not 100%.

So what I'm thinking is this... If I use the same Idea but call these Sound alias's by using triggers, or simply the Null by using a trigger then at least I can shape that null to the exact shape of my house with no Bubble runoff. So if I use these Alias's:
Code:

rain,,amb_elements/amb_rain.mp3,0.5,,ambience,,,,,ambient,streamed,,rlooping,0.00001,all_mp,,,building_null,,,amb_front,,

building_null,,amb_elements/amb_rain.mp3,0,0,element,,,7,400,auto,streamed,,rlooping,master,all_mp,,,,,,amb_front,,0.8


With this Script that "Killer" gave me

Code:

thread rainsound();
}

rainsound()
{
	noraintriggers = getentarray("no_rain_sound", "targetname");

	if(noraintriggers.size <= 0)
		return;

	while(1)
	{
		players = getentarray("player", "classname");
		for(i=0;i<players.size;i++)
		{
			if(!isDefined(players[i].outside))
				players[i] thread player_no_rain_sound();
			for(r=0;r<noraintriggers.size;r++)
			{
				if(!isDefined(players[i].outside) && players[i] isTouching(noraintriggers[r]))
					players[i].outside = false;
				else if(!isDefined(players[i].outside) && !players[i] isTouching(noraintriggers[r]))
					players[i].outside = true;

				if(!players[i] isTouching(noraintriggers[r]))
					players[i].outside = true;
				else
					players[i].outside = false;
			}
		}
		wait 0.1;
	}
}

player_no_rain_sound()
{
	wait 0.05;
	while(1)
	{
		if(!self.outside)
			self playLocalSound("building_null");

		wait 5; // change to about how long the sound lasts for 
	}
}


It should work this way. My problem being I need help on how to set up the triggers because I don't know how to set them up correctly. Maybe you can help me now that you know what I'm trying to do. I hope my post makes sense.

edited on Apr. 2, 2008 11:39 am by DeekCiti
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Wednesday, Apr. 2, 2008 04:12 pm
Killer's script doesn't need a real trigger does it?

make a few brushes to "fill" the inside of a building, select all brushes, give them a non-colliding, non-visible texture (eg. tools\trigger), right-click script -> script_brushmodel. Do not deselect the brushes! Press N key to bring up the entity editor. Type "targetname" into the key field and "no_rain_sound" in the value field (without the quote marks ""). Hit enter, close entitiy editor by pressing N again. Deselect the brushes (escape key) and make a new brush group for next building. Save, compile, rebuild ff and give it a try.
Share |
DeekCiti
General Member
Since: Mar 13, 2008
Posts: 1293
Last: Jul 9, 2016
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Friday, Apr. 4, 2008 05:33 am
I draw two brushes, with the Trigger Brush.

Select them both.. Right Click the 2d window, and say "make non-Colliding"

Right Click 2d window again, and say "script > brushmodel"

Hit "N" and notice these two Brushes have a classname of "script_brushmodel" now

I then type a key of "targetname" and value of "building_null" because this is my soundalias for no rain sound.

I then deselect and save. Recompile, and build fast file. Then Run selected map. Loading bar goes all the way, then game crashes.


-------

Quote:

IF, I DO NOT make that brushmodel "non-colliding" the game loads, and within the first two seconds of spawning the rain goes null for a second, then back on for a second, then null again for a second, and then stays on permentantly, (which is nowhere near the trigger brushes) but if I try to walk through my trigger brushes, they are invisible walls, that stop me. So I understand that you have to make them non-colliding, but when I do make them non-colliding it either crashes my game on loadscreen or when I'm doing the "Compile Reflections".


What is the reason I'm making them a "script_brushmodel" ?

Why would making them "non-colliding" crash my game on load and or while compiling reflections?

Why not make them a "trigger_multiple"?

I'm confused and not understanding why its crashing, and don't know why they need to be a script_brushmodel". Grrr!

I had no idea it would be this difficult to make a simple trigger that triggers a sound, then again, maybe I'm just an idiot...
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Friday, Apr. 4, 2008 08:17 am
Quote:
Anything that moves is a script_whatever (script_model for a model, script_brushmodel for a brush)

Turning something to script_whatever makes it an entity. Only entities can be accessed via script. Turning a brush to trigger_whatever creates an entity too. If you just place models and brushes in Radiant, you can't use them for scripting at all.

Getting Started in Scripting (Moving Things)


I guess the trigger texture isn't non-colliding, if you don't turn it into a trigger (just texturing the brush). Try using nodraw_notsolid instead. Non-colliding seems to not work for tool textures / transparent textures.


trigger_multiple fires the trigger-event as long as a player is touching the brush. Without setting the "wait" key/value pair, it will trigger 20 times per second. I find that very inefficent. What we need is a "trigger_touch". It should fire the trigger event only, when players enter or leave the trigger brush (whenever isTouching changes). Example (how it should be, theoretical code, not working!):

Code:
trigger_touch_think() {

trigger_touch = getent("trigger_touch", "targetname");

	while(1)
	{
		trigger_touch waittill("trigger", player);

		if(!isAlive(player)) return;

		if(player isTouching(trigger_touch))
		{
			// inside
		} else {
			// outside
		}
	}
}


trigger_multiple and the TrigOn / TrigOff function would work, but not for your purpose (turning the trigger off would turn it off for all players, but it has to be turned off for the current player only -> impossible by using that two function, 'cause they just move the whole trigger brush out of the playable area).
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Friday, Apr. 4, 2008 08:40 am
Actually, the trigger_use_touch should work. But i'm confused about the linking...

Quote:
when the player is touching and activated, the trigger will use its target


what does that mean? Do we have to link a script_model / script_brushmodel to the trigger? But we don't have/want a model or brush, only the trigger event whenever a player touches the trigger brush (and leaves!). Instead of an entity, would Info -> Null work too? Or how do we have to link it? Does it matter, to what we link?

Or what about placing trigger_use_touch brushes only where the player can enter a building (windows, door frames, ...)? That would trigger an event each time a player enters or leaves a building. To check whether player is inside or outside --> isTouching against an invisible script_brushmodel (non_colliding).
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 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

»