[HL2:DM] es_blood to sp blood

A place for requesting new Source.Python plugins to be made for your server.

Please request only one plugin per thread.
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [HL2:DM] es_blood to sp blood

Postby Painkiller » Sun Feb 19, 2017 2:25 pm

I can not help it just works only with the grenade.

I have tried different index names:

Syntax: Select all

DAMAGE_TRIGGERS = [
'weapon_frag',
'smg1_grenade',
'rpg_missile',
'weapon_slam',


Syntax: Select all

DAMAGE_TRIGGERS = [
'weapon_frag',
'weapon_smg1_grenade',
'weapon_rpg_missile',
'weapon_slam',


Please, where is the error?
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: [HL2:DM] es_blood to sp blood

Postby satoon101 » Sun Feb 19, 2017 3:22 pm

The first error doesn't make much sense to me. To debug the 2nd error, please use the following:

Syntax: Select all

from stringtables.downloads import Downloadables

dl = Downloadables()
dl.add('materials/smoke/smokeball-11-4.vmt')


from entities import TakeDamageInfo
from entities.entity import Entity
from entities.hooks import EntityCondition, EntityPreHook
from memory import make_object
from players.entity import Player
from weapons.manager import weapon_manager


DAMAGE_TRIGGERS = [
'weapon_frag',
'smg1_grenade',
'weapon_rpg',
'weapon_slam',
]

@EntityPreHook(EntityCondition.is_player, 'on_take_damage')
def _pre_take_damage(stack_data):
victim = make_object(Entity, stack_data[0])
if not victim.is_player():
return

info = make_object(TakeDamageInfo, stack_data[1])

# World damage?
if info.attacker == 0:
return

# Was a projectile used?
if info.attacker != info.inflictor:
weapon = Entity(info.inflictor).classname

# Not sure if this line is necessary, but just in case
try:
weapon = weapon_manager[weapon].name
except AttributeError:
raise ValueError(
'{weapon} not found in weapon_manager'.format(
weapon=weapon,
)
)

# Not a projectile
else:
weapon = Player(info.attacker).active_weapon.classname

if weapon in DAMAGE_TRIGGERS:
fragcloud(Player(victim.index))


def fragcloud(victim):
entity = make_object(Entity, victim.give_named_item('env_ar2explosion'))
entity.set_key_value_string('material', 'smoke/smokeball-11-4.vmt')
entity.call_input('Explode')
entity.delay(8, entity.remove)
Image
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [HL2:DM] es_blood to sp blood

Postby Painkiller » Mon Feb 20, 2017 5:24 pm

hi, i have test it but works only with grenade_frag and weapon_rpg.

smg1_grenade and weapon_slam work not.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: [HL2:DM] es_blood to sp blood

Postby satoon101 » Mon Feb 20, 2017 5:46 pm

Ok, but my last post improved the error message to let us know what they "should" be. Could you post all errors so we can have a look? The other error (AttributeError on active_weapon) I am really not sure how that happens, unfortunately.
Image
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [HL2:DM] es_blood to sp blood

Postby Painkiller » Mon Feb 20, 2017 8:47 pm

I have find this.

Code: Select all

2017-02-20 19:01:31 - sp   -   EXCEPTION   
[SP] Caught an Exception:
Traceback (most recent call last):
  File "../addons/source-python/plugins/headshot/headshot.py", line 98, in _pre_take_damage
    _damage_weapons[victim.userid] = Player(info.attacker).active_weapon.classname
  File "../addons/source-python/packages/source-python/entities/_base.py", line 116, in __getattr__
    raise AttributeError('Attribute "{0}" not found'.format(attr))

AttributeError: Attribute "active_weapon" not found


2017-02-20 19:01:31 - sp   -   EXCEPTION   
[SP] Caught an Exception:
Traceback (most recent call last):
  File "../addons/source-python/plugins/explosive/explosive.py", line 50, in _pre_take_damage
    weapon = Player(info.attacker).active_weapon.classname
  File "../addons/source-python/packages/source-python/entities/_base.py", line 116, in __getattr__
    raise AttributeError('Attribute "{0}" not found'.format(attr))

AttributeError: Attribute "active_weapon" not found


2017-02-20 19:31:45 - sp   -   EXCEPTION   
[SP] Caught an Exception:
Traceback (most recent call last):
  File "../addons/source-python/plugins/savescore/savescore.py", line 15, in save_player_score
    player = Player(index)
  File "../addons/source-python/packages/source-python/players/_base.py", line 86, in __init__
    super().__init__(index)
  File "../addons/source-python/packages/source-python/entities/_base.py", line 94, in __init__
    super().__init__(index)

ValueError: Conversion from "Index" (1) to "BaseEntity" failed.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: [HL2:DM] es_blood to sp blood

Postby satoon101 » Tue Feb 21, 2017 11:12 pm

The first and third errors have nothing to do with this plugin. Make sure when posting tracebacks that you verify the plugin it is coming from.

The first one is coming from headshot. Notice the first line after Traceback references the file ../addons/source-python/plugins/headshot/headshot.py:

Syntax: Select all

2017-02-20 19:01:31 - sp   -   EXCEPTION   
[SP] Caught an Exception:
Traceback (most recent call last):
File "../addons/source-python/plugins/headshot/headshot.py", line 98, in _pre_take_damage
_damage_weapons[victim.userid] = Player(info.attacker).active_weapon.classname
File "../addons/source-python/packages/source-python/entities/_base.py", line 116, in __getattr__
raise AttributeError('Attribute "{0}" not found'.format(attr))

AttributeError: Attribute "active_weapon" not found


The third one is coming from savescore. Notice the first line after Traceback references the file ../addons/source-python/plugins/savescore/savescore.py:

Syntax: Select all

2017-02-20 19:31:45 - sp   -   EXCEPTION   
[SP] Caught an Exception:
Traceback (most recent call last):
File "../addons/source-python/plugins/savescore/savescore.py", line 15, in save_player_score
player = Player(index)
File "../addons/source-python/packages/source-python/players/_base.py", line 86, in __init__
super().__init__(index)
File "../addons/source-python/packages/source-python/entities/_base.py", line 94, in __init__
super().__init__(index)

ValueError: Conversion from "Index" (1) to "BaseEntity" failed.


The second one is relevant to this thread, as it references the file ../addons/source-python/plugins/explosive/explosive.py. But, as I stated above, I'm not sure what causes this issue, and we will have to look into it further.

I cannot test locally with multiple players, because my server is being a pain when trying to connect over LAN, so I am unable to verify that slam's work properly. However, I was able to test with frag grenades, smg grenades, and rpg by hurting myself, and all 3 should work fine with the following:

Syntax: Select all

from entities import TakeDamageInfo
from entities.entity import Entity
from entities.hooks import EntityCondition, EntityPreHook
from memory import make_object
from players.entity import Player
from weapons.manager import weapon_manager


DAMAGE_TRIGGERS = [
'weapon_frag',
'weapon_smg1',
'weapon_rpg',
'weapon_slam',
]


@EntityPreHook(EntityCondition.is_player, 'on_take_damage')
def _pre_take_damage(stack_data):
victim = make_object(Entity, stack_data[0])
if not victim.is_player():
return

info = make_object(TakeDamageInfo, stack_data[1])
weapon_index = info.weapon
try:
weapon = weapon_manager[Entity(weapon_index).classname].name
except AttributeError:
return

if weapon in DAMAGE_TRIGGERS:
fragcloud(Player(victim.index))


def fragcloud(victim):
entity = make_object(Entity, victim.give_named_item('env_ar2explosion'))
entity.set_key_value_string('material', 'smoke/smokeball-11-4.vmt')
entity.call_input('Explode')
entity.delay(8, entity.remove)
Image
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: [HL2:DM] es_blood to sp blood

Postby Ayuto » Wed Feb 22, 2017 6:01 am

The error might occur, because he didn't follow the update guide.
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [HL2:DM] es_blood to sp blood

Postby Painkiller » Wed Feb 22, 2017 7:03 am

Ok i have test it.
Work for smg1,grenade,rpg but not for slam.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: [HL2:DM] es_blood to sp blood

Postby satoon101 » Wed Feb 22, 2017 1:29 pm

Ayuto wrote:The error might occur, because he didn't follow the update guide.

Oh, good point. Painkiller, make sure you follow the update procedure when updating Source.Python on your server:
http://wiki.sourcepython.com/general/updating.html


Painkiller wrote:Ok i have test it.
Work for smg1,grenade,rpg but not for slam.

Ok, could you please load the following on your server and have another person help you test:

Syntax: Select all

from entities import TakeDamageInfo
from entities.entity import Entity
from entities.hooks import EntityCondition, EntityPreHook
from memory import make_object
from messages import SayText2


@EntityPreHook(EntityCondition.is_player, 'on_take_damage')
def _pre_take_damage(stack_data):
victim = make_object(Entity, stack_data[0])
if not victim.is_player():
return

info = make_object(TakeDamageInfo, stack_data[1])
message = 'Damage caused by: {weapon}'.format(
weapon=Entity(info.weapon).classname
)
print(message)
SayText2(message).send()

Just have one of you kill the other with a slam and a message should be sent in chat and in the server's console. Post that output here so that I can update the plugin to work for slams.
Image
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [HL2:DM] es_blood to sp blood

Postby Painkiller » Wed Feb 22, 2017 4:13 pm

satoon101 wrote:
Ayuto wrote:The error might occur, because he didn't follow the update guide.

Oh, good point. Painkiller, make sure you follow the update procedure when updating Source.Python on your server:
http://wiki.sourcepython.com/general/updating.html


Painkiller wrote:Ok i have test it.
Work for smg1,grenade,rpg but not for slam.

Ok, could you please load the following on your server and have another person help you test:

Syntax: Select all

from entities import TakeDamageInfo
from entities.entity import Entity
from entities.hooks import EntityCondition, EntityPreHook
from memory import make_object
from messages import SayText2


@EntityPreHook(EntityCondition.is_player, 'on_take_damage')
def _pre_take_damage(stack_data):
victim = make_object(Entity, stack_data[0])
if not victim.is_player():
return

info = make_object(TakeDamageInfo, stack_data[1])
message = 'Damage caused by: {weapon}'.format(
weapon=Entity(info.weapon).classname
)
print(message)
SayText2(message).send()

Just have one of you kill the other with a slam and a message should be sent in chat and in the server's console. Post that output here so that I can update the plugin to work for slams.



the first is suisite:

Code: Select all

L 02/22/2017 - 17:06:54: "[RocKs³]|Painkiller_Overdose<3><[U:1:43907303]><Unass
i                                                                              igned>" committed suicide with "slam"
TESTTESTTESTSpawn/Chat Protection;  player 3 died, state = dead


the second is killing:

Code: Select all

L 02/22/2017 - 17:10:20: "[RocKs³]|Painkiller_Overdose<3><[U:1:43907303]><Unass
i                                                                              igned>" killed "g0nZ0 |eFa|<5><BOT><Unassigned>" with "slam"
TESTTESTTESTSpawn/Chat Protection;  player 5 died, state = dead




PS.:Yes i Have correct update SP

Edit: after updating SP correctly, the active_weapon error doesn't occur anymore
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: [HL2:DM] es_blood to sp blood

Postby satoon101 » Wed Feb 22, 2017 11:07 pm

That's not really the output I am looking for. The debugging plugin I provided should post the following message to both chat and server console:
Damage caused by: <weapon>

<weapon> will be the weapon that caused the damage. What you posted is from your logs, which is not what I need.
Image
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [HL2:DM] es_blood to sp blood

Postby Painkiller » Thu Feb 23, 2017 7:36 am

I'll check it again.

But what I sent was out of the serverconsole and more was not there.
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [HL2:DM] es_blood to sp blood

Postby Painkiller » Thu Feb 23, 2017 8:04 am

Ok now i find only this in server log console:

Code: Select all

Damage caused by: npc_tripmine
Spawn/Chat Protection;  FireGameEvent handle PlayerHurt, name = 'player_hurt'
L 02/23/2017 - 09:00:52: "[RocKs³]|Painkiller_Overdose<2><[U:1:43907303]><Unassiigned>" killed "[ >NÄ¿Å< ] ï®veиï®oи [GER]<3><[U:1:38176121]><Unassigned>" with
 "slam"
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: [HL2:DM] es_blood to sp blood

Postby satoon101 » Thu Feb 23, 2017 12:49 pm

Perfect! Thank you. I will add npc_tripmine to our weapon data, so the next SP build should fix the issue.
Image
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [HL2:DM] es_blood to sp blood

Postby Painkiller » Thu Feb 23, 2017 4:59 pm

Works with Slam.

Thanks Satoon.
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [HL2:DM] es_blood to sp blood

Postby Painkiller » Fri Mar 10, 2017 3:42 pm

Hello i have a new problem.

If one shoot with the smg1 on an enemy, comes with every hit the effect.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: [HL2:DM] es_blood to sp blood

Postby satoon101 » Sat Mar 11, 2017 12:03 am

Oh, good point. I'll work on this tomorrow morning.
Image
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: [HL2:DM] es_blood to sp blood

Postby satoon101 » Sat Mar 11, 2017 4:21 pm

Try this:

Syntax: Select all

from entities import TakeDamageInfo
from entities.entity import Entity
from entities.hooks import EntityCondition, EntityPreHook
from memory import make_object
from players.entity import Player
from weapons.manager import weapon_manager


DAMAGE_TRIGGERS = [
'npc_grenade_frag',
'grenade_ar2',
'rpg_missile',
'npc_tripmine',
]

@EntityPreHook(EntityCondition.is_player, 'on_take_damage')
def _pre_take_damage(stack_data):
victim = make_object(Entity, stack_data[0])
if not victim.is_player():
return

info = make_object(TakeDamageInfo, stack_data[1])

weapon_index = info.weapon
try:
weapon = Entity(weapon_index).classname
except AttributeError:
return

if weapon in DAMAGE_TRIGGERS:
fragcloud(Player(victim.index))


def fragcloud(victim):
entity = make_object(Entity, victim.give_named_item('env_ar2explosion'))
entity.set_key_value_string('material', 'smoke/smokeball-11-4.vmt')
entity.call_input('Explode')
entity.delay(8, entity.remove)
Image
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [HL2:DM] es_blood to sp blood

Postby Painkiller » Sat Mar 11, 2017 5:35 pm

Ok i have test it the bug is fixed. Thank You

In the slams I noticed the effect only works when attaching.

However, not when you throw them.

A please tell me the index name for explosive physics (barrels, gas canisters, etc.)?
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: [HL2:DM] es_blood to sp blood

Postby Painkiller » Fri Mar 17, 2017 3:22 pm

Please, someone could find again?

Return to “Plugin Requests”

Who is online

Users browsing this forum: No registered users and 2 guests