Page 1 of 1

Smoketraill

Posted: Sat Dec 19, 2015 12:16 pm
by Kami

Posted: Sat Dec 19, 2015 1:11 pm
by iPlayer

Syntax: Select all

from players.entity import Player
from colors import Color
from commands.say import SayCommand
from entities.entity import Entity
from mathlib import Vector
from engines.precache import Generic as PrecacheGeneric


PrecacheGeneric("particle/SmokeStack.vmt", preload=True)


@SayCommand('do')
def _smoke_trail(command, index, team=None):
player = Player(index)
userid = player.userid
entity = Entity.create('env_smokestack')
entity.set_key_value_int('BaseSpread', 20)
entity.set_key_value_int('EndSize', 30)
entity.set_key_value_int('JetLength', 180)
entity.set_key_value_int('Rate', 20)
entity.set_key_value_int('renderamt', 255)
entity.set_key_value_color('rendercolor', Color(255, 255, 255))
entity.set_key_value_string('SmokeMaterial', 'particle/SmokeStack.vmt')
entity.set_key_value_int('Speed', 30)
entity.set_key_value_int('SpreadSpeed', 15)
entity.set_key_value_int('StartSize', 20)
entity.set_key_value_int('InitialState', 1)
entity.teleport(player.origin, None, None)
entity.spawn()


This creates default smokestack. Not sure if precache is needed though.

Also, InitialState set to 1 lets us avoid calling TurnOn input.

Posted: Sat Dec 19, 2015 2:14 pm
by Kami
Awesome this worked :D Didn't know about some of the functions you used so thanks for those too!

Posted: Sat Dec 19, 2015 4:26 pm
by satoon101
We added CSmokeStack data yesterday, so most of those set_key_value_<type> calls can be changed to use the attributes.
https://github.com/Source-Python-Dev-Team/Source.Python/commit/350250a0e6f625202c8f50547df80bcbd4c78d08

Posted: Sat Dec 19, 2015 4:31 pm
by iPlayer
I knew I saw CSmokeStack somewhere :) And I guess that rendercolor and renderamt already had shortcuts.