bassair Posted February 19, 2014 Share Posted February 19, 2014 I have yet another question! I'm way too addicted to coding mods. I'm trying to tell it that if a dude has the trait "bk_pharmacophobia", then when that dude takes pills or is in a room labelled medcentre or pharmacy or medicalstorage or pharmacystorage, then he'll panic out of his mind. I've got the trait working (it has a little sprite and everything) and I've got other traits to do things like panic around zombies and get less depressed outdoors and get objects and feel constant pain, but I can't get it to do this. I thought I was close but... maybe not. My code:CustomTraitsKB_Traits.EveryTenMinutes = function() if getPlayer():HasTrait("bk_pharmacophobia") and getPlayer(0):IsInRoom("medclinic") then getPlayer():getStats():setPanic(1000000); end if getPlayer():HasTrait("bk_pharmacophobia") and getPlayer(0):IsInRoom("medicalstorage") then getPlayer():getStats():setPanic(1000000); end if getPlayer():HasTrait("bk_pharmacophobia") and getPlayer(0):IsInRoom("pharmacy") then getPlayer():getStats():setPanic(1000000); end if getPlayer():HasTrait("bk_pharmacophobia") and getPlayer(0):IsInRoom("pharmacystorage") then getPlayer():getStats():setPanic(1000000); endendCustomTraitsKB_Traits.OnItemUse = function() if getPlayer():HasTrait("bk_pharmacophobia") and getPlayer():getBodyDamage():JustTookPill(self,item) then getplayer():getStats():setPanic(100000); endendEvents.EveryTenMinutes.Add(CustomTraitsKB_Traits.EveryTenMinutes);Events.OnItemUse.Add(CustomTraitsKB_Traits.OnItemUse);I tried it in the EveryTenMinutes, I tried it in OnPlayerUpdate, but it doesn't work. I get the game to automatically give me painkillers so I can test it and it just won't. Can someone point me in the direction of it... well, not won't-ing? Link to comment 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