AkaiNight Posted February 5, 2017 Share Posted February 5, 2017 when i choice my character and start the game i got this here is my characters folder Alishia Frostfox.rar Link to comment Share on other sites More sharing options...
AkaiNight Posted February 5, 2017 Author Share Posted February 5, 2017 i found this but it crush with my other food code inst.components.eater.Eat_orig = inst.components.eater.Eat function inst.components.eater:Eat( food ) if self:CanEat(food) then if food.components.edible.sanityvalue < 0 then food.components.edible.sanityvalue = 0 end if food.components.edible.healthvalue < 0 then food.components.edible.healthvalue = 10 end end return inst.components.eater:Eat_orig(food) end crush with that local function oneat(inst, food) if food and food.components.edible and food.prefab == "fishsticks" then inst.components.talker:Say("Itadakimasu. Nya~", 1.2, true) inst.components.health:DoDelta(50) inst.components.sanity:DoDelta(50) inst.components.hunger:DoDelta(50) elseif food and food.components.edible and food.prefab == "fishtacos" then inst.components.health:DoDelta(50) inst.components.sanity:DoDelta(50) inst.components.hunger:DoDelta(50) inst.components.talker:Say("Itadakimasu. Nya~", 1.2, true) elseif food and food.components.edible and food.prefab == "ice" then inst.components.health:DoDelta(5) inst.components.sanity:DoDelta(10) inst.components.talker:Say("Itadakimasu. Nya~", 1.2, true) end end Link to comment Share on other sites More sharing options...
Ricoom Posted February 5, 2017 Share Posted February 5, 2017 Look into client log to see where the issue lies. It should tell you which line the error occured Link to comment Share on other sites More sharing options...
AkaiNight Posted February 5, 2017 Author Share Posted February 5, 2017 I'm about to solve problem but thanks anyway Link to comment Share on other sites More sharing options...
AkaiNight Posted February 5, 2017 Author Share Posted February 5, 2017 But this code not works local function onattackother(inst, data) --innocent creatures part if data.target:HasTag("rabbit") then inst.components.talker:Say("Gomennasai Rabbit-chan. Nya~") elseif data.target:HasTag("redbird") then inst.components.talker:Say("Gomennasai Bird-chan. Nya~") elseif data.target:HasTag("snowbird") then inst.components.talker:Say("Gomennasai Bird-chan. Nya~") elseif data.target:HasTag("canary") then inst.components.talker:Say("Gomennasai Bird-chan. Nya~") elseif data.target.HasTag("crow") then inst.components.talker:Say("I hope itachi-san does not kill me. Nya~") elseif data.target:HasTag("deer") then inst.components.talker:Say("Gomennasai Deer-chan. Nya~") elseif data.target:HasTag("grassgekko") then inst.components.talker:Say("Gomennasai Gekko-chan. Nya~") elseif data.target:HasTag("mole") then inst.components.talker:Say("Gomennasai Mole-chan. Nya~") elseif data.target:HasTag("beardling") then inst.components.talker:Say("Gomennasai BlackUnknownRabbitThing-chan... I guess. Nya~") elseif data.target:HasTag("perd") then inst.components.talker:Say("You shouldn't ate my berries! Nya~") --bosses part elseif data.target:HasTag("minotaur") then inst.components.talker:Say("You must die for piece of underworld Mino-chan. Nya~") elseif data.target:HasTag("deerclops") then inst.components.talker:Say("The Crown will be mine ice-creature! Nya~") elseif data.target:HasTag("spiderqueen") then inst.components.talker:Say("You will die with your children evil-creature! Nya~") elseif data.target:HasTag("leif") then inst.components.talker:Say("You will die for piece of forrest evil-tree! Nya~") --isn't it ironic? elseif data.target:HasTag("leif_sparse") then inst.components.talker:Say("You can not hide from me evil-tree! I can feel you! Nya~") elseif data.target:HasTag("bearger") then inst.components.talker:Say("How you dare to eat my food! You fool big-bear! Nya~") elseif data.target:HasTag("dragonfly") then inst.components.talker:Say("You will die fire-puppet! As my twin will! Nya~") elseif data.target:HasTag("Goose") then inst.components.talker:Say("I will save your soul cursed-bird. Nya~") elseif data.target:HasTag("beequeen") then inst.components.talker:Say("You can no longer hurt creatures with your giant stinger dangerous-honey! Nya~") elseif data.target:HasTag("klaus") then inst.components.talker:Say("I will kill you for save the deers evil-deer! Nya~") elseif data.target:HasTag("toadstool") then inst.components.talker:Say("You can no longer poison the bunnies overgrown frog! Nya~") end end local function master_init(inst) inst:ListenForEvent("attackother", onattackother) end Link to comment Share on other sites More sharing options...
AkaiNight Posted February 5, 2017 Author Share Posted February 5, 2017 and this one not works too local function onkilled(inst, data) if data.victim ~= nil and data.victim.components.health ~= nil then elseif math.random < 0.2 then inst.components.talker:Say("Your soul is sleeping now. Nya~") elseif math.random < 0.2 then inst.components.talker:Say("I told you to run. Nya~") elseif math.random < 0.2 then inst.components.talker:Say("Did you die already? Nya~") elseif math.random < 0.2 then inst.components.talker:Say("Noone can be better than me... Exempt me! Nya~") elseif math.random < 1 then inst.components.talker:Say("Well you were touhg... For a baby. Nya~") end end Link to comment Share on other sites More sharing options...
Ricoom Posted February 5, 2017 Share Posted February 5, 2017 I think it is not good way to do this.. Threres a better way to implement the speech parts for mobs. in any case instead of tons of else ifs you could use some of the ways described here. http://lua-users.org/wiki/SwitchStatement for much neater code. Link to comment Share on other sites More sharing options...
. . . Posted February 6, 2017 Share Posted February 6, 2017 (edited) 14 hours ago, AkaiNight said: But this code not works Spoiler local function onattackother(inst, data) --innocent creatures part if data.target:HasTag("rabbit") then inst.components.talker:Say("Gomennasai Rabbit-chan. Nya~") elseif data.target:HasTag("redbird") then inst.components.talker:Say("Gomennasai Bird-chan. Nya~") elseif data.target:HasTag("snowbird") then inst.components.talker:Say("Gomennasai Bird-chan. Nya~") elseif data.target:HasTag("canary") then inst.components.talker:Say("Gomennasai Bird-chan. Nya~") elseif data.target.HasTag("crow") then inst.components.talker:Say("I hope itachi-san does not kill me. Nya~") elseif data.target:HasTag("deer") then inst.components.talker:Say("Gomennasai Deer-chan. Nya~") elseif data.target:HasTag("grassgekko") then inst.components.talker:Say("Gomennasai Gekko-chan. Nya~") elseif data.target:HasTag("mole") then inst.components.talker:Say("Gomennasai Mole-chan. Nya~") elseif data.target:HasTag("beardling") then inst.components.talker:Say("Gomennasai BlackUnknownRabbitThing-chan... I guess. Nya~") elseif data.target:HasTag("perd") then inst.components.talker:Say("You shouldn't ate my berries! Nya~") --bosses part elseif data.target:HasTag("minotaur") then inst.components.talker:Say("You must die for piece of underworld Mino-chan. Nya~") elseif data.target:HasTag("deerclops") then inst.components.talker:Say("The Crown will be mine ice-creature! Nya~") elseif data.target:HasTag("spiderqueen") then inst.components.talker:Say("You will die with your children evil-creature! Nya~") elseif data.target:HasTag("leif") then inst.components.talker:Say("You will die for piece of forrest evil-tree! Nya~") --isn't it ironic? elseif data.target:HasTag("leif_sparse") then inst.components.talker:Say("You can not hide from me evil-tree! I can feel you! Nya~") elseif data.target:HasTag("bearger") then inst.components.talker:Say("How you dare to eat my food! You fool big-bear! Nya~") elseif data.target:HasTag("dragonfly") then inst.components.talker:Say("You will die fire-puppet! As my twin will! Nya~") elseif data.target:HasTag("Goose") then inst.components.talker:Say("I will save your soul cursed-bird. Nya~") elseif data.target:HasTag("beequeen") then inst.components.talker:Say("You can no longer hurt creatures with your giant stinger dangerous-honey! Nya~") elseif data.target:HasTag("klaus") then inst.components.talker:Say("I will kill you for save the deers evil-deer! Nya~") elseif data.target:HasTag("toadstool") then inst.components.talker:Say("You can no longer poison the bunnies overgrown frog! Nya~") end end local function master_init(inst) inst:ListenForEvent("attackother", onattackother) end That code seems you just want your character to say custom lines for different enemies, right? So, instead in speech_YOURCHARACTER.lua in the " BATTLECRY = { }," area add names of the entities prefab name you want a custom battle cry against, for example look at how I did it for my character. Spoiler BATTLECRY = { GENERIC = "Forgive me!", PIG = "Rest in pork chops!", PREY = "The hunt is on!", CATCOON = "Ready or not, here I come!", BUZZARD = "Have some death!", KRAMPUS = "Special delivery!", BISHOP_NIGHTMARE = "Confess your sins!", BISHOP = "Confess your sins!", ROOK = "Danger, Wilson Robinson!", KNIGHT = "I'll destroy you, you pile of junk!", KNIGHT_NIGHTMARE = "I'll destroy you, you pile of junk!", SPIDER = "Get squashed!", SPIDER_WARRIOR = "You're no match for me!", HOUND = "Bad dog, bad dog!", FIREHOUND = "Simmer down!", ICEHOUND = "Chill out!", DEERCLOPS = "This'll be the last thing you see!", BEARGER = "Bear hug!", DRAGONFLY = "I'll take you on, you overgrown bug!", Goose = "You're goin' down weirdo!", LEIF = "I'll chop ya to bits!", LEIF_SPARSE = "I'll chop ya to bits!", SPIDERQUEEN = "Overgrown bug!", WILSON = "I hate to do this!", WOLFGANG = "C'mon brute!", WAXWELL = "You're goin' down!", WX78 = "Tin-plated fool!", WILLOW = "Sorry about this, hotstuff!", WENDY = "Hope you being a ghost!", WICKERBOTTOM = "What have I become?!", WES = "I've always hated clowns!", MANDRAKE_ACTIVE = "Get over here, you 'lil runt!", LITTLE_WALRUS = "Get over here, twerp!", TENTACLE = "Freakin' monster!", MOSQUITO = "Eugh!", WEREPIG = "Where's my silver stake at?!", ADAM = "There can only be one!!" -- Notice how there's no "," at the end, keep it that way or crash. }, Edited February 6, 2017 by SuperDavid Link to comment Share on other sites More sharing options...
AkaiNight Posted February 6, 2017 Author Share Posted February 6, 2017 Thanks i'll try Link to comment Share on other sites More sharing options...
AkaiNight Posted February 6, 2017 Author Share Posted February 6, 2017 Come on! It's taking so much time i have no time for it. Must be more easy way Link to comment Share on other sites More sharing options...
Lumina Posted February 6, 2017 Share Posted February 6, 2017 I don't see how this take more time than your previous try. Link to comment Share on other sites More sharing options...
AkaiNight Posted February 6, 2017 Author Share Posted February 6, 2017 Well when i start to do that i feel like i must edit it for all creatures. Then it's going to out of control. Link to comment Share on other sites More sharing options...
AkaiNight Posted February 6, 2017 Author Share Posted February 6, 2017 21 hours ago, Ricoom said: I think it is not good way to do this.. Threres a better way to implement the speech parts for mobs. in any case instead of tons of else ifs you could use some of the ways described here. http://lua-users.org/wiki/SwitchStatement for much neater code. It seems like a great guild but english is not my main language and it's so complicated for me. But thanks anyway Link to comment Share on other sites More sharing options...
. . . Posted February 6, 2017 Share Posted February 6, 2017 8 hours ago, AkaiNight said: Come on! It's taking so much time i have no time for it. Must be more easy way Lots of mods take time! I mean I've been working on my mod for like a year now , so just take your time & don't be in a hurry to make your mod! Like as long as you have the motivation then you can keep going no matter how long it takes~! Link to comment Share on other sites More sharing options...
Lumina Posted February 6, 2017 Share Posted February 6, 2017 5 minutes ago, SuperDavid said: Lots of mods take time! I mean I've been working on my mod for like a year now , so just take your time & don't be in a hurry to make your mod! Like as long as you have the motivation then you can keep going no matter how long it takes~! Yeah, i'm in my mod for two and half year (not working on it all the time, but still very slow) and maybe i'm a little dispersed, but things like this, even if it's long, could be done over time. I have some description and speech to do, i do a little, do something else, do a little, ... And i know i probably will not do some custom speech for everything because i find it annoying but it's not mandatory after all so no stress. Link to comment Share on other sites More sharing options...
AkaiNight Posted February 7, 2017 Author Share Posted February 7, 2017 9 hours ago, Lumina said: Yeah, i'm in my mod for two and half year (not working on it all the time, but still very slow) and maybe i'm a little dispersed, but things like this, even if it's long, could be done over time. I have some description and speech to do, i do a little, do something else, do a little, ... And i know i probably will not do some custom speech for everything because i find it annoying but it's not mandatory after all so no stress. 9 hours ago, SuperDavid said: Lots of mods take time! I mean I've been working on my mod for like a year now , so just take your time & don't be in a hurry to make your mod! Like as long as you have the motivation then you can keep going no matter how long it takes~! Oh come on. I did not mean that i can give it more time i will but i am still working on character.lua and in speech.lua there is only 1 thing i can write for any mob but for boss there must be more line and i don't know how to use math.random code in speech.lua(well i can't use it in character.lua too) so i need more codes i can't find them Link to comment Share on other sites More sharing options...
AkaiNight Posted February 9, 2017 Author Share Posted February 9, 2017 local function onkilled(inst, data) if data.victim ~= nil and data.victim.components.health ~= nil then inst.components.sanity:DoDelta(0) elseif math.random < 0.2 then inst.components.talker:Say("Your soul is sleeping now. Nya~") elseif math.random < 0.2 then inst.components.talker:Say("I told you to run. Nya~") elseif math.random < 0.2 then inst.components.talker:Say("Did you die already? Nya~") elseif math.random < 0.2 then inst.components.talker:Say("Noone can be better than me... Exempt me! Nya~") elseif math.random < 1 then inst.components.talker:Say("Well you were touhg... For a baby. Nya~") end end local function master_init(inst) inst:ListenForEvent("killed", onkilled) end This code is not working i don't know what is wrong? can anyone tell me? Link to comment Share on other sites More sharing options...
Lumina Posted February 9, 2017 Share Posted February 9, 2017 I don't understand why there is a lot of elseif math.random < 0.2 then inst.components.talker:Say("Your soul is sleeping now. Nya~") elseif math.random < 0.2 then inst.components.talker:Say("I told you to run. Nya~") elseif math.random < 0.2 then inst.components.talker:Say("Did you die already? Nya~") elseif math.random < 0.2 then inst.components.talker:Say("Noone can be better than me... Exempt me! Nya~") I mean i'm not familiar with code, but it seems to me that it's like "if the result is A, then, else if the result is A, then, else if the result is A, then", and how it's supposed to work ? Maybe you could make a table with the line you want and a choice between the table randomly ? So for example, you have this for flower_evil.lua local names = {"f1","f2","f3","f4","f5","f6","f7","f8"} inst.animname = names[math.random(#names)] Maybe you can do something like local sentences = {"Blabla","I say this","Nya !","Monster, monster","I won","Whatever","I don't have idea anymore","And the last"} And a function so the sayer say something of this table ? Don't know what the function would be exactly... Link to comment Share on other sites More sharing options...
AkaiNight Posted February 9, 2017 Author Share Posted February 9, 2017 1 hour ago, Lumina said: I don't understand why there is a lot of elseif math.random < 0.2 then inst.components.talker:Say("Your soul is sleeping now. Nya~") elseif math.random < 0.2 then inst.components.talker:Say("I told you to run. Nya~") elseif math.random < 0.2 then inst.components.talker:Say("Did you die already? Nya~") elseif math.random < 0.2 then inst.components.talker:Say("Noone can be better than me... Exempt me! Nya~") I mean i'm not familiar with code, but it seems to me that it's like "if the result is A, then, else if the result is A, then, else if the result is A, then", and how it's supposed to work ? Maybe you could make a table with the line you want and a choice between the table randomly ? So for example, you have this for flower_evil.lua local names = {"f1","f2","f3","f4","f5","f6","f7","f8"} inst.animname = names[math.random(#names)] Maybe you can do something like local sentences = {"Blabla","I say this","Nya !","Monster, monster","I won","Whatever","I don't have idea anymore","And the last"} And a function so the sayer say something of this table ? Don't know what the function would be exactly... well thanks for the idea i'll try Link to comment Share on other sites More sharing options...
AkaiNight Posted February 9, 2017 Author Share Posted February 9, 2017 Aah. It's over of my skills i can't make it able with a code. :/ Link to comment Share on other sites More sharing options...
RedHairedHero Posted February 10, 2017 Share Posted February 10, 2017 local function onkilled(inst, data) if data.victim ~= nil and data.victim.components.health ~= nil then --This basically does nothing, DoDelta is to either add or subtract sanity. --inst.components.sanity:DoDelta(0) --I assume you want your character to say a random quote out of the listed options. local random = math.random if random >= .8 then inst.components.talker:Say("Your soul is sleeping now. Nya~") elseif random >= .6 and random < .8 then inst.components.talker:Say("I told you to run. Nya~") elseif random >= .4 and random < .6 then inst.components.talker:Say("Did you die already? Nya~") elseif random >= .2 and random < .4 then inst.components.talker:Say("Noone can be better than me... Exempt me! Nya~") else inst.components.talker:Say("Well you were tough... For a baby. Nya~") end end end Link to comment Share on other sites More sharing options...
AkaiNight Posted February 10, 2017 Author Share Posted February 10, 2017 45 minutes ago, RedHairedHero said: local function onkilled(inst, data) if data.victim ~= nil and data.victim.components.health ~= nil then --This basically does nothing, DoDelta is to either add or subtract sanity. --inst.components.sanity:DoDelta(0) --I assume you want your character to say a random quote out of the listed options. local random = math.random if random >= .8 then inst.components.talker:Say("Your soul is sleeping now. Nya~") elseif random >= .6 and random < .8 then inst.components.talker:Say("I told you to run. Nya~") elseif random >= .4 and random < .6 then inst.components.talker:Say("Did you die already? Nya~") elseif random >= .2 and random < .4 then inst.components.talker:Say("Noone can be better than me... Exempt me! Nya~") else inst.components.talker:Say("Well you were tough... For a baby. Nya~") end end end oh thanks a lot i tryed many things but it's not works i hope that'll work Link to comment Share on other sites More sharing options...
AkaiNight Posted February 11, 2017 Author Share Posted February 11, 2017 On 10.02.2017 at 8:58 PM, RedHairedHero said: local function onkilled(inst, data) if data.victim ~= nil and data.victim.components.health ~= nil then --This basically does nothing, DoDelta is to either add or subtract sanity. --inst.components.sanity:DoDelta(0) --I assume you want your character to say a random quote out of the listed options. local random = math.random if random >= .8 then inst.components.talker:Say("Your soul is sleeping now. Nya~") elseif random >= .6 and random < .8 then inst.components.talker:Say("I told you to run. Nya~") elseif random >= .4 and random < .6 then inst.components.talker:Say("Did you die already? Nya~") elseif random >= .2 and random < .4 then inst.components.talker:Say("Noone can be better than me... Exempt me! Nya~") else inst.components.talker:Say("Well you were tough... For a baby. Nya~") end end end it's not working. Link to comment Share on other sites More sharing options...
RedHairedHero Posted February 11, 2017 Share Posted February 11, 2017 58 minutes ago, AkaiNight said: it's not working. Replace math.random with math.random() I tested it after this change and it seems to work perfectly. Link to comment Share on other sites More sharing options...
AkaiNight Posted February 12, 2017 Author Share Posted February 12, 2017 13 hours ago, RedHairedHero said: Replace math.random with math.random() I tested it after this change and it seems to work perfectly. Oh thanks a a lot. 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