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

Members Online

»
0 Active | 46 Guests
Online:

LATEST FORUM THREADS

»
Medal Of Honor
CoD4 SP Mapping
Deleting enemy corpses
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 MP Mapping
CoD 2 mapping and level design.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Restricted Access subscribe
Author Topic: help with this script please
cybershot
General Member
Since: Dec 28, 2005
Posts: 943
Last: Sep 30, 2016
[view latest posts]
Level 7
Category: CoD2 MP Mapping
Posted: Tuesday, Apr. 17, 2007 10:17 pm
I am using this script to create an effect. i got it working well. and it's going to work for me. the problem is that i need it to not kill the player when the time runs out. can someone fix it so that it won't kill the player.

Code:
main()
{ drownage = getentarray("drown","targetname");
if (isDefined("drownage"))
{
precacheShader("black");
precacheShader("white"); level.barsize = 288;
level.drowntime = 3;
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");
water_vision = undefined;
while (self istouching(trigger) && !self istouching(dceiling))
{
wait .125;
if(isDefined(self.drowning))
return; 
self.drowning = true; if(!isDefined(water_vision))
{
water_vision = newClientHudElem(self);
water_vision.x = 0;
water_vision.y = 0;
water_vision setshader ("white", 640, 480);
water_vision.alignX = "left";
water_vision.alignY = "top";
water_vision.horzAlign = "fullscreen";
water_vision.vertAlign = "fullscreen";
water_vision.color = (.16, .38, .5);
water_vision.alpha = .75;
}
level.barincrement = (level.barsize / (20.0 * level.drowntime));
// level.player allowProne(false);
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), 14); 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;
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; 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);
wait .05;
water_vision destroy();
}
else
{
water_vision.alpha = .5;
water_vision fadeOverTime(3);
water_vision.alpha = 0;
wait 0.05;
self.progressbackground destroy();
self.progressbar destroy();
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 MP Mapping
Posted: Wednesday, Apr. 18, 2007 09:31 am
What does the script do now?

Kill the player immediately when the time is up?
Continue to damage the player after the time has passed?
Share |
cybershot
General Member
Since: Dec 28, 2005
Posts: 943
Last: Sep 30, 2016
[view latest posts]
Level 7
Category: CoD2 MP Mapping
Posted: Wednesday, Apr. 18, 2007 05:51 pm
The script is from the drowning tutorial. i changed the times so that the player doesn't die. i found a setting that does work. what it does now is just turn the screen blue like if you were under water and it gives the progress bar at the bottom of the screen. so when the progress bar hits the end, the player is transported. but the script still has the ability to kill the player. i just want to take that ability out so there won't be any accidents.
Share |
The_Caretaker
General Member
Since: Jun 8, 2004
Posts: 11625
Last: Jul 7, 2009
[view latest posts]
Level 10
Category: CoD2 MP Mapping
Posted: Thursday, Apr. 19, 2007 12:41 am
you could make it so it check the health of the player before doing the damage.. if the players health is less than the damage done by the drowning, increase it.

edit: sorry, had to shut down my computer :p

make it something like this:

if self.health < 10 player.health = 10;
radiusDamage(self.origin,9, 1, 1);

that way, though the damage gets dealt it will never be lethal, because of the slight in health before the damage ensures there is always at least 1 health left after dealing the damage.


edited on Apr. 19, 2007 03:53 am by The_Caretaker
Share |
cybershot
General Member
Since: Dec 28, 2005
Posts: 943
Last: Sep 30, 2016
[view latest posts]
Level 7
Category: CoD2 MP Mapping
Posted: Thursday, Apr. 19, 2007 07:00 am
ok, thanks. i will look into it.
Share |
Restricted Access Restricted Access subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 MP Mapping

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

»