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

Members Online

»
0 Active | 12 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
subscribe
Author Topic: Moving triggers - possible?
clanhelio
General Member
Since: Aug 30, 2008
Posts: 223
Last: Mar 24, 2011
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Jun. 27, 2009 05:52 am
Why isn't it efficient? It seems to be exactly what he wants...
Share |
Zelzahim
General Member
Since: Dec 31, 2008
Posts: 42
Last: Sep 23, 2010
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Saturday, Jun. 27, 2009 12:18 pm
playername, tried your but i get this error:

Code:
******* script runtime error *******
entity 6 is not a script_brushmodel, script_model, or script_origin: (file 'maps/yalla.gsc', line 116)
  trigger_shoot movex(-1000, 10, 9, 1);
  *
started from:
(file 'maps/yalla.gsc', line 114)
  wait (2);
  *
************************************
      dvar set com_errorTitle Error
      dvar set com_errorMessage script runtime error
(see console for details)
(file 'maps/yalla.gsc', line 114)<br />
<br />
unknown UI script restart
      dvar set ui_playerProfileCount 1<br />
<br />
******* script runtime error *******
undefined is not a field object: (file 'maps/yalla.gsc', line 117)
  trigger_shoot.origin = trig_org.origin;
                         *
started from:
(file 'maps/yalla.gsc', line 114)
  wait (2);
  *
************************************<br />
<br />
******* script runtime error *******
type undefined is not a vector: (file 'maps/yalla.gsc', line 117)
  trigger_shoot.origin = trig_org.origin;
                       *
started from:
(file 'maps/yalla.gsc', line 114)
  wait (2);
  *
************************************
      dvar set cl_paused 1
      dvar set com_errorMessage 
      dvar set ui_background background_american_w
      dvar set ui_logo_show 1
      dvar set ui_version_show 1
      dvar set ui_separator_show 1
      dvar set ui_background_gradient_show 0
unknown UI script restart
      dvar set ui_playerProfileCount 1
quitting...
----- CL_Shutdown -----
-----------------------
----- Server Shutdown -----
ShutdownGame:
------------------------------------------------------------
      dvar set sv_running 0
---------------------------


Share |
Zelzahim
General Member
Since: Dec 31, 2008
Posts: 42
Last: Sep 23, 2010
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Saturday, Jun. 27, 2009 04:46 pm
anyone? :/
Share |
SPIDYpiet
General Member
Since: Jan 18, 2008
Posts: 8
Last: Apr 30, 2012
[view latest posts]
Level 0
Category: CoD2 Scripting
Posted: Saturday, Jun. 27, 2009 06:05 pm
brush_model = getent("brushname","targetname");
trigg = getent("triggername","targetname");
trigg enablelinkto();
trigg linkto(brush_model);

lol its depending off course where the origin of the brush_model is
because the trigger will center it self on that origin
Share |
voidsource
General Member
Since: May 5, 2007
Posts: 1513
Last: Sep 1, 2013
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Saturday, Jun. 27, 2009 06:27 pm
Quote:


entity 6 is not a script_brushmodel, script_model, or script_origin: (file 'maps/yalla.gsc', line 116)
trigger_shoot movex(-1000, 10, 9, 1);


Quote:


undefined is not a field object: (file 'maps/yalla.gsc', line 117)
trigger_shoot.origin = trig_org.origin;




somehow you dont have a script_brushmodel like you would think for you to move something and something on the field isnt an object. So i think you have to make it a script_brushmodel for it to work.
Share |
playername
Preferred Member
Since: Aug 24, 2006
Posts: 821
Last: Apr 15, 2011
[view latest posts]
Level 7
Forum Moderator
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Saturday, Jun. 27, 2009 07:37 pm
you need to remember that if you don't have a origin texture part of the trigger, it's origin is at 0 0 0. So technically you have to do something like.

Code:

brush_model = getent("brushname","targetname");
trigg = getent("triggername","targetname");

trigg.origin = (0, 0, 0) - brush_model.origin;
nullFew tips for coding.
1. Keep the script as short as possible.
2. Don't comment every line. Only comment portions where they may be needed to point something out.
3. Don't over complicate the script, keep it organized and easy to read.

These help you find simple errors and makes it easy to make changes.
Share |
Zelzahim
General Member
Since: Dec 31, 2008
Posts: 42
Last: Sep 23, 2010
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Sunday, Jun. 28, 2009 07:56 am
Nope, not working at all.

Isnt it possible to delete() the trigger and then re_spawn them 1000 yards ahead on the x-axis or at a origin?.
Share |
DemonSeed
General Member
Since: Apr 30, 2009
Posts: 1362
Last: Feb 19, 2018
[view latest posts]
Level 8
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Sunday, Jun. 28, 2009 09:28 am
Zelzahim writes...
Quote:
Nope, not working at all.

Isnt it possible to delete() the trigger and then re_spawn them 1000 yards ahead on the x-axis or at a origin?.


Only a trigger_radius, as you cant dynamically spawn any other type of trigger without a lot of scripting (i.e. it can be done, but it takes a lot of scripting). However, I have found the good ol' trigger_radius does everything any other trigger does with the right script - it can damage (using radiusdamage()) like a trigger_damage; it can trigger multiple times like a trigger_multiple; and it can be "used" like a trigger_use. So, why not use a trigger_radius? That way you can reposition it over and over again, just remember to delete() the original once a new one has been created, otherwise you will quickly run out of spawnable entities and your map wont load.

To give you an idea how it can be done, here is a script function I created for a COD2 mod I made:

Code:
init()
{
	if( level.gametype != "ctf" ) return;
	
	level.axis_flag_pos = cvardef( "ctf_axis_flag", "", "", "", "string" );
	level.allied_flag_pos = cvardef( "ctf_allies_flag", "", "", "", "string" );

	level thread reSetFlags();
}

reSetflags()
{
	
	if( level.axis_flag_pos != "" )
	{
		axis_original = getEnt( "axis_flag", "targetname" );
		
		new_origin = getcoords( level.axis_flag_pos );
		addobj( "axis_flag", new_origin, axis_original.angles );

		if( isdefined( axis_original ) )
			axis_original delete();
	}

	if( level.allied_flag_pos != "" )
	{
		allied_original = getEnt( "allied_flag", "targetname" );
		
		new_origin = getcoords( level.allied_flag_pos );
		addobj( "allied_flag", new_origin, allied_original.angles );

		if( isdefined( allied_original ) )
			allied_original delete();
	}
}

addobj( name, origin, angles )
{
   ent = spawn( "trigger_radius", origin, 0, 48, 148 );
   ent.targetname = name;
   ent.angles = angles;
}

getcoords( dvar )
{
	array = StrTok( dvar, "," );

	coords = ( int( array[0] ), int( array[1] ), int( array[2] )-60 );

	return coords;
}


Its job was to re-position the CTF triggers when a map had bad posistions for the flags.

First, you set up the new coordinates by going into the map, finding the posistions of the flags that YOU thought were right, and dropping down console and doing /viewpos.

Then you leave the server, grab the console_mp.log file, find the 2 instances of /viewpos and copy the coordinates. These then went into your config file. Something like this:

set ctf_axis_flag "234,-123,1436"
set ctf_allies_flag "6754,-123,1432"

When you reloaded the map, the flag triggers (i.e. trigger_radius) were moved to those new coordinates, and the old triggers deleted.

Credit for the getcoords() function above goes to Lion, from his AGE mod for COD2.

The point of the above example - notice how I simply spawn a new trigger_radius and then delete() the old one. I dont move it at all (I tried that method, with a hundred different variations, and whereas some of them worked, the amount of scripting to get them to work properly was just too inefficient, so I went with the simpler method instead).

edited on Jun. 28, 2009 05:34 am by DemonSeed
Share |
Zelzahim
General Member
Since: Dec 31, 2008
Posts: 42
Last: Sep 23, 2010
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Sunday, Jun. 28, 2009 12:35 pm
Thanks Demon!

Ill try it when i get back home and can use radiant again (going way for a few days).
Share |
Restricted Access Topic is Locked
Page
Previous 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

»