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

Members Online

»
0 Active | 80 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: CoDUO Mapping
CoD United Offensive mapping and level design.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: Another scripting question please
T.E.C.-Leader
General Member
Since: Sep 23, 2004
Posts: 214
Last: May 4, 2005
[view latest posts]
Level 4
Category: CoDUO Mapping
Posted: Friday, Apr. 29, 2005 05:20 pm
Hi there fellas!

Was wondering about the door sounds. There are two ways to do it. I did the "simple" method, giving a target and targetname to door+origin, and then this entry in my gsc file:
Code:
	thread doorsound1();


doorsound1() 
{ 
	sound = getent("door_wood1","targetname"); 
	doorsound1 = getent ("door_noise1", "target"); 
	doorsound1 waittill ("trigger"); 
	sound playsound("dooropen"); 
	wait (3.8); 
	sound playsound("doorclose"); 
	self thread doorsound1(); 
	return; 
} 


It works fine. I did same thing for locked doors, adding key:angle and value:.01 so doors doesn`t seem to open...Works too.
All in all, I have 48 doors making sound like this, so it makes a whole lot of different targets and targetnames.

I am wondering if the scripted method like the one below would eat less game engine ressources:
Code:
	SetupDoors();
}

SetupDoors()
{
	doors = getentarray("rotatingdoor","targetname");
	if(isdefined(doors))
	{
		for(i=0;i<doors.size;i++)
		{
			doors[i] thread SetupDoor();
		}
	}
}

SetupDoor()
{
	left = getent(self.target, "targetname");
	right = getent(left.target, "targetname");
	left thread TriggerDoor(90, self, right);
	right thread TriggerDoor(-90, self, left);
}

TriggerDoor(angle, door, trig)
{
	time = door.time / 800;
	while(1)
	{
		self waittill("trigger", other);
		dme = distance(other getOrigin(), self getOrigin());
		dmh = distance(other getOrigin(), trig getOrigin());
		if(dme > dmh) {
			nangle = 0 - angle;
		} else {
			nangle = angle;
		}
		self triggeron();
		trig triggeron();
		
		// Do the rotation in 2 steps
		// Hold use button to slam the door
		angle8 = nangle / 8;
		time8 = time / 8;

		door playsound("dooropen");

		door rotateto((0, angle8, 0), time8, time8, 0);
		door waittill("rotatedone");
		{
			door rotateto((0, nangle, 0), time - time8, 0, time / 2);
		}
		door waittill("rotatedone");

		self triggeron();
		trig triggeroff();

		self waittill("trigger", other);
		dme = distance(other getOrigin(), self getOrigin());
		dmh = distance(other getOrigin(), trig getOrigin());
		if(dme > dmh) {
			nangle = 0 - angle;
		} else {
			nangle = angle;
		}
		self triggeroff();
		trig triggeron();

		door playsound("doorclose");

		door rotateto((0, 0, 0), time, time / 2, time / 2);

		wait(time-0.1);

		door waittill("rotatedone");
		self triggerOn();
		trig triggerOn();
	}
}

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;
}


Could a scripting guru tell me what method is better in comsuming less game ressources, or do they both come down to same thing?

Thank you,

T.E.C.-Leader
Share |
BR3NT
General Member
Since: Feb 15, 2005
Posts: 49
Last: Jun 6, 2005
[view latest posts]
Level 2
Category: CoDUO Mapping
Posted: Monday, May. 2, 2005 01:45 pm
I Think The Resources used up by the game will be the same no matter how you do it.

The Secound Section of code is Cleaner and Is What I Would use.

Just My Opinion.

[smokin]
Share |
T.E.C.-Leader
General Member
Since: Sep 23, 2004
Posts: 214
Last: May 4, 2005
[view latest posts]
Level 4
Category: CoDUO Mapping
Posted: Tuesday, May. 3, 2005 12:29 am
Even though I still haven`t tried it yet, the scripted method seems slightly better, in the way that there are less variables to take into account. As I said, I did not try it yet, as other aspects of the map are still more important to finish in my priority list...I will compare soon though...

Thx,

T.E.C.-Leader
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty : CoDUO 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

»