Mila Posted April 2, 2014 Share Posted April 2, 2014 Hello! I'm struggling with my custom character, I can draw all right but when it comes to programming I can't get past copying, pasting and cropping stuff until the game stops crashing. So I wanted to ask someone with some expertise in coding characters here on the forum for a trade, I will draw everything your character needs (provided there is a template for it) and I get a coded character in exchange. This is the first character I drew, she will probably get new clothes but I wanted to see her in-game and test what codes I could for her before finishing up. Thank you very much! ♥ Link to comment Share on other sites More sharing options...
chromiumboy Posted April 3, 2014 Share Posted April 3, 2014 Mila is looking very nice! What sort of traits were you planning on having coded? Link to comment Share on other sites More sharing options...
Mila Posted April 3, 2014 Author Share Posted April 3, 2014 Thank you! Her name's Wilhelmina though, I'd feel bad putting myself inside a game that I'd probably get myself killed off very easily. I want to make her a vampire (oh so original, I know...), because after living over 150 days in the game I thought it would be nice to explore during the night to see the differences from trying to survive during the day, and her chances of starving would be bigger too. These are the traits I thought for her: Insomniac (I copied this from wickerbottom so it's done) solvedCan only eat meat solved (I managed to do this but I wanted to include monster meat without the sanity loss)Burns (literally) in the sun if not wearing certain headgears (straw hat / top hat / beekeeper hat / bush hat / RoG Rain hat) or an umbrella (she will start off with one) partially solved* I thought about making a custom item for her (a manteau) but placing her head in the right place was tiresome enough so I scrapped that for later or never.Loses sanity (medium) during the day (protected from the sun or not), doesn't lose or gain it on dusk or night. (managed to make her stop losing it during the night but not lose it during the day) solvedLoses sanity when hunger bar is low solvedRecovers health automatically but spends hunger points to do so (just like wearing the life giving amulet) solvedIncreases attack when sanity is low solvedIs neutral (or ally) to Batlisks and gains sanity when near them (which would make it useful for making camp outside a hole and hide during the night), Pigmen and Bunnymen are always aggressive towards her. (I managed to get her neutral towards Batlisks but the game crashes when I attack them / I am attacked near them)Faint Nightvision (I already managed to do this one), thus making her immune to Charlie. solvedFlowers and Evil Flowers do nothing to her sanity, neither does digging graves but she will still lose it during a fight.That's a lot, I know Orz but I wanted to make a character with a different gameplay and what I thought would be easy to code (though it's proving itself to be a ridiculously hard task for me) And here's my deviantart to get examples of what I can draw: http://mila-valentine.deviantart.com/ Link to comment Share on other sites More sharing options...
chromiumboy Posted April 3, 2014 Share Posted April 3, 2014 That's a few perks I've happen to have done some work on a vampire character before. To get her to burn in daylight, you could insertinst:DoPeriodicTask(0.5, function() DayLightCheck(inst) end)into the the main function of the character's prefab file. Then above this function, pastelocal function DayLightCheck(inst) local helditem = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS) local hatitem = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HEAD) if inst.components.health and not inst.components.health:IsDead() and not inst.is_teleporting and GetClock():IsDay() and inst.components.inventory and (not helditem or helditem.prefab ~= "umbrella") and not hatitem then inst.components.health:DoFireDamage(5) endendIf she's carrying an umbrella, or is wearing a hat she won't burn. The rest will take more coded. It may be an idea to find the three or four which best define the character than start there. Like, she only eats meat, burns in the sunlight and has night vision. Link to comment Share on other sites More sharing options...
Mila Posted April 3, 2014 Author Share Posted April 3, 2014 Thank you! Ok, aparently I managed to make her carnivore, insomniac and having nightvision, these three are ok and working with no problem. Now the "burns in the sunlight" is also working, is there a way to specify which hats I want to use for protection? because the prefab for all the hats is the same, so I can't use the same code as the 'umbrella' one, right? I also managed to make her "heal" by wearing out her hunger with this code: local function Heal(inst) if (inst.components.health and inst.components.health:IsHurt()) and (inst.components.hunger and inst.components.hunger.current > 1 )then inst.components.health:DoDelta(1) inst.components.hunger:DoDelta(-1) endendand inst:DoPeriodicTask(1, function() Heal(inst) end)The only thing that bothers me is the sound it makes when healing but I found no way of disabling it. Link to comment Share on other sites More sharing options...
chromiumboy Posted April 3, 2014 Share Posted April 3, 2014 You can specify a hat prefab. Look through the hat.lua prefab file and you'll find entries with 'top', 'straw', 'flower', etc. Just add 'hat' to the end of these keywords to get the prefab name. Eg. 'tophat' is the top hat, 'flowerhat' is the garlad, etc. Also if you use the heath dodelta function there will be a noise. You can use the get and set health percentage functions to get around this though. Link to comment Share on other sites More sharing options...
MidrealmDM Posted April 4, 2014 Share Posted April 4, 2014 I'm not sure how to call it only during the day but I believe inst.components.sanity.dapperness = -TUNING.DAPPERNESS_SMALL(note the negative) This will result in sanity loss during the day equal to the sanity gain from a garland You should be able to adjust the numbers by using something likeinst.components.sanity.dapperness = (-TUNING.DAPPERNESS_SMALL * 2)Or you can just input a static number, However Dapperness changes with the length of the day,so if you want more sanity loss per unit of time when the days are longer than you might want tostick with dapperness. (NOTE: I'm only just beginning to figure this out myself so I could be totally wrong about thishowever a lot of information can be found in the tuning.lua in the game scripts folder forother levels of dapperness) Link to comment Share on other sites More sharing options...
chromiumboy Posted April 5, 2014 Share Posted April 5, 2014 Hi Mila, I've had some free time to work on your character based on your list in the OP Replace the DayLightCheck function I gave you withlocal function DayLightCheck(inst) local helditem = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS) local hatitem = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HEAD) if inst.components.health and not inst.components.health:IsDead() and not inst.is_teleporting and GetClock():IsDay() and inst.components.inventory then if helditem and helditem.prefab == "umbrella" then -- Null elseif hatitem and (hatitem.prefab == "strawhat" or hatitem.prefab == "tophat" or hatitem.prefab == "beehat" or hatitem.prefab == "bushhat") then -- Null else inst.components.health:DoFireDamage(5) end end if inst.components.sanity and inst.components.sanity:GetPercent() < 0.3 and inst.components.combat then inst.components.combat.damagemultiplier = 1.5 else inst.components.combat.damagemultiplier = 1.0 endendThe bottom part of the function causes her, when at less than 30% sanity, to increase her damage by 50%. Feel free to adjust these numbers. Also, insert these into the body of the main functionTUNING.SANITY_DAY_GAIN = -10/60 TUNING.SANITY_NIGHT_LIGHT = 0TUNING.SANITY_NIGHT_MID = 0TUNING.SANITY_NIGHT_DARK = 0 inst.components.sanity.custom_rate_fn = SanityFnand this above the main functionlocal function SanityFn(inst) local delta = 0 if inst.components.hunger and inst.components.hunger:GetPercent() < 0.3 and inst.components.sanity then delta = -15/60 end return deltaendThis will cause her to lose 10 sanity per minute during the day, lose no sanity at dusk or night and lose 15 sanity per minute when her hunger is less than 30%. Again feel free to adjust these values. Link to comment Share on other sites More sharing options...
Mila Posted April 6, 2014 Author Share Posted April 6, 2014 MidrealmDM thank you for the imput but chromiunboy's code worked for reducing her sanity during the day. I'm sorry for taking long to reply here, I went on a trip and returned just today. It seems all the codes are working well so far! And you can PM or just post here about the character you want me to draw so I can get started with it too! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.