Skip to content

Conversation

@ThomasVieth
Copy link
Contributor

Found this useful for setting the model of weapons when in the world. Hopefully should help others too :)

Found this useful for setting the model of weapons when in the world. Hopefully should help others too :)
@ThomasVieth ThomasVieth changed the title Added SetEntityModel vfunc offsets Added SetModel vfunc offsets Mar 5, 2017
@satoon101
Copy link
Member

Have you tried setting the model via the world_model_index attribute? If that works, I think it would be better to use it instead of having to rely on a virtual offset that can change whenever Valve updates the game.

from engines.precache import Model
from weapons.entity import Weapon

model = Model('some/model/path.mdl')
weapon = Weapon.create('weapon_flashbang')
weapon.world_model_index = model.index

@ThomasVieth
Copy link
Contributor Author

ThomasVieth commented Mar 5, 2017

Yeh I agree with you and I had noticed you made that commit a while ago. However after trying to change the world model upon OnEntitySpawned, it would only work using the vfunc. So thought it was best to provide it for others.

https://github.com/Predz/SP-Viewmodel-Changer/blob/master/addons/source-python/packages/custom/vmchanger/hooks.py#L16

@Ayuto Ayuto closed this Jun 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants