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

Members Online

»
0 Active | 5 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 subscribe
Author Topic: Drowning
Spikenaylor
General Member
Since: Oct 12, 2004
Posts: 163
Last: Feb 22, 2009
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Tuesday, Nov. 7, 2006 10:30 pm
Hi there all

I had a fully working drowning and no-prone script for COD 1.

Now I need to port it to COD2

however, it doesn't work,

The line in BOLD is where I get an Script Compile Error ( Uninitilised Variable 'looper' )

Any help on what this means and how to cure it, also if anyone sees any further bugs relating to COD2 in this script, I would appreciate the heads up.

Cheers.

Like I said this worked fantastic in COD, just hope We can get it to work for COD2.




// Multiplayer drown script for CoD
//
// written by [D]delica
// based on _noprone.gsc by r0ger and the stock IW S&D scripts ;)

main()
{

drownage = getentarray("drown","targetname");
if (isDefined("drownage"))
{
precacheShader("black");
precacheShader("white");

level._effect["bubbles1"] = loadfx ("fx/bubbles.efx");

level.barsize = 288;
level.drowntime = 8;
level.hurttime = 6;

for(d = 0; d < drownage.size; d++)
{
drownage[d] thread water();
}
}
}

Water()
{
while (1)
{
self waittill("trigger", other);

if(isPlayer(other) && other istouching(self))
other thread drown(self);
}
}
drown(trigger)
{
dceiling = getent(trigger.target,"targetname");

while (self istouching(trigger) && !self istouching(dceiling))
{
wait .125;
if(isDefined(self.drowning))
return;
self.drowning = true;

if(!isDefined(self.sounder))
{
looper = spawn( "script_model", self.origin );
wait 0.025;
looper show();
looper linkto(self);
looper playLoopSound("water");
self.sounder = true;
}

level.barincrement = (level.barsize / (20.0 * level.drowntime));

if(!isDefined(self.progressbackground))
{
self.progressbackground = newClientHudElem(self);
self.progressbackground.alignX = "center";
self.progressbackground.alignY = "middle";
self.progressbackground.x = 320;
self.progressbackground.y = 385;
self.progressbackground.alpha = 0.5;
}
self.progressbackground setShader("black", (level.barsize + 4), 12);

if(!isDefined(self.progressbar))
{
self.progressbar = newClientHudElem(self);
self.progressbar.alignX = "left";
self.progressbar.alignY = "middle";
self.progressbar.x = (320 - (level.barsize / 2.0));
self.progressbar.y = 385;
}
self.progressbar setShader("white", 0, 8);
self.progressbar scaleOverTime(level.drowntime, level.barsize, 8);

self.progresstime = 0;
d = 0;
f = 0;

while(isalive(self) && self istouching(trigger) && !self istouching(dceiling) && (self.progresstime < level.drowntime))
{
d ++;
f ++;

wait 0.05;
self.progresstime += 0.05;

playfxOnTag( level._effect["bubbles1"], self, "TAG_HELMET");

rand = randomInt (9);
if (d > (30 + rand))
{
self playSound("bubble");
d = 0;
}
if(self.progresstime >= level.hurttime)
{
if(f >= 4)
{
radiusDamage(self.origin,9, 1, 1);
f = 0;
}
}
}

if(isalive(self) && self istouching(trigger) && !self istouching(dceiling) && (self.progresstime >= level.drowntime))
{
self.progressbackground destroy();
self.progressbar destroy();

wait 0.025;
radiusDamage(self.origin,22, 3000, 3000);

self.drowning = undefined;
self.sounder = undefined;

looper stopLoopSound("water");
looper delete();

randb = randomInt(4);
deathmethod1 = " made a hole in the water and lay down quietly to rest forever.";
deathmethod2 = " paid a long lasting visit to Davy Jones's Locker.";
deathmethod3 = " went diving without breathing apparatus.";
deathmethod4 = " swam like a brick.";

if (randb == 0)
iPrintLn( self.name, deathmethod1);
if (randb == 1)
iPrintLn( self.name, deathmethod2);
if (randb == 2)
iPrintLn( self.name, deathmethod3);
if (randb == 3)
iPrintLn( self.name, deathmethod4);
}
else
{
self.progressbackground destroy();
self.progressbar destroy();
looper stopLoopSound("water");
looper delete();
self.drowning = undefined;
self.sounder = undefined;
}
wait .05;
}
}
Share |
The_Caretaker
General Member
Since: Jun 8, 2004
Posts: 11625
Last: Jul 7, 2009
[view latest posts]
Level 10
Category: CoD2 Scripting
Posted: Wednesday, Nov. 8, 2006 10:02 pm
i MIGHT be mistaken... but try this line instead:

looper = spawn("script_model", (self.origin));
Share |
sharkeh
General Member
Since: Sep 24, 2006
Posts: 20
Last: Dec 1, 2006
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Wednesday, Nov. 8, 2006 11:03 pm
CoD2 requires you to explicitly declare variables and because the first instance of "looper" appears in an IF statment it's not explicit meaning it might never be defined. So just add:

looper = undifined;

at the top of the method outside the WHILE loop and that should fix that particular error.
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

»