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

Members Online

»
0 Active | 10 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 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
Next Page
subscribe
Author Topic: MP gametype mod: set "axis" VIP model as "ally" model
ODAWA
General Member
Since: Jan 3, 2011
Posts: 18
Last: May 6, 2012
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Sunday, Jan. 9, 2011 03:41 pm
Hi there, I am looking for help with the following:
I am modding the VIP gametype to become my own SPY/TRAITOR gametype. More details here: http://dbtactical.clanservers.com/Forums/index.php/topic,1136.msg6504.html%23msg6504

First feature to change is:
setting the "axis" VIP model to spawn as "ally" model

I have had no success yet, only ever get "script compile error". However here are several scripts I've attempted.

Attempt 1:
In my first week of learning script, I tried only changing the teams.gsc file like this:

Code:
model()
{
	self detachAll();
	
	if((self.pers["team"] == "allies") && (self IsVIP ()))
		[[game["axis_model"] ]]();
	else if((self.pers["team"] == "allies") ! (self IsVIP ()))
		[[game["allies_model"] ]]();
	else if((self.pers["team"] == "axis") && (self IsVIP ()))
		[[game["allies_model"] ]]();
	else if((self.pers["team"] == "axis") ! (self IsVIP ()))
		[[game["axis_model"] ]]();

	self.pers["savedmodel"] = maps\mp\_utility::saveModel();
}


The problem I suspect is that the definition (self isVIP) is only defined within the vip.gsc file NOT the teams.gsc file. Therefore my script didn't make sense. So i reverted the teams.gsc file and moved on to try a different way.


Attempt 2:
Reverting the teams.gsc file to unmodified, and changing the vip.gsc file like this:


Code:
spawnPlayer()
{
	self endon("disconnect");
	self notify("spawned");
	self notify("end_respawn");

	team = self.pers["team"];
	
	resettimeout();

	// Stop shellshock and rumble
	self stopShellshock();
	self stoprumble("damage_heavy");

	self.sessionteam = team;
	self.sessionstate = "playing";
	self.spectatorclient = -1;
	self.archivetime = 0;
	self.psoffsettime = 0;

	if (self IsVIP ())
	{
		setvipteammodels();
	}



That part of the code continues on like a usual vip.gsc file, but then later it defines:


Code:
setVIPteamModels()
{
	switch(game["allies"])
	{
		case (isdefined(self IsVIP () && "british"):
			if((isdefined(game["british_soldiertype"]) && game["british_soldiertype"] == "africa")) && (self IsVIP ())
			{
				mptype\british_africa::precache();
				game["vipaxis_model"] = mptype\german_africa::main;
			}
			else
			{
				mptype\british_normandy::precache();
				game["vipaxis_model"] = mptype\german_normandy::main;
			}
			break;
	
		case (isdefined(self IsVIP () && "russian"):
			if(isdefined(game["russian_soldiertype"]) && game["russian_soldiertype"] == "padded") && (self IsVIP ())
			{
				mptype\russian_padded::precache();
				game["vipaxis_model"] = mptype\german_winterdark::main;
			}
			else
			{
				mptype\russian_coat::precache();
				game["vipaxis_model"] = mptype\german_winterlight::main;
			}
			break;
	
		case (isdefined(self IsVIP () && "american"):
		default:
			mptype\american_normandy::precache();
			game["vipaxis_model"] = mptype\german_normandy::main;
	}
	
	if((isdefined(game["german_soldiertype"]) && game["german_soldiertype"] == "winterdark") && (self IsVIP ())
	{
		mptype\german_winterdark::precache();
		game["vipallies_model"] = mptype\russian_padded::main;
	}
	else if((isdefined(game["german_soldiertype"]) && game["german_soldiertype"] == "winterlight") && (self IsVIP ())
	{
		mptype\german_winterlight::precache();
		game["vipallies_model"] = mptype\russian_coat::main;
	}
	else if((isdefined(game["german_soldiertype"]) && game["german_soldiertype"] == "africa") && (self IsVIP ())
	{
		mptype\german_africa::precache();
		game["vipallies_model"] = mptype\british_africa::main;
	}
	else if(((isdefined(game["german_soldiertype"]) && game["german_soldiertype"] == "normandy") && (self IsVIP ()) && ((enemyteam = "allies") && ("allies" = "british"))
	{
		mptype\german_normandy::precache();
		game["vipallies_model"] = mptype\british_normandy::main;	
	}
	else if(((isdefined(game["german_soldiertype"]) && game["german_soldiertype"] == "normandy") && (self IsVIP ()) && ((enemyteam = "allies") && ("allies" = "american"))
	{
		mptype\german_normandy::precache();
		game["vipallies_model"] = mptype\american_normandy::main;	
	}
	return;
}

//Defining unique class of VIP on Axis vs. Allies team
vipmodel()
{
	self detachAll();
	
	if((self.pers["team"] == "allies") && (self IsVIP ())
		[[game["vipallies_model"] ]]();
	else if((self.pers["team"] == "axis") && (self IsVIP ())
		[[game["vipaxis_model"] ]]();

	self.pers["savedmodel"] = maps\mp\_utility::saveModel();
}


Attempt/idea 3:
Another idea I have is modding the mptype models. For example, in addition to the mptype\british_africa.gsc file I will have a custom mptype\VIP_british_africa.gsc file which inside will point to loading the mptype\german_africa.gsc file.

Then in the vip.gsc file:
*** I would have to precachemodel for these custom models. I don't know how to write that.
*** I would have state that if player IsVIP set VIPmodel. I don't really know where/how to define VIPmodel. Any ideas? Maybe this is similar to defining the pistol used by VIP players.


edited on Jan. 9, 2011 10:44 am by ODAWA

edited on Jan. 9, 2011 01:04 pm by ODAWA
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: Sunday, Jan. 9, 2011 03:58 pm
i think somthing more simple like this would work.

Code:

spawnPlayer()
{
	self endon("disconnect");
	self notify("spawned");
	self notify("end_respawn");

	team = self.pers["team"];
	
	resettimeout();

	// Stop shellshock and rumble
	self stopShellshock();
	self stoprumble("damage_heavy");

	self.sessionteam = team;
	self.sessionstate = "playing";
	self.spectatorclient = -1;
	self.archivetime = 0;
	self.psoffsettime = 0;

	if(self IsVIP ())
	{
		wait 0.05;
		game["axis_model"] = mptype\american_normandy::main;
	}



im also assuming that self IsVIP() actually means somthing as well.
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Sunday, Jan. 9, 2011 04:09 pm
Just add this line to the start of teams.gsc:
Code:

#include maps\mp\gametypes\vip.gsc;


Or somthing like it.
Then IsVip() will be a known function
Share |
ODAWA
General Member
Since: Jan 3, 2011
Posts: 18
Last: May 6, 2012
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Sunday, Jan. 9, 2011 04:22 pm
duplicate post
Share |
ODAWA
General Member
Since: Jan 3, 2011
Posts: 18
Last: May 6, 2012
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Sunday, Jan. 9, 2011 04:24 pm
duplicate post
Share |
ODAWA
General Member
Since: Jan 3, 2011
Posts: 18
Last: May 6, 2012
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Sunday, Jan. 9, 2011 04:25 pm
duplicate post
Share |
ODAWA
General Member
Since: Jan 3, 2011
Posts: 18
Last: May 6, 2012
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Sunday, Jan. 9, 2011 04:27 pm
Wow you guys are fast at replying. I'll try this asap.

regarding the definition "IsVIP" - that is already defined in the vip.gsc file.

But what if I want to define something else, totally new but based on existing models etc. How do I do that?


For example, in the original unmodified vip.gsc file they use a definition "level.vippistol":

Code:
if ((self IsVIP ()) && level.vippistol)
	{
		pistol = level.vip_pistol[game[team]];
		self giveWeapon (pistol);
		self giveMaxAmmo (pistol);
		self setSpawnWeapon (pistol);
	}
	else
	{
		maps\mp\gametypes\_weapons::givePistol ();

		// Bug tracking...
	
		if ((! maps\mp\gametypes\_weapons::isMainWeapon (self.pers["weapon"])) && (! maps\mp\gametypes\_weapons::isPistol (self.pers["weapon"])))
			logprint ("DEBUG : spawnPlayer () self.pers[\"weapon\"] = \"" + self.pers["weapon"] + "\"\n");
		else
		{
			self giveWeapon (self.pers["weapon"]);
			self giveMaxAmmo (self.pers["weapon"]);
			self setSpawnWeapon (self.pers["weapon"]);
		}
	}


and then later in vip.gsc they say:

Code:

	level.vip_pistol["american"] = "colt_vip_mp";
	level.vip_pistol["british"] = "webley_vip_mp";
	level.vip_pistol["russian"] = "tt30_vip_mp";
	level.vip_pistol["german"] = "luger_vip_mp";

	if (level.vippistol)
	{
		precacheItem (level.vip_pistol[game["allies"]]);
		precacheItem (level.vip_pistol[game["axis"]]);

// EXT ->
/*
		normal_pistol = getSubstr (level.vip_pistol[game["allies"]], 0, level.vip_pistol[game["allies"]].size - 7) + "_mp";
		level.weapons[level.vip_pistol[game["allies"]]] = spawnstruct ();
		level.weapons[level.vip_pistol[game["allies"]]].server_allowcvar = "";
		level.weapons[level.vip_pistol[game["allies"]]].client_allowcvar = "";
		level.weapons[level.vip_pistol[game["allies"]]].allow_default = 0;
		level.weapons[level.vip_pistol[game["allies"]]].classname = "pistol";
		level.weapons[level.vip_pistol[game["allies"]]].team = "allies";
		level.weapons[level.vip_pistol[game["allies"]]].limit = 0;
		level.weapons[level.vip_pistol[game["allies"]]].ammo_limit = level.weapons[normal_pistol].ammo_limit * 5;

		normal_pistol = getSubstr (level.vip_pistol[game["axis"]], 0, level.vip_pistol[game["axis"]].size - 7) + "_mp";
		level.weapons[level.vip_pistol[game["axis"]]] = spawnstruct ();
		level.weapons[level.vip_pistol[game["axis"]]].server_allowcvar = "";
		level.weapons[level.vip_pistol[game["axis"]]].client_allowcvar = "";
		level.weapons[level.vip_pistol[game["axis"]]].allow_default = 0;
		level.weapons[level.vip_pistol[game["axis"]]].classname = "pistol";
		level.weapons[level.vip_pistol[game["axis"]]].team = "axis";
		level.weapons[level.vip_pistol[game["axis"]]].limit = 0;
		level.weapons[level.vip_pistol[game["axis"]]].ammo_limit = level.weapons[normal_pistol].ammo_limit * 5;
*/
// EXT <-
	}


What's going on there? I ask because I'd like to mod it to define a new "level.vipmodel". Anyway I'll try what you guys already suggested.


Instead of starting a new thread topic:
If those methods work, the next mod feature I want to implement is:
- spawning the axis VIP player with the enemy ally team.

In scripts I've seen "spawnnearteam" but I never see "spawnnearenemy". I've read that spawn points are created based on where your friends and enemies are, so how do I tell a friendly VIP player to always spawn within the enemy team spawn?


edited on Jan. 9, 2011 11:27 am by ODAWA
Share |
ODAWA
General Member
Since: Jan 3, 2011
Posts: 18
Last: May 6, 2012
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Sunday, Jan. 9, 2011 04:43 pm
liltc64 writes...
Quote:
i think somthing more simple like this would work.

Code:

spawnPlayer()
{
	self endon("disconnect");
	self notify("spawned");
	self notify("end_respawn");

	team = self.pers["team"];
	
	resettimeout();

	// Stop shellshock and rumble
	self stopShellshock();
	self stoprumble("damage_heavy");

	self.sessionteam = team;
	self.sessionstate = "playing";
	self.spectatorclient = -1;
	self.archivetime = 0;
	self.psoffsettime = 0;

	if(self IsVIP ())
	{
		wait 0.05;
		game["axis_model"] = mptype\american_normandy::main;
	}



im also assuming that self IsVIP() actually means somthing as well.


What would you type if you wanted:
axis VIP to look like ally team
and
ally VIP to look like axis team

Thanks for the great help.
Share |
ODAWA
General Member
Since: Jan 3, 2011
Posts: 18
Last: May 6, 2012
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Sunday, Jan. 9, 2011 06:06 pm
Added to first post:
More details here: http://dbtactical.clanservers.com/Forums/index.php/topic,1136.msg6504.html%23msg6504
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: Monday, Jan. 10, 2011 04:29 am
well first of all you need to find out who the axis VIP is. idk if you have made a script for that yet but what i suggest you do is get an array of all the players, then seperate the axis and allies from each other and then from there use the randomInt func to get a random player from axis and allies to be the VIP.

Share |
Restricted Access Topic is Locked
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

»