Mudley Posted July 3, 2016 Share Posted July 3, 2016 Sorry for the stupid question, but how do I check if a monster or another player has you as a target? Link to comment https://forums.kleientertainment.com/forums/topic/68622-check-if-a-monster-or-another-player-is-targeting-you/ Share on other sites More sharing options...
TheKingDedede Posted July 3, 2016 Share Posted July 3, 2016 There's no real way to know. The only reliable way is to see which way the monster is headed and who it charges at. It just comes down to prediction, really. Link to comment https://forums.kleientertainment.com/forums/topic/68622-check-if-a-monster-or-another-player-is-targeting-you/#findComment-789705 Share on other sites More sharing options...
DarkXero Posted July 3, 2016 Share Posted July 3, 2016 local function IsInstCombatTargeted(inst) local x, y, z = inst.Transform:GetWorldPosition() local ents = TheSim:FindEntities(x, y, z, 30, {"_combat"}) for i, v in ipairs(ents) do if v.components.combat.target == inst then return true end end return false end Link to comment https://forums.kleientertainment.com/forums/topic/68622-check-if-a-monster-or-another-player-is-targeting-you/#findComment-789706 Share on other sites More sharing options...
Mudley Posted July 3, 2016 Author Share Posted July 3, 2016 (edited) @DarkXero Thanks, but how I make the instance that is being checked be the player? I am editing the dynamicmusic.lua file, and my objective is to make the StopDanger function check if the player is beeing chased before proceding. I am a fish out of water on LUA coding, so I am sorry if I am doing everything wrong. Edited July 4, 2016 by Mudley Link to comment https://forums.kleientertainment.com/forums/topic/68622-check-if-a-monster-or-another-player-is-targeting-you/#findComment-789720 Share on other sites More sharing options...
DarkXero Posted July 4, 2016 Share Posted July 4, 2016 dynamicmusic.lua Link to comment https://forums.kleientertainment.com/forums/topic/68622-check-if-a-monster-or-another-player-is-targeting-you/#findComment-789773 Share on other sites More sharing options...
Mudley Posted July 6, 2016 Author Share Posted July 6, 2016 @DarkXero Thank you a lot for writing this code for me, but I'm afraid I have another question: How do I trigger the battle music also using this piece of code? The answer is probably in front of my face, but still. Thanks once again for helping me. Link to comment https://forums.kleientertainment.com/forums/topic/68622-check-if-a-monster-or-another-player-is-targeting-you/#findComment-790464 Share on other sites More sharing options...
DarkXero Posted July 6, 2016 Share Posted July 6, 2016 DynamicSomething.zip Link to comment https://forums.kleientertainment.com/forums/topic/68622-check-if-a-monster-or-another-player-is-targeting-you/#findComment-790506 Share on other sites More sharing options...
Neu7ral Posted July 7, 2016 Share Posted July 7, 2016 DarkXero, Exist a way for make the dynamic music enable when you've been targeted? Link to comment https://forums.kleientertainment.com/forums/topic/68622-check-if-a-monster-or-another-player-is-targeting-you/#findComment-790743 Share on other sites More sharing options...
DarkXero Posted July 7, 2016 Share Posted July 7, 2016 23 minutes ago, Neutral_Steve said: Exist a way for make the dynamic music enable when you've been targeted? Did you download and try out DynamicSomething.zip? Link to comment https://forums.kleientertainment.com/forums/topic/68622-check-if-a-monster-or-another-player-is-targeting-you/#findComment-790746 Share on other sites More sharing options...
Neu7ral Posted July 7, 2016 Share Posted July 7, 2016 8 minutes ago, DarkXero said: Did you download and try out DynamicSomething.zip? Oh, I installed it, but nothing changed. Link to comment https://forums.kleientertainment.com/forums/topic/68622-check-if-a-monster-or-another-player-is-targeting-you/#findComment-790749 Share on other sites More sharing options...
DarkXero Posted July 7, 2016 Share Posted July 7, 2016 (edited) 8 minutes ago, Neutral_Steve said: Oh, I installed it, but nothing changed. I downloaded it, installed it, and when I run nearby a spider, it will target me and the music will start playing. Also tried with Deerclops, he saw me, music started playing. And it works for hosts and clients. Edited July 7, 2016 by DarkXero Link to comment https://forums.kleientertainment.com/forums/topic/68622-check-if-a-monster-or-another-player-is-targeting-you/#findComment-790752 Share on other sites More sharing options...
Neu7ral Posted July 7, 2016 Share Posted July 7, 2016 5 minutes ago, DarkXero said: I downloaded it, installed it, and when I run nearby a spider, it will target me and the music will start playing. Also tried with Deerclops, he saw me, music started playing. Maybe I installed It wrong, but it wasn't working with me, I will try it later. Thanks! Link to comment https://forums.kleientertainment.com/forums/topic/68622-check-if-a-monster-or-another-player-is-targeting-you/#findComment-790753 Share on other sites More sharing options...
DarkXero Posted July 7, 2016 Share Posted July 7, 2016 4 minutes ago, Neutral_Steve said: Maybe I installed It wrong, but it wasn't working with me, I will try it later. Thanks! I'm going to bet you extracted the folder and put it as is, resulting in you having mod/folder/folder/modmain. Link to comment https://forums.kleientertainment.com/forums/topic/68622-check-if-a-monster-or-another-player-is-targeting-you/#findComment-790754 Share on other sites More sharing options...
Neu7ral Posted July 7, 2016 Share Posted July 7, 2016 (edited) 33 minutes ago, DarkXero said: I'm going to bet you extracted the folder and put it as is, resulting in you having mod/folder/folder/modmain. My bad my bad, I was using the dusk and night music mod! Edited July 7, 2016 by Neutral_Steve Link to comment https://forums.kleientertainment.com/forums/topic/68622-check-if-a-monster-or-another-player-is-targeting-you/#findComment-790757 Share on other sites More sharing options...
Mudley Posted July 8, 2016 Author Share Posted July 8, 2016 @DarkXero Once again, sorry for wasting your time, but I have one (hopefully) final question. I created another function from the one you gave me, called IsPlayerCombatTargetedBoss() that checks if any instance with the "epic" tag has you as a target, and it appears to work. However, I want to use it to replace the GetClosestInstWithTag() used on the StartDanger() function, so the E.F.S. plays only if you're actually fighting a boss, instead of playing while fighting something else with a boss around. But I am failing to make it work with the _soundemitter. Also, already asking this too, because I'm certain that I will be too incompetent to work this around: How do I make so the normal battle music will change to the E.F.S. if a boss is going for you, and vice versa? Link to comment https://forums.kleientertainment.com/forums/topic/68622-check-if-a-monster-or-another-player-is-targeting-you/#findComment-790797 Share on other sites More sharing options...
DarkXero Posted July 8, 2016 Share Posted July 8, 2016 DynamicBleh.zip Link to comment https://forums.kleientertainment.com/forums/topic/68622-check-if-a-monster-or-another-player-is-targeting-you/#findComment-790825 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now