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] |
|
|
|
|
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. |
|
|
|
rogue722 |
|
General Member Since: Jan 17, 2006 Posts: 175 Last: Mar 29, 2007 [view latest posts] |
|
|
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 |
|
|
|
Xploit |
General Member Since: Jul 16, 2006 Posts: 81 Last: Apr 14, 2009 [view latest posts] |
|
|
|
|
|
WHC_Grassy |
General Member Since: Apr 20, 2005 Posts: 1426 Last: Aug 25, 2007 [view latest posts] |
|
|
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";
}
|
|
|
|
Repentant |
General Member Since: Mar 18, 2006 Posts: 23 Last: Feb 4, 2008 [view latest posts] |
|
|
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. |
|
|
|
|
|
Sgthaarde |
|
General Member Since: Feb 26, 2007 Posts: 55 Last: Apr 1, 2010 [view latest posts] |
|
|
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");
}
} |
|
|
|