Author |
Topic: Script DMG |
Moczulak |
General Member Since: Mar 30, 2009 Posts: 77 Last: Apr 8, 2013 [view latest posts] |
|
|
|
liltc64 |
General Member Since: Feb 12, 2007 Posts: 906 Last: Oct 22, 2012 [view latest posts] |
|
|
|
|
Moczulak |
General Member Since: Mar 30, 2009 Posts: 77 Last: Apr 8, 2013 [view latest posts] |
|
|
Category: CoD2 Scripting Posted: Monday, Mar. 26, 2012 02:46 pm |
|
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..
|
|
|
|
Sevenz |
|
General Member Since: Apr 24, 2006 Posts: 2390 Last: May 10, 2013 [view latest posts] |
|
|
Category: CoD2 Scripting Posted: Monday, Mar. 26, 2012 02:58 pm |
|
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 |
|
|
|
Moczulak |
General Member Since: Mar 30, 2009 Posts: 77 Last: Apr 8, 2013 [view latest posts] |
|
|
Category: CoD2 Scripting Posted: Monday, Mar. 26, 2012 06:30 pm |
|
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? |
|
|
|
liltc64 |
General Member Since: Feb 12, 2007 Posts: 906 Last: Oct 22, 2012 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Tuesday, Mar. 27, 2012 02:03 am |
|
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. |
|
|
|
IzNoGoD |
General Member Since: Nov 29, 2008 Posts: 694 Last: Nov 10, 2012 [view latest posts] |
|
|
Category: CoD2 Scripting Posted: Tuesday, Mar. 27, 2012 07: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. |
|
|
|
BraX |
|
General Member Since: Apr 29, 2008 Posts: 413 Last: May 26, 2012 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Tuesday, Mar. 27, 2012 08: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. |
|
|
|
Dobriy |
General Member Since: Mar 31, 2011 Posts: 96 Last: May 23, 2012 [view latest posts] |
|
|
Category: CoD2 Scripting Posted: Tuesday, Mar. 27, 2012 06:55 pm |
|
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
}
} |
|
|
|
IzNoGoD |
General Member Since: Nov 29, 2008 Posts: 694 Last: Nov 10, 2012 [view latest posts] |
|
|
Category: CoD2 Scripting Posted: Tuesday, Mar. 27, 2012 07: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. |
|
|
|