[HL2:DM] Model Replacement Problem

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

[HL2:DM] Model Replacement Problem

Postby Painkiller » Fri Jan 28, 2022 12:26 am

Hello,

I have a model replacement plugin.

Apparently it no longer recognizes what it is supposed to replace.

Maybe someone could help me with this.

Greeting Painkiller



Syntax: Select all

# ../addons/source-python/plugins/supermod/cfg/modelreplacement.py

# ============================================================================
# >> GLOBAL VARIABLES
# ============================================================================
modelreplacement = {
'prop_physics': {
'models/props_c17/oildrum001_explosive.mdl': 'models/tsf/blue-drum/oildrum001_explosive.mdl',
'models/props_c17/oildrum001.mdl': 'models/tsf/blue-drum/oildrum001_explosive.mdl'
},
'prop_physics_respawnable': {
'models/props_c17/oildrum001_explosive.mdl': 'models/tsf/blue-drum/oildrum001_explosive.mdl',
'models/props_c17/oildrum001.mdl': 'models/tsf/blue-drum/oildrum001_explosive.mdl'
},
'npc_cscanner': {
'models/gibs/Shield_Scanner_Gib1.mdl': 'models/shield_scanner.mdl',
},
'npc_cscanner_respawnable': {
'models/gibs/Shield_Scanner_Gib1.mdl': 'models/shield_scanner.mdl',
# },
# 'item_battery': {
# 'models/items/battery.mdl': 'models/rocks/items/battery.mdl'
# },
# 'item_healthkit': {
# 'models/items/healthkit.mdl': 'models/rocks/items/healthkit.mdl'
# },
# 'item_healthial': {
# 'models/healthvial.mdl': 'models/rocks/healthvial.mdl'
}
}




Syntax: Select all

# ../addons/source-python/plugins/supermod/modules/modelreplacement.py

# ============================================================================
# >> IMPORTS
# ============================================================================
# Source.Python Imports
# Engines
from engines.precache import Model
# Entities
from entities.entity import Entity
# Listeners
from listeners import OnEntitySpawned
from listeners import OnLevelInit

# Supermod Imports
from supermod.cfg.modelreplacement import modelreplacement

# ============================================================================
# >> LISTENERS
# ============================================================================
@OnEntitySpawned
def on_entity_spawned(base_entity):
if base_entity.classname not in modelreplacement:
return
entity = Entity(base_entity.index)
models = modelreplacement[entity.classname]
if entity.model_name not in models:
return
entity.model = Model(models[entity.model_name])

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 23 guests