Spawn location of particle effect

Please post any questions about developing your plugin here. Please use the search function before posting!
Ehrmann
Junior Member
Posts: 10
Joined: Fri Apr 14, 2017 12:18 pm
Location: Moscow

Spawn location of particle effect

Postby Ehrmann » Mon May 14, 2018 8:21 pm

Hello! I'm trying to spawn particle "weapon_tracers_taser". It works good except one thing: It spawn from location I set (player.view_coordinates) to zero point of a map ( Vector(0, 0, 0)). I tried to set a lot of particle params like particle.start_point and end_point but nothing happened. Please help me to figure out what's wrong. Here's my code:

Syntax: Select all

from commands.say import SayCommand
from engines.server import engine_server
from stringtables import string_tables
from players.entity import Player
from entities.entity import Entity

@SayCommand('spawn')
def spawn_effect(command, index, team_only=None):
player = Player(index)
particle = Entity.create('info_particle_system')
particle.effect_name = 'weapon_tracers_taser'
engine_server.precache_generic('weapon_tracers_taser', True)
particle.origin = player.view_coordinates
particle.effect_index = string_tables.ParticleEffectNames.add_string('weapon_tracers_taser')
particle.call_input('Start')

May be helpful, dir(particle) output :

Code: Select all

__class__
__delattr__
__dict__
__dir__
__doc__
__eq__
__format__
__ge__
__getattr__
__getattribute__
__gt__
__hash__
__init__
__init_subclass__
__le__
__lt__
__module__
__ne__
__new__
__reduce__
__reduce_ex__
__repr__
__setattr__
__sizeof__
__str__
__subclasshook__
__weakref__
_get_property
_index
_obj
_ptr
_set_parent
_set_property
_size
active
add_context
add_output
address
angles
auto_dealloc
avelocity
base_entity
base_velocity
basehandle
call_input
class_name
classname
clear_context
clear_parent
collideable
collision_group
color
compare
copy
cpoint1
cpoint10
cpoint11
cpoint12
cpoint13
cpoint14
cpoint15
cpoint16
cpoint17
cpoint18
cpoint19
cpoint1_parent
cpoint2
cpoint20
cpoint21
cpoint22
cpoint23
cpoint24
cpoint25
cpoint26
cpoint27
cpoint28
cpoint29
cpoint2_parent
cpoint3
cpoint30
cpoint31
cpoint32
cpoint33
cpoint34
cpoint35
cpoint36
cpoint37
cpoint38
cpoint39
cpoint3_parent
cpoint4
cpoint40
cpoint41
cpoint42
cpoint43
cpoint44
cpoint45
cpoint46
cpoint47
cpoint48
cpoint49
cpoint4_parent
cpoint5
cpoint50
cpoint51
cpoint52
cpoint53
cpoint54
cpoint55
cpoint56
cpoint57
cpoint58
cpoint59
cpoint5_parent
cpoint6
cpoint60
cpoint61
cpoint62
cpoint63
cpoint6_parent
cpoint7
cpoint7_parent
cpoint8
cpoint9
create
damage_filter
datamap
dealloc
delay
destroy_immediately
direction
disable_damage_forces
disable_shadow
dispatch_response
edict
effect_index
effect_name
effects
elasticity
emit_sound
enable_damage_forces
enable_shadow
end_point
end_touch
factory
find
find_or_create
fire_user1
fire_user2
fire_user3
fire_user4
friction
functiontables
get_bool
get_char
get_datamap_property_bool
get_datamap_property_char
get_datamap_property_color
get_datamap_property_double
get_datamap_property_float
get_datamap_property_int
get_datamap_property_interval
get_datamap_property_long
get_datamap_property_long_long
get_datamap_property_pointer
get_datamap_property_quaternion
get_datamap_property_short
get_datamap_property_string_array
get_datamap_property_string_pointer
get_datamap_property_uchar
get_datamap_property_uint
get_datamap_property_ulong
get_datamap_property_ulong_long
get_datamap_property_ushort
get_datamap_property_vector
get_double
get_eye_location
get_float
get_input
get_int
get_key_value_bool
get_key_value_color
get_key_value_float
get_key_value_int
get_key_value_qangle
get_key_value_string
get_key_value_vector
get_long
get_long_long
get_model
get_network_property_bool
get_network_property_char
get_network_property_color
get_network_property_double
get_network_property_float
get_network_property_int
get_network_property_interval
get_network_property_long
get_network_property_long_long
get_network_property_pointer
get_network_property_quaternion
get_network_property_short
get_network_property_string_array
get_network_property_string_pointer
get_network_property_uchar
get_network_property_uint
get_network_property_ulong
get_network_property_ulong_long
get_network_property_ushort
get_network_property_vector
get_parent
get_pointer
get_property_bool
get_property_char
get_property_color
get_property_edict
get_property_float
get_property_int
get_property_interval
get_property_pointer
get_property_quaternion
get_property_short
get_property_string
get_property_string_pointer
get_property_uchar
get_property_uint
get_property_ushort
get_property_vector
get_short
get_string_array
get_string_pointer
get_uchar
get_uint
get_ulong
get_ulong_long
get_ushort
get_virtual_func
global_name
gravity
ground_entity
hammerid
health
index
inputs
inthandle
is_in_solid
is_networked
is_overlapping
is_player
keyvalues
kill_hierarchy
local_time
lookup_attachment
lookup_bone
ltime
make_function
make_virtual_function
max_health
maxs
mins
model
model_handle
model_header
model_index
model_name
move
move_type
networkable
on_dealloc
on_take_damage
origin
outputs
owner
owner_handle
parent
parent_inthandle
parent_name
physics_object
pointer
properties
protect
realloc
remove
remove_context
render
render_amt
render_color
render_fx
render_mode
render_mode_prop
rotation
search_bytes
server_class
server_classes
set_bool
set_char
set_damage_filter
set_datamap_property_bool
set_datamap_property_char
set_datamap_property_color
set_datamap_property_double
set_datamap_property_float
set_datamap_property_int
set_datamap_property_interval
set_datamap_property_long
set_datamap_property_long_long
set_datamap_property_pointer
set_datamap_property_quaternion
set_datamap_property_short
set_datamap_property_string_array
set_datamap_property_string_pointer
set_datamap_property_uchar
set_datamap_property_uint
set_datamap_property_ulong
set_datamap_property_ulong_long
set_datamap_property_ushort
set_datamap_property_vector
set_double
set_float
set_int
set_key_value_bool
set_key_value_color
set_key_value_float
set_key_value_int
set_key_value_qangle
set_key_value_string
set_key_value_vector
set_long
set_long_long
set_model
set_network_property_bool
set_network_property_char
set_network_property_color
set_network_property_double
set_network_property_float
set_network_property_int
set_network_property_interval
set_network_property_long
set_network_property_long_long
set_network_property_pointer
set_network_property_quaternion
set_network_property_short
set_network_property_string_array
set_network_property_string_pointer
set_network_property_uchar
set_network_property_uint
set_network_property_ulong
set_network_property_ulong_long
set_network_property_ushort
set_network_property_vector
set_parent
set_parent_attachment
set_parent_attachment_maintain_offset
set_pointer
set_property_bool
set_property_char
set_property_color
set_property_edict
set_property_float
set_property_int
set_property_interval
set_property_pointer
set_property_quaternion
set_property_short
set_property_string
set_property_string_pointer
set_property_uchar
set_property_uint
set_property_ushort
set_property_vector
set_protection
set_short
set_string_array
set_string_pointer
set_transmit
set_uchar
set_uint
set_ulong
set_ulong_long
set_ushort
shadow_cast_dist
shadow_cast_distance
size
solid_flags
solid_type
spawn
spawn_flags
speed
start
start_active
start_point
start_time
start_touch
stop
stop_play_end_cap
stop_sound
take_damage
target
target_name
team_index
teleport
touch
type_info
unprotect
use
velocity
view_offset
view_ofs
water_level
User avatar
VinciT
Senior Member
Posts: 331
Joined: Thu Dec 18, 2014 2:41 am

Re: Spawn location of particle effect

Postby VinciT » Mon May 14, 2018 11:25 pm

Some particle effects require controlpoints in order to work properly. The taser effect you want to use needs one controlpoint (cpoint1).



In this example, I used another info_particle_system (with a different taser particle effect) to make it look nice, but you don't actually need to use another info_particle_system for this to work. Any entity can be used as a controlpoint, you just need to make sure that the entity's targetname and the particle effect's cpoint1 have the same value.
Ehrmann
Junior Member
Posts: 10
Joined: Fri Apr 14, 2017 12:18 pm
Location: Moscow

Re: Spawn location of particle effect

Postby Ehrmann » Tue May 15, 2018 8:39 am

Thanks a lot! It works properly and looks perfect. But how can I get to known more about controlpoints and how to get to know with particle effect needs controlpoint or anything else?
User avatar
VinciT
Senior Member
Posts: 331
Joined: Thu Dec 18, 2014 2:41 am

Re: Spawn location of particle effect

Postby VinciT » Tue May 15, 2018 6:33 pm

There are a few ways to see how many controlpoints a particle effect has. I usually use the Alien Swarm SDK to view, edit, and create CSGO particles.
Download and install Alien Swarm and Alien Swarm - SDK (Steam > Library > Tools).

You will need another tool called GCFScape in order to extract the CSGO particles.
Make sure to install the latest version, otherwise you won't be able to open up .vpk files, which CSGO uses to store most of it's files.
Once you have installed GCFScape, go to your CSGO files (..\Steam\steamapps\common\Counter-Strike Global Offensive\csgo) and look for pak01_dir.vpk.
Open it with GCFScape and select the particles folder on the left side.

Image

You need to extract the files on the right to your Alien Swarm particles folder (..\Steam\steamapps\common\Alien Swarm\swarm\particles).
I usually make a folder called csgo and put all of the particle files in there (https://i.imgur.com/YgLVFFI.png).

Now that you have all the particle files, launch the Alien Swarm - SDK and double click on Alien Swarm (Tools Mode).
Once it loads, look to your top left. Go to Tools > Particle Editor.

Image

After you've done that, click on File > Open and navigate to your Alien Swarm particles folder. You should see the files you extracted earlier from the pak01_dir.vpk (https://i.imgur.com/bFwHsX3.png). Select a .pcf file and open it.
In case you wanted to check the number of controlpoints for the weapon_tracers_taser, go into the weapons folder and select cs_weapon_fx.pcf.

First things first, you need to find the weapon_tracers_taser particle effect. Looking at the top left window (https://i.imgur.com/PAvmWFP.png), scroll down until you find it and then select it. The two bottom windows should be different now, filled with information related to the particle effect you selected.

Look at the bottom right window and click on Ctrl Pts.

Image

You might be wondering, why not just use the CSGO Tools Mode? The thing is, it just doesn't work. It's been broken for years and I don't think the people at Valve plan on fixing it. You can try it yourself by adding -tools to your CSGO launch options.
Ehrmann
Junior Member
Posts: 10
Joined: Fri Apr 14, 2017 12:18 pm
Location: Moscow

Re: Spawn location of particle effect

Postby Ehrmann » Thu May 17, 2018 1:33 pm

I'm very appreciated for so big and detail guide! You should be a master about particle effects. Could you answer one more question? Is there way to change Dota 2 particles for working in CS GO? I know that old Dota 2 was using source engine too, like in CS GO. But Dota 2 was ported to Source 2 in 2015. Now I can open old dota 2 particles in Alien Swarm - SDK, but It isn't working for CS GO... May be you know any possibilities to port old or new Dota 2 particles to CS GO?
User avatar
VinciT
Senior Member
Posts: 331
Joined: Thu Dec 18, 2014 2:41 am

Re: Spawn location of particle effect

Postby VinciT » Thu May 17, 2018 8:37 pm

I haven't played around with Source 2's particle editor at all, so I can't say if it's possible to use particle effects made for the new Dota 2.
But it's definitely possible to bring old Dota 2 particle effects into CSGO, but I'm not sure if they will fully work.

If you really want to use old Dota 2 particle effects, you will need to extract the necessary materials from the Dota 2 vpks (pak01_dir.vpk).
First, you need to find out which materials you actually need. For this example, I'll try to port aegis_respawn_spotlight into CSGO.
So I opened items_fx.pcf in the editor, and I selected aegis_respawn_spotlight in the top left window.

Image

I'd like to make a note here, in case you want to tackle bigger particle effects. See that number in the bottom left? That shows you if this particle effect is part of a bigger one. The number on the left represents the parent particle effect, the number on the right (if there is one) represents the child particle effect.
If you click the number, it will show you where the particle effect is being used. Anyway, back to porting.

We need to find the name of the material used for this particle effect. Looking at the bottom left window (properties), we can see that there's a material field.

Image

particle\spotlight\spotlight.vmt - that's the material we need. Go to your old Dota 2 files, find pak01_dir.vpk and open it with GCFScape.
Go into materials > particle > spotlight (https://i.imgur.com/Tnm7SCK.png) and extract spotlight.vmt and spotlight.vtf to your CSGO server materials folder.
Remember to keep the same folder structure - ..materials\particle\spotlight\ (https://i.imgur.com/GwrO1oJ.png).

Before we attempt to spawn the particle effect, we need to put the items_fx.pcf into the server particles folder (..\csgo\particles\).
Same as before, I created a dota2 folder inside the particles folder, just to keep things tidy (https://i.imgur.com/W6g2GFO.png).



Side note, Valve recently pushed out an update that made sv_allowupload 0 by default, so you will need to change that to 1 in your console (game, not server) in order to download the files from the server. The workaround for this is to use a fastdl server.
After you connect to your server and download the files (materials, .pcf), you will need to reconnect or wait for the map to change before you are able to see the particle effect.

Hope that helps, and sorry for the long post.
Ehrmann
Junior Member
Posts: 10
Joined: Fri Apr 14, 2017 12:18 pm
Location: Moscow

Re: Spawn location of particle effect

Postby Ehrmann » Sun May 20, 2018 9:47 am

Thank you very much for another awesome guide. It's really working, not at all, but working. Thanks again!
User avatar
VinciT
Senior Member
Posts: 331
Joined: Thu Dec 18, 2014 2:41 am

Re: Spawn location of particle effect

Postby VinciT » Sun May 20, 2018 8:28 pm

I figured as much. The particle effect I ported works fine, but I got a lot of errors in my console.


Code: Select all

Didn't find particle function Movement Set to Control Point
Didn't find particle function Movement Set to Control Point
Didn't find particle function Lifespan EndCap Timed Decay
Didn't find particle function Movement Set to Control Point
Didn't find particle function Movement Set to Control Point
Didn't find particle function Lifespan EndCap Timed Decay
Didn't find particle function Lifespan EndCap Timed Decay
Didn't find particle function Movement Set to Control Point
Didn't find particle function Movement Set to Control Point
Didn't find particle function Lifespan EndCap Timed Decay
Didn't find particle function Movement Set to Control Point
Didn't find particle function Lifespan EndCap Timed Decay
Didn't find particle function Movement Set to Control Point
Didn't find particle function Lifespan EndCap Timed Decay
Didn't find particle function Movement Set to Control Point
Didn't find particle function Lifespan EndCap Timed Decay
Didn't find particle function Movement Set to Control Point
Didn't find particle function Lifespan EndCap Timed Decay
Didn't find particle function Set Single Control Point Position
Didn't find particle function Set Control Point Orientation
Didn't find particle function Set Control Point Orientation
Didn't find particle function Set Control Point Orientation
Didn't find particle function Set Control Point Orientation
Didn't find particle function Set Control Point Orientation
Didn't find particle function Set Control Point Orientation
Didn't find particle function Movement Set to Control Point
Didn't find particle function Movement Set to Control Point
Didn't find particle function Movement Set to Control Point
Didn't find particle function Lifespan EndCap Timed Decay
Didn't find particle function Movement Set to Control Point
Didn't find particle function Lifespan EndCap Timed Decay
Didn't find particle function Set Single Control Point Position
Didn't find particle function Render Deferred Light
CDmxElement::UnpackIntoStructure: Mismatched attribute type in attribute "Particle Increment Amount"!
Didn't find particle function Lifespan EndCap Timed Decay
Didn't find particle function Render Deferred Light
Didn't find particle function Render Deferred Light
Didn't find particle function Render Deferred Light
Didn't find particle function Lifespan EndCap Timed Decay
Didn't find particle function Lifespan EndCap Timed Decay
Didn't find particle function Render Deferred Light
Didn't find particle function Lifespan EndCap Timed Decay
Didn't find particle function Lifespan EndCap Timed Decay
Didn't find particle function Render Deferred Light
Didn't find particle function Lifespan EndCap Timed Decay
Didn't find particle function Render Deferred Light
Didn't find particle function Set child control points objects to model particles
Didn't find particle function Render Deferred Light
Didn't find particle function Render Deferred Light
Didn't find particle function Set child control points objects to model particles
Didn't find particle function Render Deferred Light
Didn't find particle function Lifespan EndCap Timed Decay
Didn't find particle function Set Single Control Point Position
Didn't find particle function Set Control Point Orientation
Didn't find particle function Set Control Point Orientation
Didn't find particle function Set Control Point Orientation
Didn't find particle function Set Control Point Orientation
Didn't find particle function Set Control Point Orientation
Didn't find particle function Set Control Point Orientation
Didn't find particle function Lifespan EndCap Timed Decay
Didn't find particle function Lifespan EndCap Timed Decay
Didn't find particle function Lifespan EndCap Timed Decay
Didn't find particle function Lifespan EndCap Timed Decay
Didn't find particle function Set Control Point Orientation
Didn't find particle function Set Control Point Orientation
Didn't find particle function Set Control Point Orientation
Didn't find particle function Set Control Point Orientation
Didn't find particle function Set Control Point Orientation
Didn't find particle function Set Control Point Orientation
Didn't find particle function Set Control Point Orientation
Didn't find particle function Set Control Point Orientation
Didn't find particle function Set Control Point Orientation
Didn't find particle function Set Control Point Orientation
Didn't find particle function Set Control Point Orientation
Didn't find particle function Set Control Point Orientation
Didn't find particle function Set Control Point Orientation
Didn't find particle function Set Control Point Orientation
Didn't find particle function Set Single Control Point Position
Didn't find particle function Set Single Control Point Position
Didn't find particle function Set Single Control Point Position
Didn't find particle function Render Deferred Light
Didn't find particle function Render Deferred Light
Didn't find particle function Render Deferred Light
Didn't find particle function Set Single Control Point Position
Didn't find particle function Set Single Control Point Position
Didn't find particle function Render Deferred Light
Didn't find particle function Lifespan EndCap Timed Decay
Didn't find particle function Render Deferred Light
CDmxElement::UnpackIntoStructure: Mismatched attribute type in attribute "Particle Increment Amount"!
Didn't find particle function Render Deferred Light
Didn't find particle function Set child control points objects to model particles
Didn't find particle function Render Deferred Light
Didn't find particle function Render Deferred Light
Didn't find particle function Render Deferred Light
Didn't find particle function Lifespan EndCap Timed Decay
Didn't find particle function Lifespan EndCap Timed Decay
Didn't find particle function Set Single Control Point Position
Didn't find particle function Set Single Control Point Position

Looks like the CSGO particle systems are missing a couple of functions the old Dota 2 had.
I suggest you either stick to simpler Dota 2 particles or try to recreate the more complex ones on your own for CSGO.

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 41 guests