Syntax: Select all
from engines.precache import Decal
from engines.precache import Generic
from engines.precache import Model
# Get an instance of each
my_decal = Decal('<path/to/decal>')
my_generic = Generic('<path/to/generic>')
my_model = Model('<path/to/model>')
# Instead of just getting an instance, add it to the downloadables table
my_decal = Decal('<path/to/decal>', True)
my_generic = Generic('<path/to/generic>', True)
my_model = Model('<path/to/model>', True)
# To get the precached index
decal_index = my_decal.index
generic_index = my_generic.index
model_index = my_model.index
As an example of usage (untested):
Syntax: Select all
from engines.precache import Model
from events import Event
from filters.players import PlayerIter
my_model = Model('models/characters/hostage_02.mdl')
@Event
def player_say(game_event):
for player in PlayerIter(return_types='player'):
start_color = player.color
player.get_server_entity().set_model_index(my_model.index)
player.color = start_color
Also, please note that you must use the entire path from the ../<gamename>/ directory. We do not append models/ to the front or the .mdl extension.