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

Members Online

»
0 Active | 110 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 subscribe
Author Topic: Moving Hurt Trigger
r00t_
General Member
Since: Dec 15, 2010
Posts: 51
Last: May 16, 2011
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Tuesday, Jan. 18, 2011 12:13 am
So, in my map i have this brushmodel. Without getting into logistics, i move this brushmodel around my map just like i would any brushmodel (with the normal moveTo() function). I also have this hurt trigger that i have given the key "targetname" with a value "trig_hurt". So, so far this is the code i have:
Code:
model = getent("model","targetname"); 
trig = getent("trig_hurt","targetname");


I want to be able to "attach" the hurt trigger to the brushmodel to make it so if a player touches the model, they get hurt (with the brushmodel still being able to move around). I have tried doing:
Code:
trig linkto(model);

But as you have probably already figured out, i get an error along the lines of: "A trigger doesn't support the function: linkto"

So I don't know what to do. Please comment with your ideas. Thanks
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Tuesday, Jan. 18, 2011 12:56 am
trig enablelinkto();
Share |
SparkyMcSparks
General Member
Since: Feb 28, 2004
Posts: 1713
Last: Dec 29, 2016
[view latest posts]
Level 8
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Tuesday, Jan. 18, 2011 12:58 am
While loop and changing the trigger origin every frame.
Share |
voidsource
General Member
Since: May 5, 2007
Posts: 1513
Last: Sep 1, 2013
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Tuesday, Jan. 18, 2011 01:11 am
ah this is very simple to do. both ur brushmodel and your trigger_damage must have an "origin" brush on it. So i assume that u know how to give a brushmodel an origin, the same would be true about ur trigger. then use this code which is from cod4, but it works the same. ( dont know if cod2 has this function in the _utility.gsc )

here it is:

Code:


manual_linkto( entity, offset )
{
	entity endon( "death" );
	self endon( "death" );
	// for entities that don't support linkto, like soundblend entities
	if ( !isdefined( offset ) )
	{
		offset = ( 0, 0, 0 );
	}
	
	for ( ;; )
	{
		self.origin = entity.origin + offset;
		self.angles = entity.angles;
		wait( 0.05 );
	}
}




that should do the trick.
Share |
clanhelio
General Member
Since: Aug 30, 2008
Posts: 223
Last: Mar 24, 2011
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Tuesday, Jan. 18, 2011 10:12 am
IzNoGoD writes...
Quote:
trig enablelinkto();

EVERYBODY STOP.
RIGHT HERE
YEAH THIS IS IT. THIS IS THE ANSWER. RIGHT THERE.

On a related note, we have this thread like once a month.
Share |
r00t_
General Member
Since: Dec 15, 2010
Posts: 51
Last: May 16, 2011
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Tuesday, Jan. 18, 2011 02:22 pm
clanhelio writes...
Quote:
On a related note, we have this thread like once a month.

Oh, my apologies. I should have looked around a little before starting this thread [crazy]

EDIT:
So, i just pretty much did everything i read i should do on this thread. I added an origin to my trigger, did the enablelinkto() and everything. And after writing my gsc, which has the linkto in it, ingame, the xmodel that the trigger should be linked to doesn't hurt a player when it gets near. However, after more careful inspection of the map (ingame), as i run around the map, with the xmodel chasing me (that's the purpose of the script), i'll be running around and suddenly i'll get hurt, even though i'm nowhere near the xmodel. And it'll happen again from time to time.

So i have deduced that the trigger is moving, but to sporadic locations.
Share |
Restricted Access Topic is Locked 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

»