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

Members Online

»
0 Active | 101 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

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 trigger
Leal
General Member
Since: Feb 5, 2010
Posts: 196
Last: Aug 18, 2013
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Thursday, Dec. 2, 2010 06:49 pm
Hey! [wave]

I know you cannot move a trigger like a brusmodel, you you can change his origin right?

In my map I got moving a brush, and with this for I would like to "move" the origin with the brush.

Code:
		for(;;)
		{
			trig.origin = movingbrush.origin;
			iprintlnbold("for running");
			wait .3;
		}


But when the movingbrush starts moving, the trigger disapears. It does not stay at the position and does not follow the brush and does not appear at the end position of the brush.

Is my script wrong? I dont know why this happens...

Greetings
Share |
sam_fisher3000
General Member
Since: Apr 18, 2007
Posts: 816
Last: Jul 16, 2016
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Friday, Dec. 3, 2010 04:36 am
Um, how do you actually see triggers in game? So how do you know that it disappears? It might have moved somewhere else. That code is limited. I don't think trig.origin be equal to movingbrush.origin. I haven't tested it but you can give your trigger a targetname name and use the move function. Or use the teleport function. I never tried it but you can try it. Or just delete the trigger and create a new one.
Share |
Mystic
General Member
Since: Apr 10, 2004
Posts: 6147
Last: Apr 15, 2018
[view latest posts]
Level 10
Forum Moderator
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Friday, Dec. 3, 2010 03:05 pm
Try something like

Code:
brushEnt = getEnt( "movingbrush", "targetname" ); // name of brush you linking trigger too
trigEnt = getEnt( "movingtrigger", "targetname" ); // name of trigger
trigEnt linkTo( brushEnt );
Share |
Leal
General Member
Since: Feb 5, 2010
Posts: 196
Last: Aug 18, 2013
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Friday, Dec. 3, 2010 07:41 pm
sam_fisher3000 writes...
Quote:
Um, how do you actually see triggers in game? So how do you know that it disappears? It might have moved somewhere else. That code is limited. I don't think trig.origin be equal to movingbrush.origin. I haven't tested it but you can give your trigger a targetname name and use the move function. Or use the teleport function. I never tried it but you can try it. Or just delete the trigger and create a new one.


I see that it disappears because the F icon disappears. And you can't move a trigger like a brushmodel, you get an error.
Share |
Leal
General Member
Since: Feb 5, 2010
Posts: 196
Last: Aug 18, 2013
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Friday, Dec. 3, 2010 07:43 pm
Mystic writes...
Quote:
Try something like

Code:
brushEnt = getEnt( "movingbrush", "targetname" ); // name of brush you linking trigger too
trigEnt = getEnt( "movingtrigger", "targetname" ); // name of trigger
trigEnt linkTo( brushEnt );


The same, if you link it to the moving brush, it moves too, and this is not supported:

Code:
******* script runtime error *******
entity (classname: 'trigger_use_touch') does not currently support linkTo: (file 'maps/mp/mp_parlament.gsc', line 197)
 trig linkTo ( cockpit );
 *
[...]
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Friday, Dec. 3, 2010 08:10 pm
Leal writes...
Quote:
Hey! [wave]

I know you cannot move a trigger like a brusmodel, you you can change his origin right?

In my map I got moving a brush, and with this for I would like to "move" the origin with the brush.

Code:
		for(;;)
		{
			trig.origin = movingbrush.origin;
			iprintlnbold("for running");
			wait .3;
		}


But when the movingbrush starts moving, the trigger disapears. It does not stay at the position and does not follow the brush and does not appear at the end position of the brush.

Is my script wrong? I dont know why this happens...

Greetings


Judging from the source code, you could be better of by detecting the press of the usebutton, and a hud element showing ppl have to press F
Share |
Leal
General Member
Since: Feb 5, 2010
Posts: 196
Last: Aug 18, 2013
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Friday, Dec. 3, 2010 09:48 pm
But this distance from the origin is in all axis the same (x, y, z), and I don't know if it's possible to set a different distance on the different axis (the thing is a plane, so it's long). Is it possible?
Share |
sam_fisher3000
General Member
Since: Apr 18, 2007
Posts: 816
Last: Jul 16, 2016
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Friday, Dec. 3, 2010 10:12 pm
Well, like I said before, you can also create 2 triggers and delete the first one.
Share |
Leal
General Member
Since: Feb 5, 2010
Posts: 196
Last: Aug 18, 2013
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Friday, Dec. 3, 2010 10:56 pm
But then the trigger does not move, it deletes itself, and at the end of the move then appears a new one... I prefer to use Hud element and the UseButtonPressed, but then I need to control this different distances of the different axis.
Share |
Pedro699
General Member
Since: Jun 19, 2006
Posts: 781
Last: Dec 18, 2010
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Saturday, Dec. 4, 2010 01:42 am
You may need to add an origin brush to the trigger, otherwise the game assumes its origin is at (0,0,0).

Check out the sd_bombtrigger.map file in radient to see how to create one. This is a moveable use trigger for defusing the bomb in S&D.
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

»