Create beam and play sound around player

Please post any questions about developing your plugin here. Please use the search function before posting!
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Create beam and play sound around player

Postby decompile » Thu Jun 02, 2016 5:09 pm

Hey,

How Can I create a beam around the player, which moves from the player to around 400 units around him, sort of a "scan" arround the player him self and play a sound which is the loudest for the player itself, but the more far away the player is the less noise it makes.

found

from effects import beam

but dunno how to define the keyword "end".

The other is probably something with emit sound
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Create beam and play sound around player

Postby Ayuto » Thu Jun 02, 2016 5:15 pm

Use engines.sound.Sound for the sound and pass the "index" parameter to emit the sound from a specific entity.

A beam always has a start and an end. See the documentation for more info:
http://builds.sourcepython.com/job/Sour ... fects.beam
User avatar
iPlayer
Developer
Posts: 590
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Re: Create beam and play sound around player

Postby iPlayer » Thu Jun 02, 2016 5:24 pm

For the beam, you can either use temp entities (through the effects.beam wrapper) or create env_beam if you want to be able to track the entities that touch your beam. Second approach is a little tricky as you need to create another entity to set one of the end points for env_beam.

Second method is implemented here

If you don't need tracking touching entities, just go with effects.beam.
Image /id/its_iPlayer
My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam

Hail, Companion. [...] Hands to yourself, sneak thief. Image
decompile
Senior Member
Posts: 416
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: Create beam and play sound around player

Postby decompile » Thu Jun 02, 2016 9:06 pm

Thanks to iPlayer

Syntax: Select all

Sound(sound_name, index=player_index, attenuation=Attenuation.STATIC).play()
temp_entities.beam_ring_point(..)

Return to “Plugin Development Support”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 48 guests