AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Damage through players (https://forums.alliedmods.net/showthread.php?t=12286)

KCE 04-10-2005 23:56

Damage through players
 
How do I make damage go through players?

For example, a grenade explodes. I use trace_line to see if any walls in between the players within the specified damage radius. Let's say I do a traceline for player 1 and it does damage because nothing is blocking it. Next I do a traceline for player 2 and it does not do damage because player 1 is blocking player 2.

Example : TOP-VIEW
o - player
x - grenade explosion

Code:

Player #2  o - this player is not damaged since #1 is blocking view
       
Player #1  o - nothing in view so do damage
            |  - traceline
            x


Twilight Suzuka 04-11-2005 10:40

radius_damage function.

XxAvalanchexX 04-11-2005 16:45

radius_damage does damage through walls. He doesn't want damage to be done through walls, which is why he is using traceline. However, he wants traceline to ignore other players so that player 1 can get hurt even if he is behind player 2, and the grenade is in front of player 2.

Twilight Suzuka 04-11-2005 16:55

Then trace_line, get the player it hit, then shoot trace_line again with the player hit's ID in the "ignore" arguement of trace_line.

KCE 04-11-2005 17:17

What exactly does the "IgnoreEnt" paramter do? I thought it ignored any ent like you set it to 1 to ignore 0 not to, but I guess not. So it ignores the ent specified in the "IgnoreEnt" paramter? So what if there is a 0 for the paramater? If it only ignores the ent specified, how do you make it ignore all the players? :?:

So would this trace through players?

Code:
//loc is the origin of the second ent and idPoint is the beggining ent stock UTIL_TraceThroughPlayers(idPoint,Float:loc[3]) {     new Float:endorigin[3]     new Float:origin[3]     new Float:blah[3]     endorigin[0]=loc[0]     endorigin[1]=loc[1]     endorigin[2]=loc[2]     pev(idPoint,pev_origin,origin)     engfunc(EngFunc_TraceLine,origin,endorigin,1,-1)     traceresult(TR_EndPos,blah)     if (blah[0] == endorigin[0] && blah[1] == endorigin[1] && blah[2] == endorigin[2])         return 1             return 0 }

Twilight Suzuka 04-13-2005 09:52

the ignore entity param can be used to ignore a specific entity.


All times are GMT -4. The time now is 10:01.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.