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

Members Online

»
0 Active | 52 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
Page
Previous Page Next Page
subscribe
Author Topic: mapping
serthy
General Member
Since: Sep 8, 2010
Posts: 482
Last: Jun 28, 2013
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Tuesday, Aug. 16, 2011 01:31 pm
with self getGuid() : guid = 0123456 (7 chars)
this can be used via script

with /pb_myguid: guid = 039efd8d (8 chars i think)
this can't be used by script

Share |
liltc64
General Member
Since: Feb 12, 2007
Posts: 906
Last: Oct 22, 2012
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Tuesday, Aug. 16, 2011 03:38 pm
and what iznogod means by its a number that means you do not put " " around your numbers. if you do guid = "836532"; that means you are making those numbers a string not an int, when you're dealing with ints do not put " " around them.
Share |
Tally
General Member
Since: Apr 21, 2005
Posts: 819
Last: Oct 26, 2012
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Tuesday, Aug. 16, 2011 04:33 pm
explo32 writes...
Quote:
I made simple multiplayer map with wall and trigger_use_touch on it and compiled it. Then I made a gsc file:
Quote:

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

ambientPlay("ambient_france");

game["allies"] = "american";
game["axis"] = "german";
game["attackers"] = "allies";
game["defenders"] = "axis";
game["american_soldiertype"] = "normandy";
game["german_soldiertype"] = "normandy";


maps\mp\_guid::main();

}


and put the script in another file:

Quote:
main()
{
privateguid = d88108d8; // <----- make any guid you want.
thread cool(privateguid);
}

cool(pguid)
{
wall = getent("rawr","targetname");
walltrig = getent("rawrtrig","targetname");

while(1)
{
walltrig waittill("trigger", player);

checkguid = player getGuid();

if(checkguid == pguid)
{
wall hide();
wall notsolid();
wait 2;
wall show();
wall solid();
}
}
}


After I launched the map I got this error:

******* script compile error *******
uninitialised variable 'd88108d8': (file 'maps/mp/_guid.gsc', line 3)
privateguid = d88108d8; // <----- make any guid you want.
*


Then I changed the line
Quote:
privateguid = d88108d8; // <----- make any guid you want.

to
Quote:
privateguid = "d88108d8"; // <----- make any guid you want.


And now after I launch my map and I walk to the trigger I get this:


so it must be problem with this line:
Quote:
walltrig waittill("trigger", player);


edited on Aug. 16, 2011 07:06 am by explo32
After opening console I can see these errors repeating all the time:
http://img829.imageshack.us/img829/74/plikm.jpg


The "variable is undefined" is probably caused by a timing issue - you are not giving the game enough time to set things up. Always put a wait time in a function if the function is being called before callback_startgametype has been completed.

This will probably get rid of the "variable is undefined" error:

Code:
main()
{
	wait( 0.65 );
	
	thread cool( d88108d8 );
}

cool( pguid )
{
	wall = getent( "rawr","targetname" );
	walltrig = getent( "rawrtrig","targetname" );
	
	if( isDefined( wall ) && isDefined( walltrig ) )
	{
		while( true )
		{
			walltrig waittill( "trigger", player );
			
			if( isPlayer( player ) )
			{
				if( player getGuid() == pguid )
				{
					wall hide();
					wall notsolid();
					wait( 10 );
					wall show();
					wall solid();
				}
			}
		}
	}
}


NOTE 1: I think 2 seconds isn't enough time for a player to walk through an object. So, I gave the wait time 10 seconds instead.

NOTE 2: I still don't think this will work because the use of notsolid() in COD2 is restricted to certain clip brushes. Unless you have used the right one in your map, notsolid() will be useless. In COD4, notsolid() works on any script_brushmodel.
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Tuesday, Aug. 16, 2011 06:59 pm
No.
When you use characters (non-numbers) in a value, you have to put "" around them, so the engine correctly identifies them as being a string. If you dont, the engine assumes the said set of characters is a variable. If you want something to be equal to said variable, you need to set it first.

Share |
explo32
General Member
Since: May 8, 2008
Posts: 67
Last: Jan 7, 2015
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Tuesday, Aug. 16, 2011 08:00 pm
What is the difference between "normal" guid and pbguid and how to check it?

Share |
serthy
General Member
Since: Sep 8, 2010
Posts: 482
Last: Jun 28, 2013
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Tuesday, Aug. 16, 2011 08:27 pm
normal guid?

there are only 2 different ones (like i mentioned before)

1st one: guid = player getGuid(); returns either a 7 char number like 0123456 or 0 (this guid can used by a script)

2nd one: /pb_myguid does not return anything, it only prints you your pb-guid in the console (8 char string like 0s0qm1b3) and cant be used per script

you can use something on a dedicated server like

isAdmin = ( self getGuid() == getCvarInt( "admin_guid" ) );
this returns true if your guid matches the adminguid

and in your server.cfg set admin_guid 0123345 (own guid)
Share |
BraX
General Member
Since: Apr 29, 2008
Posts: 413
Last: May 26, 2012
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Wednesday, Aug. 17, 2011 01:07 am
I don't get why most peoples say that you need another GSC to add new function (like in idea with _guid.gsc). It all could be done in one script and three simple functions.

Code:
main()
{
	maps\mp\_load::main();

	ambientPlay("ambient_france");

	game["allies"] = "american";
	game["axis"] = "german";
	game["attackers"] = "allies";
	game["defenders"] = "axis";
	game["american_soldiertype"] = "normandy";
	game["german_soldiertype"] = "normandy";


	thread adminStuff();
}


adminStuff()
{
	admins = getDvar( "sv_admins" ); // GUID1,GUID2,GUID3,GUID4 etc...

	if( admins == "" )
		return;
	
	admins = toLower( admins );
	thread wall();

	while( 1 )
	{
		level waittill( "connected", player );

		if( isSubStr( admins, player getGuid() ) )
			player.isAdmin = true;
		else
			player.isAdmin = false;
	}

}

wall()
{
	wall = getent("rawr","targetname");
	walltrig = getent("rawrtrig","targetname");
	while(1)
	{
		walltrig waittill( "trigger", player );

		if( !player.isAdmin )
			continue;

		wall hide();
		wall notsolid();
		wait 2;
		wall show();
		wall solid();
	}
}



Oh.. i forgot to mention one thing... Creating forum thread called "mapping" which is about scripting is stupid.
Now feel free to click button called "SOLVED".
Share |
explo32
General Member
Since: May 8, 2008
Posts: 67
Last: Jan 7, 2015
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Wednesday, Aug. 17, 2011 10:18 am
It's not my topic. The first post belongs to a person with nick "NoNam3" and he seems not to be active any longer.
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Wednesday, Aug. 17, 2011 10:48 am
BraX writes...
Quote:
I don't get why most peoples say that you need another GSC to add new function (like in idea with _guid.gsc). It all could be done in one script and three simple functions.

Code:
main()
{
	maps\mp\_load::main();

	ambientPlay("ambient_france");

	game["allies"] = "american";
	game["axis"] = "german";
	game["attackers"] = "allies";
	game["defenders"] = "axis";
	game["american_soldiertype"] = "normandy";
	game["german_soldiertype"] = "normandy";


	thread adminStuff();
}


adminStuff()
{
	admins = getDvar( "sv_admins" ); // GUID1,GUID2,GUID3,GUID4 etc...

	if( admins == "" )
		return;
	
	admins = toLower( admins );
	thread wall();

	while( 1 )
	{
		level waittill( "connected", player );

		if( isSubStr( admins, player getGuid() ) )
			player.isAdmin = true;
		else
			player.isAdmin = false;
	}

}

wall()
{
	wall = getent("rawr","targetname");
	walltrig = getent("rawrtrig","targetname");
	while(1)
	{
		walltrig waittill( "trigger", player );

		if( !player.isAdmin )
			continue;

		wall hide();
		wall notsolid();
		wait 2;
		wall show();
		wall solid();
	}
}



Oh.. i forgot to mention one thing... Creating forum thread called "mapping" which is about scripting is stupid.
Now feel free to click button called "SOLVED".


Please, use strtok instead of issubstr().
Also, issubstr doesnt work on getguid(), as it is comparing numbers with a string.
Share |
Tally
General Member
Since: Apr 21, 2005
Posts: 819
Last: Oct 26, 2012
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Wednesday, Aug. 17, 2011 12:19 pm
IzNoGoD writes...
Quote:

Please, use strtok instead of issubstr().
Also, issubstr doesnt work on getguid(), as it is comparing numbers with a string.


No, not true. If you don't believe me, check out Openwarfare mod for COD4 _advancedacp.gsc where isSubStr() is used to check a Dvar containing admin GUIDs against self getGuid(). It works fine.
Share |
Restricted Access Topic is Locked
Page
Previous Page Next Page
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

»