lxFirebal69xl Posted June 14, 2015 Share Posted June 14, 2015 Exactly as it says on the tin, I've been getting the AI ready for my game when this started happening, basically when the monster atackes you, he does the alert noise again when you run away from him, doesn't matter if it hits you or not, he keeps spamming the alert noise over and over again, is there any way to make it so that it only does the alert noise once? Quote Link to comment Share on other sites More sharing options...
josk Posted June 14, 2015 Share Posted June 14, 2015 Where the code for the noise is if self.alertnoise == false then playsound code etc self.alertnoise = true end Quote Elite Cobra Squad Link to comment Share on other sites More sharing options...
lxFirebal69xl Posted June 14, 2015 Author Share Posted June 14, 2015 Where the code for the noise is if self.alertnoise == false then playsound code etc self.alertnoise = true end Problem is, I don't know where exactly to put this code, I think it's here or around here. I'm not sure though... if self.entity:Follow(self.target.entity,self.speed,self.maxaccel) then if prevmode~="chase" then if self.sound.alert then self.entity:EmitSound(self.sound.alert) end end Quote Link to comment Share on other sites More sharing options...
josk Posted June 15, 2015 Share Posted June 15, 2015 To use self.alertnoise you would have to put at the top of your script Script.alertnoise = false if self.entity:Follow(self.target.entity,self.speed,self.maxaccel) then if prevmode~="chase" then if self.sound.alert then if self.alertnoise == false then self.entity:EmitSound(self.sound.alert) self.alertnoise = true end end end end The above is quite crude but should do the job. You will also need to set the alertnoise to true again at some point. It will be worth going through the tutorials on Lua, the basics can be picked up quite quick. Quote Elite Cobra Squad Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.