Comments (6)
You almost hit the right point, but there is another reason why #SOUND didn't work as intended.
Because how Executor was made, it extracts variable as much as possible from the event class itself.
In fact, #SOUND is designed to used when there is a 'player' variable exists, and the 'player' variable here is the player who got killed not the killer.
To go around with this problem, you have to manually invoke the method of killer's playSound()
This way, you will be able to play sound only for the killer.
But make sure to check if the killer is Player, as any entity can fire PlayerDeathEvent; the playSound() only exists for the Player; therefore, it will make error if the killer is not Player.
To check that, you may use IF statement
IF killer.getType().name() == PLAYER
killer.playSound(...)
ENDIF
To add one more thing, if you look at the code in the SOUND in Executor folder, all it does is just invoking the same method for the 'player' variable.
from triggerreactor.
Umm actually, you can't do that as of now.
As you can see, the playSound() only accepts float, not double.
to work around on this one, you first save value and use floatValue() method.
volume = 1.0
pitch = 1.0
killer.playSound(someloc, sound, volume.floatValue(), pitch.floatValue())
from triggerreactor.
Or, really, you can create your own Executor xD
I think this way will work better
All you need to do is copy everything in the SOUND executor and change 'player' variable into 'player.getKiller()'
Maybe you can name it like SOUNDKILLER or something
#SOUNDKILLER killer.getLocation() "ENTITY_BLAZE_DEATH" 5.0 1.0
from triggerreactor.
Ok thank you so much for all your help. Im definitely gonna try all that you just put down.
from triggerreactor.
i tried both and was getting an error. I made your executor say player.getKiller() and i also did the IF statement but it said it did not recognize the value ENTITY_BLAZE_DEATH. this is how i had it.
dead.getKiller().playSound(dead.getKiller().getLocation(),Sound.ENTITY_BLAZE_DEATH,5,1) i also tried
dead.getKiller().playSound(dead.getKiller().getLocation(),ENTITY_BLAZE_DEATH, 5,1) it can always be me of course im human lol but i looked over each, a dozen times before coming back to you. I wanted to make sure it wasn't just me. I researched links on the play sound parameters to make sure i had them right.
from triggerreactor.
Ok, the thing is that TriggerReactor doesn't recognize static access xD
So it's nothing wrong with you as you tried the Java thing, but it was too much for TriggerReactor.
So what's the solution? I recently updated it to version 1.3.2, and this version support conversion from String to Enum.
For example,
dead.getKiller().playSound(dead.getKiller().getLocation(), "ENTITY_BLAZE_DEATH", 5, 1)
will work, because now TriggerReactor first check the parameter of method and see if it is Enum, then it will try to convert String value to Enum corresponding to the provided String. So the String you provide here must be exactly matching name with the one in the whatever enum you are trying to use.
I think the 5, 1 part will cause some error as the method only accepts float value. Did you try it? If that works then it's all good, but if it doesn't, try (5.0).floatValue()
Let me know if something still doesn't seem to work.
(Dont forget to get the latest version! I also added wiki about enum conversion, so you might want to take a look)
from triggerreactor.
Related Issues (20)
- Get rid of obsolete code
- #VELOCITY Executor can be used to induce server crash HOT 1
- Invalid timings value HOT 1
- failed to pass through Lexer when "0" was entered.
- Create test case concurrent write to a same file HOT 1
- "Failed to rename temp file to Any_Trigger_name.json" HOT 4
- Does not working on Java 16 and below
- Remove JShader requirement HOT 2
- MySQL true시 오류 HOT 2
- Move interrupter building into core
- 한글텍스트가 계속 ???으로 변합니다.
- Switch statement only allows string type HOT 1
- 왼손에 물건 들고 PlayerInteract Event 시 트리거 2번 중복 호출 HOT 2
- InventoryTrigger possibly not sharing internal variables correctly
- #SERVER 오류
- JSONMessage executor HOT 1
- Add Magma to PlatformManager
- edititems command possibly stopped working
- 관전자 모드에서 인벤토리 트리거 클릭 HOT 1
- OnInteract 이벤트 관련 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from triggerreactor.