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

Members Online

»
0 Active | 64 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 4
Category: CoD4 Scripting
Scripting and coding with Call of Duty 4.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Previous Page
subscribe
Author Topic: Problem moving door Script compile error
codmp
General Member
Since: Feb 7, 2006
Posts: 905
Last: Aug 1, 2011
[view latest posts]
Level 7
Category: CoD4 Scripting
Posted: Thursday, Apr. 23, 2009 02:34 pm
Try something like this. I made the self.doormodel parts into doormodel - taking out the self part.
Code:
main();
{
doortriggers = getentarray("deur_open","targetname");
for(i=0;i< doortriggers.size;i++)
doortriggers[i] thread door_think();
}

door_think()
{
self.doormoving = false;
self.doorclosed = true;
doormodel = getent(self.target, "targetname");

while (1)
{
self waittill("trigger");
if(!self.doormoving)
self thread door_move();
}
}

door_move()
{
self.doormoving = true;
if(self.doorclosed)
{
doormodel moveto ((3077.5,819.5,0.0),1);
doormodel waittill("movetodone");
self.doorclosed = false;
}
else
{
doormodel moveto ((3077.5,819.5,0.0),1);
doormodel waittill("movetodone");
self.doorclosed = true;
}
self.doormoving = false;
} 


If that doesn't work, then try just puting something like self.doormodel = undefined; at the top of door_think.

Also, you do have your triggers targeting the doormodel right? If you don't, then thats going to cause problems since the script is thinking they are and is trying to get the triggers target.
Share |
dutchman16
General Member
Since: May 8, 2006
Posts: 177
Last: Apr 29, 2009
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Thursday, Apr. 23, 2009 05:07 pm
No I don't have the triggers targeting the doormodel. How do I do that?
Share |
dutchman16
General Member
Since: May 8, 2006
Posts: 177
Last: Apr 29, 2009
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Thursday, Apr. 23, 2009 05:30 pm
it gives an error that doormodel is an unitilialized variable

Btw. fixed the triggers targeting the "door".

edited on Apr. 23, 2009 01:31 pm by dutchman16

edited on Apr. 23, 2009 01:34 pm by dutchman16
Share |
DeekCiti
General Member
Since: Mar 13, 2008
Posts: 1293
Last: Jul 9, 2016
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Thursday, Apr. 23, 2009 06:51 pm
The door script should have worked fine the way it was originally. I've used that same script many, Many times the way it was, there is no need to start changing it around.

As long as you built the door correctly and a door exists and the trigger has the same targetname as in your script you shouldn't have any problems.

The first script you posted had been edited and lines moved around, where did you find that? Or did you do that? [crazy]


Also, change the script back to the way it was by looking in the previous posts. You changed the name now the script is messed up and is no longer a variable. Also what kind of door is this, you have it set up on a moveto function. If changing it back doesn't work, try this script, its the nearly the same, just copy and paste/replace. it will do exactly what you had your original script doing in post 1.

Code:
main()
{
	thread scripted_door();
}<br />
<br />
scripted_door()<br />
<br />
{
	doortrigger = getentarray("deur_open","targetname");
	for(i=0;i< doortrigger.size;i++)
	{
	doortrigger [i] thread door_think();
	}
}<br />
<br />
door_think()
{
	self.doormoving = false;
	self.doorclosed = true;
	self.doormodel = getent(self.target, "targetname");<br />
<br />
	while (1)
	{
		self waittill("trigger");
		if(!self.doormoving)
		self thread door_move();
	}
}<br />
<br />
door_move()
{
	self.doormoving = true;
	if(self.doorclosed)
	{
	self.doormodel moveto ((3077.5,819.5,0.0),1);
	self.doormodel waittill("movedone");
	self.doorclosed = false;
	}
	else
	{
	self.doormodel moveto ((3077.5,819.5,0.0),1);
	self.doormodel waittill("movedone");
	self.doorclosed = true;
	}
	self.doormoving = false;
}


Share |
dutchman16
General Member
Since: May 8, 2006
Posts: 177
Last: Apr 29, 2009
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Friday, Apr. 24, 2009 04:43 pm
Deekciti when I try your script it gives this error:


Url: http://img9.imageshack.us/my.php?image=probleem2h.jpg

Scripts:
_deur.gsc
Code:
main()
{
	thread scripted_door();
}

scripted_door()

{
	doortrigger = getentarray("deur_open","targetname");
	for(i=0;i< doortrigger.size;i++)
	{
	doortrigger [i] thread door_think();
	}
}

door_think()
{
	self.doormoving = false;
	self.doorclosed = true;
	self.doormodel = getent(self.target, "targetname");

	while (1)
	{
		self waittill("trigger");
		if(!self.doormoving)
		self thread door_move();
	}
}

door_move()
{
	self.doormoving = true;
	if(self.doorclosed)
	{
	self.doormodel moveto ((3077.5,819.5,0.0),1);
	self.doormodel waittill("movedone");
	self.doorclosed = false;
	}
	else
	{
	self.doormodel moveto ((3077.5,819.5,0.0),1);
	self.doormodel waittill("movedone");
	self.doorclosed = true;
	}
	self.doormoving = false;
}


mp_modern-dawnville.gsc
Code:

main()
{

maps\mp\_load::main();
maps\mp\_deur::main();

//setExpFog(500, 3500, .5, 0.5, 0.45, 0);
ambientPlay("ambient_middleeast_ext");
//VisionSetNaked( "mp_vacant" );

game["allies"] = "sas";
game["axis"] = "marines";

game["attackers"] = "axis";
game["defenders"] = "allies";
game["allies_soldiertype"] = "woodland";
game["axis_soldiertype"] = "woodland";
setdvar( "r_specularcolorscale", "1" );

setdvar("r_glowbloomintensity0",".1");
setdvar("r_glowbloomintensity1",".1");
setdvar("r_glowskybleedintensity0",".1");
//setdvar("compassmaxrange","1500");
} 





edited on Apr. 24, 2009 12:46 pm by dutchman16
Share |
codmp
General Member
Since: Feb 7, 2006
Posts: 905
Last: Aug 1, 2011
[view latest posts]
Level 7
Category: CoD4 Scripting
Posted: Friday, Apr. 24, 2009 05:14 pm
How many triggers and doors are you using? This error is being caused because something wasn't done right with the linking of the trigger and door.
Share |
dutchman16
General Member
Since: May 8, 2006
Posts: 177
Last: Apr 29, 2009
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Friday, Apr. 24, 2009 06:23 pm
Oke I use 1 door, but I only selected 1 part of the script_model to link with the trigger.
Share |
DeekCiti
General Member
Since: Mar 13, 2008
Posts: 1293
Last: Jul 9, 2016
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Friday, Apr. 24, 2009 07:06 pm
Yeah he's right, you've created the door incorrectly. You should look at a door Tut, so you can get that right.
Share |
dutchman16
General Member
Since: May 8, 2006
Posts: 177
Last: Apr 29, 2009
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Saturday, Apr. 25, 2009 03:46 pm
Oke I fixed it, Thank you guys!

**Topic Closed**
Share |
Restricted Access Topic is Locked
Page
Previous Page
subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 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

»