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

Members Online

»
0 Active | 7 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

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 subscribe
Author Topic: Door Error
.Mordecai.
General Member
Since: Jan 4, 2007
Posts: 26
Last: Jul 21, 2008
[view latest posts]
Level 2
Category: CoD4 Scripting
Posted: Thursday, Jun. 19, 2008 03:27 pm
Hey i was trying to do the moving door tutorial but at the end everytime i did i go this error " Error: bad syntax: (file 'map/mp/_door.gsc', line 25) doortriggers thread door_think(); " and here is my files the _door.gsc -

Code:
main()
{
	maps\mp\_door::main();
	maps\mp\_load::main();
	
	//setExpFog(500, 2200, 0.81, 0.75, 0.63, 0);
	//VisionSetNamed( "mp_mytest" );
	
	game["allies"] = "sas";
	game["axis"] = "russian";
	game["attackers"] = "axis";
	game["defenders"] = "allies";
	game["allies_soldiertype"] = "woodland";
	game["axis_soldiertype"] = "woodland";
	
	setdvar( "r_specularcolorscale", "1" );
	
	setdvar( "r_glowbloomintensity0", ".25" );
	setdvar( "r_glowbloomintensity1", ".25" );
	setdvar( "r_glowskybleedintensity0", ".3" );
	setdvar( "compassmaxrange", "1800" );

doortriggers = getentarray("doortrig","targetname");
for(i=0;i
doortriggers[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 rotateyaw(-90,1,0.5,0.5);
self.doormodel waittill("rotatedone");
self.doorclosed = false;
}
else
{
self.doormodel rotateyaw(90,1,0.5,0.5);
self.doormodel waittill("rotatedone");
self.doorclosed = true;
}
self.doormoving = false;
} 


which i put in both (D:\Activision\Call of Duty 4 - Modern Warfare\raw\maps\mp) and (D:\Activision\Call of Duty 4 - Modern Warfare\raw\maps) and the main one-

Code:

main()
{
	maps\mp\_door::main();
	maps\mp\_load::main();
	
	//setExpFog(500, 2200, 0.81, 0.75, 0.63, 0);
	//VisionSetNamed( "mp_mytest" );
	
	game["allies"] = "sas";
	game["axis"] = "russian";
	game["attackers"] = "axis";
	game["defenders"] = "allies";
	game["allies_soldiertype"] = "woodland";
	game["axis_soldiertype"] = "woodland";
	
	setdvar( "r_specularcolorscale", "1" );
	
	setdvar( "r_glowbloomintensity0", ".25" );
	setdvar( "r_glowbloomintensity1", ".25" );
	setdvar( "r_glowskybleedintensity0", ".3" );
	setdvar( "compassmaxrange", "1800" );
}

which i put in the (D:\Activision\Call of Duty 4 - Modern Warfare\raw\maps\mp)
then my cfg looks like this -


ignore,code_post_gfx_mp
ignore,common_mp
ignore,localized_code_post_gfx_mp
ignore,localized_common_mp
col_map_mp,maps/mp/mp_mytest.d3dbsp
rawfile,maps/mp/mp_mytest.gsc
impactfx,mp_mytest
sound,common,mp_mytest,!all_mp
sound,generic,mp_mytest,!all_mp
sound,voiceovers,mp_mytest,!all_mp
sound,multiplayer,mp_mytest,!all_mp
rawfile,maps/mp/mp_mytest.gsc
xmodel,body_mp_usmc_specops
xmodel,head_mp_usmc_tactical_mich_stripes_nomex
xmodel,body_mp_usmc_sniper
xmodel,head_mp_usmc_tactical_baseball_cap
xmodel,body_mp_usmc_recon
xmodel,head_mp_usmc_nomex
xmodel,body_mp_usmc_assault
xmodel,head_mp_usmc_tactical_mich
xmodel,body_mp_usmc_support
xmodel,head_mp_usmc_shaved_head
xmodel,body_mp_arab_regular_cqb
xmodel,head_mp_arab_regular_headwrap
xmodel,viewhands_desert_opfor
xmodel,body_mp_arab_regular_sniper
xmodel,head_mp_arab_regular_sadiq
xmodel,body_mp_arab_regular_engineer
xmodel,head_mp_arab_regular_ski_mask
xmodel,body_mp_arab_regular_assault
xmodel,head_mp_arab_regular_suren
xmodel,body_mp_arab_regular_support
xmodel,head_mp_arab_regular_asad
material,default
rawfile,maps/mp/mp_mytest_fx.gsc
rawfile,maps/createfx/mp_mytest_fx.gsc
rawfile,vision/mp_mytest.vision
rawfile,maps/mp/mp_1.gsc
material,default

edited on Jun. 19, 2008 11:29 am by .Mordecai.
edit: Put the code into code boxes.

edited on Jun. 20, 2008 03:23 pm by The_Caretaker
Share |
The_Caretaker
General Member
Since: Jun 8, 2004
Posts: 11625
Last: Jul 7, 2009
[view latest posts]
Level 10
Category: CoD4 Scripting
Posted: Friday, Jun. 20, 2008 07:26 pm
Code:
for(i=0;i
doortriggers[i] thread door_think();


should be

Code:
for(i=0;i<doortriggers.size;i++)
doortriggers[i] thread door_think();


also, you don't need all this in your _door .gsc file:

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

//setExpFog(500, 2200, 0.81, 0.75, 0.63, 0);
//VisionSetNamed( "mp_mytest" );

game["allies"] = "sas";
game["axis"] = "russian";
game["attackers"] = "axis";
game["defenders"] = "allies";
game["allies_soldiertype"] = "woodland";
game["axis_soldiertype"] = "woodland";

setdvar( "r_specularcolorscale", "1" );

setdvar( "r_glowbloomintensity0", ".25" );
setdvar( "r_glowbloomintensity1", ".25" );
setdvar( "r_glowskybleedintensity0", ".3" );
setdvar( "compassmaxrange", "1800" );

That's in your map's .gsc file already.
Share |
ahoji
General Member
Since: May 16, 2006
Posts: 74
Last: Jun 27, 2008
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Saturday, Jun. 21, 2008 09:33 pm
can be a much easier, split script into 2 parts (doop opening and closing), and use 'waittill trigger' before each part

Code:

......
for(i=0;i<doortriggers.size;i++)
doortriggers[i] thread door();
}

door()
{
while (1)
{
self waittill("trigger");

self.doormodel rotateyaw(-90,1,0.5,0.5);
self.doormodel waittill("rotatedone");

self waittill("trigger");

self.doormodel rotateyaw(90,1,0.5,0.5);
self.doormodel waittill("rotatedone");
}
} 




edited on Jun. 21, 2008 05:38 pm by ahoji

edited on Jun. 21, 2008 05:41 pm by ahoji
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: CoD4 Scripting
Posted: Saturday, Jun. 21, 2008 10:21 pm
Would that not result in the player hitting the trigger to open it, then when someone returns and hits the trigger again it will slam in the face?
Share |
.Mordecai.
General Member
Since: Jan 4, 2007
Posts: 26
Last: Jul 21, 2008
[view latest posts]
Level 2
Category: CoD4 Scripting
Posted: Sunday, Jun. 22, 2008 04:55 pm
I changed what you showed me to change but the i get this error
Share |
The_Caretaker
General Member
Since: Jun 8, 2004
Posts: 11625
Last: Jul 7, 2009
[view latest posts]
Level 10
Category: CoD4 Scripting
Posted: Sunday, Jun. 22, 2008 10:24 pm
post the exact script you're using (in code tags), please.
Share |
.Mordecai.
General Member
Since: Jan 4, 2007
Posts: 26
Last: Jul 21, 2008
[view latest posts]
Level 2
Category: CoD4 Scripting
Posted: Monday, Jun. 23, 2008 07:18 pm
Code:
doortriggers = getentarray("doortrig","targetname");
for(i=0;i<doortriggers.size;i++)
doortriggers[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 rotateyaw(-90,1,0.5,0.5);
self.doormodel waittill("rotatedone");
self.doorclosed = false;
}
else
{
self.doormodel rotateyaw(90,1,0.5,0.5);
self.doormodel waittill("rotatedone");
self.doorclosed = true;
}
self.doormoving = false;
} 
Share |
ahoji
General Member
Since: May 16, 2006
Posts: 74
Last: Jun 27, 2008
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Tuesday, Jun. 24, 2008 03:45 pm
Rasta writes...
Quote:
Would that not result in the player hitting the trigger to open it, then when someone returns and hits the trigger again it will slam in the face?

nope cos of waittill function in this script

i think its the same as using door_think and door scripts, it's much easier to split one single script to two parts as using two of them (which function is only to move door opposite dirrections)
Share |
Restricted Access Topic is Locked 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

»