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

Members Online

»
0 Active | 102 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: A Multiplayer damage system for door blockers
WHC_Grassy
General Member
Since: Apr 20, 2005
Posts: 1426
Last: Aug 25, 2007
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Wednesday, Dec. 27, 2006 12:51 pm
Howdy folks!

I thought this would make a nice addition to your maps that have doors or areas where players can cause trouble by blocking them.

It's hot off my keyboard tonight! [thumbs_up]
All the info you need is at the top of the script.

Enjoy! and Merry Christmas to you all..
Grassy

PS, sorry it's not in a Code Box, the forum was adding heaps
of rubbish to the code. So it's lost the nice indents I had in there.. [banghead]

Quote:

//------------------------------------------------------------------------------
//
// Damage control for Cod/Uo/Cod2 Multi Player
// by <|WHC|>Grassy
// Version 2
// Updated December 27, 2006
//
//
// Usefull for controlling players who like to block
// doorways or other scripted events.
//
// Place trigger_multiples in these areas, as many as you need
// Give them all a KEY: targetname with a VALUE: dmg
//
// To set a delay use a KEY: script_delay and VALUE: XX
// where XX is any whole number you want as your delay before the player
// begins to take damage.
// Default delay if not set on the trigger is 5 seconds.
//
// This new version can now handle different Damage levels for each trigger.
// To set a damage level set a KEY: script_dmg and VALUE: XX
// where XX is any whole number for the level of damage inflicted
// on the player while in the trigger after the delay has been reached.
// Default damage level if not set is 10.
//
// This has been tested in Cod1 and UO but not Cod2
// If you find this script fails in Cod2 then it's more than
// likely the sound command line is the problem, to fix this
// change the sound alias to some other generic "tick" type of
// sound that Cod2 loads by default.
//
// I don't have Cod2 anyore so if someone wants to make this
// compatable then feel free to go ahead with it.
//
//
// To load, usual procedure. Place this script in maps/mp/ and call it damage_control.gsc
// Then add this line to your maps .gsc file.
// maps\mp\damage_control::main();
//
// I hope you find this little utility usefull, if you have problems you
// can get me on Xfire with username of grassy or drop into
// my clan website www.whcclan.com and leave me a msg there.
//
// Regards Grassy
//
//----------------------------------------------------------------------------------


main()
{
//collect delayed hurt triggers
ent = getentarray("dmg","targetname");

if(isdefined(ent))
{
for(d = 0 ; d < ent.size ; d ++)
{

//If a delay is defined use that - otherwise set it to 5
if(isdefined(ent[d].script_delay))
{
delay = ent[d].script_delay;
}
else
{
delay = 5;
}

//If damage level is defined use that - otherwise set it to 10
if(isdefined(ent[d].script_dmg))
{
dmg = ent[d].script_dmg;
}
else
{
dmg = 10;
}

ent[d] thread damage_handler(delay,dmg);
}
}
}

//-----------------------end of main-----------------------


damage_handler(delay,dmg)
{
for(;;)
{
counter = 0;
self waittill("trigger",other);

other iprintlnbold("^3*Warning* you will take damage in ^7" + delay + " seconds" + " ^3if you stay here.");

// loop until done killing player or dump out if:
// 1: Not touching the trigger anymore
// 2: not alive
// 3: You are a spectator

while(other istouching(self)
&& isAlive(other)
&& other.sessionstate != "spectator")
{
wait 1;
counter++;
other playsound("minefield_click"); // <---- this may need to be edited for Cod2!

if(counter >= delay)
{
//dmg = 10;
other.health -= dmg;

if(other.health == 50)
other iprintlnbold("^3Move or you will die!");

other viewkick(96, other.origin);
other shellshock("default_mp", 1);

if(other.health <= 0)
{
other suicide();
iprintln ("^1SERVER MESSAGE: ^7" + other.name + " ^1was punished for blocking.");
other.sessionstate = "dead";
}
}
}
wait(1);
}
}

Share |
Mystic
General Member
Since: Apr 10, 2004
Posts: 6147
Last: Apr 15, 2018
[view latest posts]
Level 10
Forum Moderator
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Wednesday, Dec. 27, 2006 03:12 pm
Nice work buddy. I have stickied it untill an admin can lay there mits on it :)
Share |
WHC_Grassy
General Member
Since: Apr 20, 2005
Posts: 1426
Last: Aug 25, 2007
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Wednesday, Dec. 27, 2006 10:45 pm
Cheers Rasta old pal [thumbs_up]
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Wednesday, Jul. 18, 2007 11:27 pm
nice work

i think it would be better for the gameplay if doors would push the player away instead of lowering health...
Share |
securiity
General Member
Since: Jan 11, 2009
Posts: 63
Last: May 31, 2009
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Sunday, May. 17, 2009 01:25 pm
nice work.

Agreed Stevens.
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Sunday, May. 17, 2009 01:52 pm
you just bumped a two years old thread lol
Share |
lineage2soul
General Member
Since: Oct 25, 2010
Posts: 24
Last: Nov 8, 2010
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Saturday, Oct. 30, 2010 09:56 am
Its able to make bug demage trigger?
i have all killtriggers but i think its batter if player don't die but get hurt.
if any1 know then PM me.
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: Saturday, Oct. 30, 2010 03:01 pm
it does exactly what your asking for... it does 10 damage to the players health even does a nice view kick wich is a nice idea then when your health is 0... you die and it says to everyone you were punished for blocking da da da.
Share |
lineage2soul
General Member
Since: Oct 25, 2010
Posts: 24
Last: Nov 8, 2010
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Saturday, Oct. 30, 2010 03:42 pm
I get Error when i make thread demagehandler(delay,dmg);
this is my script:
main()
{
thread kill();
thread ir();
thread timeupdate();
thread demagehandler(delay,dmg);

//collect delayed hurt triggers
ent = getentarray("dmg","targetname");

if(isdefined(ent))
{
for(d = 0 ; d < ent.size ; d ++)
{

//If a delay is defined use that - otherwise set it to 5
if(isdefined(ent[d].script_delay))
{
delay = ent[d].script_delay;
}
else
{
delay = 5;
}

//If damage level is defined use that - otherwise set it to 10
if(isdefined(ent[d].script_dmg))
{
dmg = ent[d].script_dmg;
}
else
{
dmg = 10;
}

ent[d] thread damage_handler(delay,dmg);
}
}
}

damage_handler(delay,dmg)
{
for(;;)
{
counter = 0;
self waittill("trigger",other);

other iprintlnbold("^3*Warning* you will take damage in ^7" + delay + " seconds" + " ^3if you stay here.");

// loop until done killing player or dump out if:
// 1: Not touching the trigger anymore
// 2: not alive
// 3: You are a spectator

while(other istouching(self)
&& isAlive(other)
&& other.sessionstate != "spectator")
{
wait 1;
counter++;
other playsound("minefield_click"); // <---- this may need to be edited for Cod2!

if(counter >= delay)
{
//dmg = 10;
other.health -= dmg;

if(other.health == 50)
other iprintlnbold("^3Move or you will die!");

other viewkick(96, other.origin);
other shellshock("default_mp", 1);

if(other.health <= 0)
{
other suicide();
iprintln ("^1SERVER MESSAGE: ^7" + other.name + " ^1was punished for blocking.");
other.sessionstate = "dead";
}
}
}
wait(1);
}
}
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: Saturday, Oct. 30, 2010 04:27 pm
you need to find a scripting 101 tut or somthing because we cant hold your hand threw the tinnyist things your problem is ur threading demagehandler(delay,dmg); when delay or dmg is not even defined yet and and why are u threading demagehandler(delay,dmg); anyways its already being threaded in that script for you and its damage not demage by the way...
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

»