Art of War Central
View in iTunes
Please help us to raise in the ranks of podcasting and subscribe to our itunes feed using the link above.
The next MODSonair show will air LIVE on:
03/21/2010 12:03 EDT

Time remaining:
We Dontated to PixelEquity
"A total overhaul mod changes or redefines the gameplay style of the original game, while keeping it in the original game's universe or plot." 3
 
Site News   |   Aggregated News   |   Forums   |   Tutorials   |   Downloads   |   Projects   |   Weblinks
Latest Forum Threads 
CoD4 SP Mapping.. Posts: (3) Views: (17) by infinet
CoD4 Scripting.. Posts: (1) Views: (11) by j4cken
General Gaming.. Posts: (7) Views: (139) by Rasta
CoD4 MP Mapping.. Posts: (4) Views: (67) by Infern4ll
CoD4 Scripting.. Posts: (9) Views: (255) by DemonSeed
CoD2 MP Mapping.. Posts: (12) Views: (97) by StrYdeR
CoDUO Mapping.. Posts: (5) Views: (74) by sternkaa
MODSon-air.. Posts: (1) Views: (23) by foyleman
Back to Home Page
MODSCON 2010 L4D2 Contest
Art of War Central
 
Forums
MODSonline.com 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, StrYdeR, techno2sl, batistablr, Welshy, Rasta, supersword, batistablr, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Restricted Access 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 07:27 am
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
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 11:14 am
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);
	}
} 
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:13 pm
ok ty very much it works now with out the maps\_utility:: ^^
Restricted Access Restricted Access subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting