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

Members Online

»
0 Active | 92 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
Category: CoD Mapping
CoD mapping and level design.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: moved trigger, scripting
hAYX
General Member
Since: Sep 21, 2006
Posts: 26
Last: Apr 10, 2012
[view latest posts]
Level 2
Category: CoD Mapping
Posted: Sunday, Apr. 8, 2012 11:26 pm
hello,

I do handicrafts just at a small project. it is a shooting range with moved aims. with that to tilt is if it aims to be met. however I need moved triggers or in such a way. could anyone help me please...

sorry, I am from the exercise that was unfortunately a translation web page


greets hayx

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: CoD Mapping
Posted: Monday, Apr. 9, 2012 08:54 am
If you do some digging in the forums, i'm pretty sure someone posted some code to a training map they made (over a year back) so that would be worth checking.

Other than that there are a lot of way to do it, personally i would attach the trigger brush to your target then when the player hits the target you can move it where ever you want and the trigger will still be attached.

Post any code you have so far.
Share |
DeekCiti
General Member
Since: Mar 13, 2008
Posts: 1293
Last: Jul 9, 2016
[view latest posts]
Level 8
Category: CoD Mapping
Posted: Monday, Apr. 9, 2012 04:40 pm
I believe the map was called "SP Shoot House, COD4".
Share |
hAYX
General Member
Since: Sep 21, 2006
Posts: 26
Last: Apr 10, 2012
[view latest posts]
Level 2
Category: CoD Mapping
Posted: Monday, Apr. 9, 2012 05:44 pm
Thanks for the note. but sp_shoothouse unfortunately only containts rotating targets...if you mean this...




greets hayx

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: CoD Mapping
Posted: Monday, Apr. 9, 2012 06:39 pm
On that map, when the trigger is hit, the script just rotates the target and probably deleted the trigger. all you would need to do is have the target script_brushmodel (the thing you shoot at) move in what ever direction, so maybe use something like 'movex' or 'movey', have that loop via the script but use 'linkto' on the trigger entity so it sticks to your target, that way when you shoot it you can either stop the target moving left to right with 'movedone', or make it explode or something. Post whaever you have so far,
Share |
Tally
General Member
Since: Apr 21, 2005
Posts: 819
Last: Oct 26, 2012
[view latest posts]
Level 7
Category: CoD Mapping
Posted: Monday, Apr. 9, 2012 06:58 pm
Try COD Rifle Range map:

http://callofduty.filefront.com/file/Rifle_Range;40691
Share |
hAYX
General Member
Since: Sep 21, 2006
Posts: 26
Last: Apr 10, 2012
[view latest posts]
Level 2
Category: CoD Mapping
Posted: Monday, Apr. 9, 2012 11:24 pm
attachment: application(1,512.8Kb)
hey, thanks for the link. I believe that was a full hit...
I copied out the relevant lines and fit it on my project on.

In my map are four targets. Two moving to the right and the other to the left and no more trigger...[read]

but i get a script compile error..

//edit: sorry. I tested the thing once again. and the script compile error appears no more. problably because I chanched

scriptorg = getent("ziel1","targetname"); to
scriptorg = getentarray("ziel1","targetname");

but the targets not react still on shots.

I did it understand now so that the target it's own trigger is. is this possible..lol but look self..thx for that..

I do the map files and the example map in the attachment

my map gsc: (edited April 10th)
Code:
main(){
maps\mp\_load::main();

setup_targets();
}

setup_targets()
{
	scriptorg = getentarray("ziel1","targetname");
	scriptorg2 = getentarray("ziel2","targetname");

	for(i = 0; i < scriptorg.size; i++)
		{
		targeted = getent(scriptorg[i].target,"targetname");
		ent = getent(targeted.target,"targetname");
		targeted linkto (scriptorg[i]);
		scriptorg[i] thread move();
		targeted thread follow(ent);
		ent thread target_hit(scriptorg[i]);
		}

	for(i = 0; i < scriptorg2.size; i++)
		{
		targeted = getent(scriptorg2[i].target,"targetname");
		ent = getent(targeted.target,"targetname");
		targeted linkto (scriptorg2[i]);
		scriptorg2[i] thread move2();
		targeted thread follow(ent);
		ent thread target_hit(scriptorg2[i]);
		}
}

target_hit(scriptorg)
{
	while(1)
	{
		self waittill("trigger",other);
		
			scriptorg rotateroll(90,.35);
			wait .1;
			scriptorg waittill("rotatedone");
			wait .2;
			scriptorg rotateroll( -90,.35);
			scriptorg waittill("rotatedone");		
	}
}

move()
{
while(1)
{
	while (1)
	{
	wait (randomint(8));
	self movex( 500,(randomint(3)+4));
	self waittill("movedone");
	self movez( 80, 3);
	self waittill("movedone");
	self movex( -500,(randomint(3)+4));
	self waittill("movedone");
	self movez( -80, 3);
	self waittill("movedone");
	}
wait .05;
}
}

move2()
{
while(1)
{
	while (1)
	{
	wait (randomint(8));
	self movex( -500,(randomint(3)+4));
	self waittill("movedone");
	self movez( 80, 3);
	self waittill("movedone");
	self movex( 500,(randomint(3)+4));
	self waittill("movedone");
	self movez( -80, 3);
	self waittill("movedone");
	}
wait .05;
}
}

follow(ent)
{
	while(1)
	{
	ent.origin = self.origin;
	wait (.05);
	}
}





greets hayx


edited on Apr. 9, 2012 04:25 pm by hAYX

edited on Apr. 10, 2012 12:55 am by hAYX
Share |
hAYX
General Member
Since: Sep 21, 2006
Posts: 26
Last: Apr 10, 2012
[view latest posts]
Level 2
Category: CoD Mapping
Posted: Tuesday, Apr. 10, 2012 03:14 pm
attachment: application(54.3Kb)
hm... the script compile error is still appearing in the developer mod

******* script runtime error *******
cannot cast undefined to string: (file 'maps\mp\ziel.gsc', line 14)
targeted = getent(scriptorg.target,"targetname");

*
called from:
(file 'maps\mp\ziel.gsc', line 4)
setup_targets();

*
called from:
(file 'maps\mp\ziel.gsc', line 1)
main(){

but ok... or not? [banghead]
I said that iI think that the targets are their own triggers and I have got a Quake C Scripting Reference and there is to read:

entity other; // entity that triggered event on 'self'

because of that: line 37 in the thread target_hit(scriptorg)

self waittill("trigger",other);

I do this reference in the attachment


edited on Apr. 10, 2012 08:23 am by hAYX
Share |
Tally
General Member
Since: Apr 21, 2005
Posts: 819
Last: Oct 26, 2012
[view latest posts]
Level 7
Category: CoD Mapping
Posted: Tuesday, Apr. 10, 2012 04:13 pm
1. The scripting language of COD is not Quake C. So, no point referring to it. COD has it's own hand-crafted language which is closer to C++ than it is C, and doesn't need to be compiled separately like Quake C does.

2. As for you code, try this:

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

	thread setup_targets();
}

setup_targets()
{
	scriptorg = getentArray( "ziel1", "targetname" );
	scriptorg2 = getentArray( "ziel2", "targetname" );

	for( i = 0; i < scriptorg.size; i++ )
	{
		targeted = getentArray( scriptorg[i].target, "targetname" );
		for( j=0; i < targeted.size; j++ )
		{
			ent = getentArray( targeted[j].target, "targetname" );
			for( n=0; n < ent.size; n++ )
			{
				targeted[j] linkto( scriptorg[i] );
				scriptorg[i] thread move();
				targeted[j] thread follow( ent[n] );
				ent[n] thread target_hit( scriptorg[i] );
			}
		}
	}	
	
	for( i = 0; i < scriptorg2.size; i++ )
	{
		targeted = getentArray( scriptorg2[i].target, "targetname" );
		for( j=0; i < targeted.size; j++ )
		{
			ent = getentArray( targeted[j].target, "targetname" );
			for( n=0; n < ent.size; n++ )
			{
				targeted[j] linkto( scriptorg2[i] );
				scriptorg2[i] thread move();
				targeted[j] thread follow( ent[n] );
				ent[n] thread target_hit( scriptorg2[i] );
			}
		}
	}
}

target_hit( scriptorg )
{
	while( 1 )
	{
		self waittill( "trigger", other );
		
		if( isPlayer( other ) )
		{
			scriptorg rotateroll( 90, .35 );
			wait .1;
			scriptorg waittill( "rotatedone" );
			wait .2;
			scriptorg rotateroll( -90,.35 );
			scriptorg waittill( "rotatedone" );		
		}
	}
}

move()
{
	while( 1 )
	{
		wait( randomint(8) );
		self movex( 500,(randomint(3)+4) );
		self waittill( "movedone" );
		self movez( 80, 3 );
		self waittill( "movedone" );
		self movex( -500,(randomint(3)+4) );
		self waittill("movedone");
		self movez( -80, 3 );
		self waittill( "movedone" );

		wait .05;
	}
}

move2()
{
	while( 1 )
	{
		wait( randomint(8) );
		self movex( -500,(randomint(3)+4) );
		self waittill( "movedone" );
		self movez( 80, 3 );
		self waittill( "movedone" );
		self movex( 500,(randomint(3)+4) );
		self waittill( "movedone" );
		self movez( -80, 3 );
		self waittill("movedone");
		
		wait .05;
	}
}

follow( ent )
{
	while( 1 )
	{
		ent.origin = self.origin;
		wait (.05);
	}
}


This code is entirely untested, so I am not sure if it will work.
Share |
hAYX
General Member
Since: Sep 21, 2006
Posts: 26
Last: Apr 10, 2012
[view latest posts]
Level 2
Category: CoD Mapping
Posted: Tuesday, Apr. 10, 2012 05:12 pm
hey, very thanks for the information...this is interessting with the script language..

the script unfortunately threw out the same mistake again [crazy]

looking forward

greets hayx
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty : CoD Mapping

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

»