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

Members Online

»
0 Active | 59 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 subscribe
Author Topic: How do you Spawn with No Weapon !?
Repentant
General Member
Since: Mar 18, 2006
Posts: 23
Last: Feb 4, 2008
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Monday, Mar. 5, 2007 10:06 pm
Map type in question: Multiplayer

I simply wish to spawn in to my map with no weapons in my hands or inventory?
I would also like to by pass the weapon selection at the beginning all together, but maybe this will happen automatically if I can some how set the map, or script it, to spawn me with no weapons.

(If you want to know why I want this, just read my 'Player Size Change' post.

Thanks in advance.
Share |
codmp
General Member
Since: Feb 7, 2006
Posts: 905
Last: Aug 1, 2011
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Monday, Mar. 5, 2007 10:20 pm
You can script it.

You could something like this:
Code:

players = getentarray("player", "classname");
for(i=0; i<players.size;i++)
self.pers["weapon"] = "undefined"];
self.pers["grenadetype"] = "undefined"];





Not sure if it will work. Havent tested it.
Share |
rogue722
General Member
Since: Jan 17, 2006
Posts: 175
Last: Mar 29, 2007
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Monday, Mar. 5, 2007 10:53 pm
Well, codmp, there are a couple of things wrong with ur script that would give script compile errors. You'll have to edit some things like so:
Code:

players = getentarray("player","classname");
for(i=0;i<players.size;i++)
{
self.pers["weapon"] = "undefined";
self.pers["grenadetype"] = "undefined";
}


I don't have much experience with self.pers, so I have no idea either if this will work.

-Rogue
Share |
Xploit
General Member
Since: Jul 16, 2006
Posts: 81
Last: Apr 14, 2009
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Monday, Mar. 5, 2007 11:15 pm
In simpler terms from what was posted above (which was great info, btw), to spawn with no weapons means you would have to mod the server. Weapons available to each individual player are not dictated in the map's settings, but rather in a mod, i.e. all rifles mods or mods incorporating the panzershreck. I hope this helps.
Share |
codmp
General Member
Since: Feb 7, 2006
Posts: 905
Last: Aug 1, 2011
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Monday, Mar. 5, 2007 11:29 pm
The code i provided would make the weaon you were curently holding undefined and would make your grenades undefined making it so you have no nades.
Share |
WHC_Grassy
General Member
Since: Apr 20, 2005
Posts: 1426
Last: Aug 25, 2007
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Tuesday, Mar. 6, 2007 06:33 am
All that aside, the script is still not correct.
For instance, what has been defined as "self"? nothing, so it wont work.

This is how you link parameters to players.

Code:
players = getentarray("player","classname");
for(i=0;i<players.size;i++)
{
  players[i].pers["weapon"] = "undefined";
  players[i].pers["grenadetype"] = "undefined";
}


[thumbs_up]
Share |
Repentant
General Member
Since: Mar 18, 2006
Posts: 23
Last: Feb 4, 2008
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Tuesday, Mar. 6, 2007 06:48 pm
Thank you all, but before I can even try the code WHC_Grassy gave me, I need help!

I have made 4 maps in UO, some of which had pretty complicated scripting (well, for me). I'm not a scripter, I just copy and paste the basics of what I need then modify it to suit. But I just don't seem to be able to get even the basic script to work in CoD2, i.e. ambient sound!

I have a VERY simple test map (called test01) with working sky box and worldspawn settings. But the code below just won't give me any ambient sound, so I know it's not working?!

Code:

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

	ambientPlay("ambient_mp_brecourt");

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

	
}


I have put in WHC_Grassy's code, and weapons are still selectable. But like I said, I'm convinced the basic code isn't working in the first place to be able to test the no-weapon script.

By the way, when I do get a basic script working, do I just put WHC_Grassy's code in like this?:

Code:

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

	ambientPlay("ambient_mp_brecourt");

players = getentarray("player","classname");
for(i=0;i<players.size;i++)
{
  players[i].pers["weapon"] = "undefined";
  players[i].pers["grenadetype"] = "undefined";
}

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

	
}


I still haven’t solved the ‘all models look purple’ problem yet, which I think is something to do with compiling? But would that really make a script not work?!

(Boy, wasn’t UO so much simpler to map for!!)

Any/all help MUCH appreciated.
Share |
codmp
General Member
Since: Feb 7, 2006
Posts: 905
Last: Aug 1, 2011
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Thursday, Mar. 8, 2007 01:42 am
Tryin killing yourself after you spawn. Your weapon might become undefined then.
Share |
Sgthaarde
General Member
Since: Feb 26, 2007
Posts: 55
Last: Apr 1, 2010
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Saturday, Mar. 10, 2007 09:32 pm
You need to make the spring files self, in weapons\mp\****** can be found in merciless 2.0 or awe mods.
It includes sprinting:)
Code
Or try this...


Code:
dropweapon()
{
	if(level.scr_ss_drop==0)return;
	current = self getcurrentweapon();
	if(current != "none" && current != level.mh_sprintweapon)
		self dropItem(self getcurrentweapon());
}

init()
{
	level.mh_sprintspeed = cvardef("mh_sprint_speed",2,1,3,"int");

	if(level.mh_sprintspeed == 1)
		level.mh_sprintweapon = "sprint_slow";
	else if(level.mh_sprintspeed == 2)
		level.mh_sprintweapon = "sprint_med";
	else 
		level.mh_sprintweapon = "sprint_fast";
	

	level.mh_sprint 			= cvardef("mh_sprint",1,0,3,"int");
	if(!level.mh_sprint) return;

	level.mh_sprinttime 		= cvardef("mh_sprint_time",3,1,999,"int") * 20;
	level.mh_sprintrecovertime	= cvardef("mh_sprint_recover_time",2,0,999,"int") * 20;
	level.mh_sprinthud 		= cvardef("mh_sprint_hud",1,0,2,"int");
	level.mh_sprinthudhint 	= cvardef("mh_sprint_hud_hint",1,0,1,"int");
	level.mh_sprintheavyflag 	= cvardef("mh_sprint_heavy_flag", 0, 0, 1, "int");

	if(!isdefined(game["gamestarted"]))
	{
		if(level.mh_sprintspeed)
			precacheItem(level.mh_sprintweapon);
		else
		{
			precacheItem("sprint_fast_mp");
			precacheItem("sprint_med_mp");
			precacheItem("sprint_slow_mp");
		}

		if(level.mh_sprinthud == 1)
		{
			precacheShader("gfx/hud/hud@health_back.tga");
			precacheShader("gfx/hud/hud@health_bar.tga");
		}

		if(level.mh_sprinthud == 2)
			precacheShader("white");

		if(level.mh_sprinthudhint)
			precacheString(&"^7Hold USE [{+activate}] to sprint");
	}
}
Share |
Restricted Access Topic is Locked 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

»