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

Members Online

»
0 Active | 51 Guests
Online:

LATEST FORUM THREADS

»
SOF2 Prefabs map
SoFII Mapping
coduo mapping tools
CoDUO Mapping
Gaming
Q4 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
Page
Next Page
subscribe
Author Topic: Script DMG
Moczulak
General Member
Since: Mar 30, 2009
Posts: 77
Last: Apr 8, 2013
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Monday, Mar. 26, 2012 06:35 am
Someone know can how write script on DMG?

The problem is that I can not write such a script that does 1 damage, and so to zero until the player dies.


Code:

	players = getentarray("player", "classname");

	for(i = 0; i < players.size; i++)			
	{
		if(( !isAlive(players[i]) || players[i].pers["team"] == "allies" )) continue;

		if((distance(self.origin, players[i].origin)) < 600)
		{
			players[i] (action example)
		}
	}


If a player enters into "distance <600" it takes 1 damage, and so to zero until the player dies.

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: Monday, Mar. 26, 2012 06:52 am
i dont understand how you can "write" that out but not even know a built in func for cod2? obv your not writing these is which im pointing out but go into your "Call of Duty 2" folder then go into the "Docs" folder and should be a little file thingy ma bobber called "CoD2_Tools_Documentation.htm" in there you can find almost every stock function you need for cod2.
Share |
Moczulak
General Member
Since: Mar 30, 2009
Posts: 77
Last: Apr 8, 2013
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Monday, Mar. 26, 2012 07:46 am
I do not know how to do that 1 dmg, down to zero so that the player died.
You understand me?

Code:
for(i = 0; i < players.size; i++)			
{
	if(( !isAlive(players[i]) || players[i].pers["team"] == "allies" )) continue;

	if((distance(self.origin, players[i].origin)) < 600)
	{
		for(;;)
		{
			level.dmg = 1;
			self.health -= level.dmg;
			iDamage = level.dmg;
		}
	}
}


I did something like that but i dont know this or is works..
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Monday, Mar. 26, 2012 07:58 am
defining a global var inside of a loop, which is in a loop is definately bad scripting...

Code:

monitor_dist_hurt()
{
    level endon ( "game_ended" );
    
    for(;;)
    {
        for(i = 0; i < players.size; i++)			
        {
            player = players[i];

            if (( !isAlive(player) || player.pers["team"] == "allies" ))
                continue;

            if (distance(self.origin, player.origin) < 600)
            {
                player.health -= 1;
                if (player.health <= 0)
                    player suicide();
            }
        }
        wait 0.2; // throttle, you may increase it
    }
}


call this as thread, like thread monitor_dist_hurt();

dunno if you really need to kill the player or if he will die anyway once he reached 0 health. In the above code, it will kill him for sure. But you may have to set the start health on game/round start.

edited on Mar. 26, 2012 08:10 am by Sevenz
Share |
Moczulak
General Member
Since: Mar 30, 2009
Posts: 77
Last: Apr 8, 2013
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Monday, Mar. 26, 2012 11:30 am
Well, you know what I mean.
I prepared a script:

Code:
sq_acidDmg(eAttacker, targetPos)
{
	self endon("killTheFlame");

	wait 2.5;
	self.burnedout = true;

	if (isPlayer(self) && isAlive(self))
	{
		self.health -= 1;
			
		if (!isDefined(self.burnedout) && self.health <= 0)
		{
			self.burnedout Destroy();
			self suicide();
		}
	}
	return;
}


How to fix it to work?
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: Monday, Mar. 26, 2012 07:03 pm
Damian17 writes...
Quote:
Well, you know what I mean.
I prepared a script:

Code:
sq_acidDmg(eAttacker, targetPos)
{
	self endon("killTheFlame");

	wait 2.5;
	self.burnedout = true;

	if (isPlayer(self) && isAlive(self))
	{
		self.health -= 1;
			
		if (!isDefined(self.burnedout) && self.health <= 0)
		{
			self.burnedout Destroy();
			self suicide();
		}
	}
	return;
}


How to fix it to work?


nothings wrong... learn the codes you post -.- you must be calling that thread wrong or something other then that shouldnt be no problems.
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Tuesday, Mar. 27, 2012 12:59 am
liltc64 writes...
Quote:
Damian17 writes...
Quote:
Well, you know what I mean.
I prepared a script:

Code:
sq_acidDmg(eAttacker, targetPos)
{
	self endon("killTheFlame");

	wait 2.5;
	self.burnedout = true;

	if (isPlayer(self) && isAlive(self))
	{
		self.health -= 1;
			
		if (!isDefined(self.burnedout) && self.health <= 0)
		{
			self.burnedout Destroy();
			self suicide();
		}
	}
	return;
}


How to fix it to work?


nothings wrong... learn the codes you post -.- you must be calling that thread wrong or something other then that shouldnt be no problems.


Missing a loop and no way that you can do the suicide() due to self.burnedout always being defined.

Def something wrong.

edited on Mar. 27, 2012 01:40 am by IzNoGoD

Edit: just re-read it: You are trying to destroy a boolean? wtf.
Share |
BraX
General Member
Since: Apr 29, 2008
Posts: 413
Last: May 26, 2012
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Tuesday, Mar. 27, 2012 01:12 am
liltc64 writes...
Quote:
Damian17 writes...
Quote:
Well, you know what I mean.
I prepared a script:

Code:
sq_acidDmg(eAttacker, targetPos)
{
	self endon("killTheFlame");

	wait 2.5;
	self.burnedout = true;

	if (isPlayer(self) && isAlive(self))
	{
		self.health -= 1;
			
		if (!isDefined(self.burnedout) && self.health <= 0)
		{
			self.burnedout Destroy();
			self suicide();
		}
	}
	return;
}


How to fix it to work?


nothings wrong... learn the codes you post -.- you must be calling that thread wrong or something other then that shouldnt be no problems.


+1, and don't use codes from other mods if you don't understand them.
Share |
Dobriy
General Member
Since: Mar 31, 2011
Posts: 96
Last: May 23, 2012
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Tuesday, Mar. 27, 2012 11:55 am
not so understood a question, you want to kill the player to which approach or those people who approach to it?

if the first that:
Code:
players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)			
{
	if(( !isAlive(players[i]) && players[i].pers["team"] == "allies" ))
    {
	if(distance(self.origin, players[i].origin)) < 600)
	self thread [[level.callbackPlayerDamage]](self, self, 1, 0, "MOD_RIFLE_BULLET", "PPS42_mp", self.origin, (0,0,0), "none", 0);//dmg to itself
    }
}


if secod:
Code:
players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)			
{
	if(( !isAlive(players[i]) && players[i].pers["team"] == "allies" )) continue;
    {
	if((distance(self.origin, players[i].origin)) < 600)
		players[i] finishplayerDamage(players[i], players[i], 250, 0, "MOD_PROJECTILE", "panzerschreck_mp", self.origin, vectornormalize(players[i].origin - self.origin), "none", 0);//dmg to player
	}	
}
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Tuesday, Mar. 27, 2012 12:05 pm
Dobriy writes...
Quote:
not so understood a question, you want to kill the player to which approach or those people who approach to it?

if the first that:
Code:
players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)			
{
	if(( !isAlive(players[i]) && players[i].pers["team"] == "allies" ))
    {
	if((distance(self.origin, players[i].origin)) < 600)
	self thread [[level.callbackPlayerDamage]](self, self, 1, 0, "MOD_RIFLE_BULLET", "PPS42_mp", self.origin, (0,0,0), "none", 0);//dmg to itself
    }
}


if secod:
Code:
players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)			
{
	if(( !isAlive(players[i]) && players[i].pers["team"] == "allies" )) continue;
    {
	if((distance(self.origin, players[i].origin)) < 600)
		players[i] finishplayerDamage(players[i], players[i], 250, 0, "MOD_PROJECTILE", "panzerschreck_mp", self.origin, vectornormalize(players[i].origin - self.origin), "none", 0);//dmg to player
	}	
}



Self always dies for being in exactly the same spot as one of the players.
Not working correctly.
Share |
Restricted Access Topic is Locked
Page
Next Page
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

»