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

Members Online

»
0 Active | 72 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: Random triggers
ninnock
General Member
Since: May 8, 2009
Posts: 3
Last: Nov 29, 2009
[view latest posts]
Level 0
Category: CoD2 Scripting
Posted: Sunday, Nov. 29, 2009 12:27 pm
hey guys i want to create 2 triggers and 1 should be activate randomly by trigger but it dont work i hope you guys can help me :D

Code:

random()
{ 
trig_work=getent("trig_dmg_geht","targetname");
 trig_push=getent("trig_dmg","targetname");
 trig_dmg_01=getent("trig_dmg_01","targetname");
 trig_dmg_02=getent("trig_dmg_02","targetname");
 while(1)
 { 
trig_work waittill ("trigger");
 trig_dmg_01 triggeroff();
 trig_dmg_02 triggeroff();
 trig_push waittill("trigger");
 random[0] = "0";
 random[1] = "1";
 random[randomint(random.size)]
 if("random"=="0")
 {
trig_dmg_01 triggeron();
 wait(3);
 trig_dmg_01 triggeroff();
 }  
if("random"=="1")
 { 
trig_dmg_02 triggeron();
 wait(3);
 trig_dmg_02 triggeroff();
 } 
wait(5);
 }
 }  
triggeroff() 
{ 
	if(!isdefined(self.realOrigin)) 
		self.realOrigin = self.origin;  	
if(self.origin == self.realorigin)
 		self.origin += (0, 0, -10000); 
}
  triggeron()
 { 
	if(isDefined(self.realOrigin)) 		
self.origin = self.realOrigin; }


edited on Nov. 29, 2009 07:28 am by ninnock
Share |
COD4GRC
General Member
Since: Aug 12, 2007
Posts: 44
Last: Jan 30, 2010
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Sunday, Nov. 29, 2009 04:14 pm
Try this:

Code:
random(){ 
	trig_work=getent("trig_dmg_geht","targetname");
	trig_push=getent("trig_dmg","targetname");
	trig_dmg_01=getent("trig_dmg_01","targetname");
	trig_dmg_02=getent("trig_dmg_02","targetname");
	
	while(1){ 
		trig_work waittill ("trigger");
		trig_dmg_01 maps\_utility::triggerOff();
		trig_dmg_02 maps\_utility::triggerOff();
		trig_push waittill("trigger");
		
		if(randomintrange(0, 2) == 0){
			trig_dmg_01 maps\_utility::triggerOn();
			wait(3);
			trig_dmg_01 maps\_utility::triggerOff();
		}else{
			trig_dmg_02 maps\_utility::triggerOn();
			wait(3);
			trig_dmg_02 maps\_utility::triggerOff();
		} 
		wait(5);
	}
} 
Share |
ninnock
General Member
Since: May 8, 2009
Posts: 3
Last: Nov 29, 2009
[view latest posts]
Level 0
Category: CoD2 Scripting
Posted: Sunday, Nov. 29, 2009 05:13 pm
ok ty very much it works now with out the maps\_utility:: ^^
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

»