ZackOcs Posted February 10, 2015 Share Posted February 10, 2015 So, I finally got my coding done on my character who can transform into a demon now, thank you for everyone who has tried to help me, greatly appreciated. But, I wonder, if its possible for one character mod to have more then just one speech?The character I have that transforms into a demon has a different personality then his human form, so I thought it'll be nice to let him say different things while in that form. Anyway, any suggestions are nice, thank you for reading. Link to comment https://forums.kleientertainment.com/forums/topic/50804-is-it-possible-to-have-a-character-mod-to-have-two-speeches/ Share on other sites More sharing options...
DarkXero Posted February 10, 2015 Share Posted February 10, 2015 (edited) I would go like how nightmarerock.lua works. In modmain.lua:local function getstatus(inst, viewer) if viewer.prefab = "MyCharacter" then return viewer.state -- that can be "NORMAL" or "DEMON", put inst.state inside your character prefab endendAddPrefabPostInitAny(function(inst) if inst and (not inst:HasTag("player")) and inst.components.inspectable then inst.components.inspectable.getstatus = getstatus endend)However this will make the GetStatus in the component inspectable.lua not used fully, so if you want to add the "DEAD", "SLEEPING", etc. statuses you will need to make your getstatus function more complex. Because the NORMAL and DEMON would be the only ones used. Then, when you add strings for your character, you do:-- ExampleSTRINGS.CHARACTERS.MyCharacter.DESCRIBE.RESEARCHLAB = { NORMAL = "It breaks down objects into their scientific components.", DEMON = "I hate it."} Edited February 10, 2015 by DarkXero Link to comment https://forums.kleientertainment.com/forums/topic/50804-is-it-possible-to-have-a-character-mod-to-have-two-speeches/#findComment-611741 Share on other sites More sharing options...
rezecib Posted February 10, 2015 Share Posted February 10, 2015 (edited) @ZackOcs, Possible, probably, but definitely not easy. You could change your prefab name on transformation (inst.prefab = "demonchar"), but I would expect to run into issues with saving/loading if you do that. Most places that get character speech pull from the prefab name, so apart from that I don't think there's a good way to do it. Edit: Actually, DarkXero's approach should work for most of the speech entries. I think it might interfere with objects that inherently have multiple states, though. Edited February 10, 2015 by rezecib Link to comment https://forums.kleientertainment.com/forums/topic/50804-is-it-possible-to-have-a-character-mod-to-have-two-speeches/#findComment-611742 Share on other sites More sharing options...
DarkXero Posted February 10, 2015 Share Posted February 10, 2015 (edited) I think it might interfere with objects that inherently have multiple states, though. NEW IDEA:AddComponentPostInit("inspectable", function(self) local old = self.GetStatus function self:GetStatus(viewer) local status = old(self, viewer) if viewer.prefab == "MyCharacter" then status = viewer.status..status end return status endend) Edited February 10, 2015 by DarkXero Link to comment https://forums.kleientertainment.com/forums/topic/50804-is-it-possible-to-have-a-character-mod-to-have-two-speeches/#findComment-611749 Share on other sites More sharing options...
DarkXero Posted February 10, 2015 Share Posted February 10, 2015 (edited) However I must note that this only works for strings in DESCRIBE, duplicating everything into NORMAL and DEMON, and NORMALDEAD and DEMONDEAD, etc. The real deal is editing the global function GetString, GetActionString, GetDescription, GetActionFailString, etc. in stringutil.lua. I will look into it later. Edited February 10, 2015 by DarkXero Link to comment https://forums.kleientertainment.com/forums/topic/50804-is-it-possible-to-have-a-character-mod-to-have-two-speeches/#findComment-611773 Share on other sites More sharing options...
DarkXero Posted February 10, 2015 Share Posted February 10, 2015 Well, update. As rezecib said, GetString can get passed an inst argument, that can be a string or a table.Well, I have no idea how to tag a string denoting a prefab into the entity that called GetString.If there are two players using the mod, I don't know who is doing the GetString to go check their state.So I would stick to the inspectable component and the DESCRIBE strings. Unless you want to make two prefabs, a normal and a demon one and make them switch, then assign a speech to each one.I had no issues switching from Wilson to Willow and back with a transformation, and saving and loading, but I don't know if there may be any data corruption lingering about, so I wouldn't risk it.I hoped to see something for Woodie but then I saw that the werebeaver has no speech for itself. Link to comment https://forums.kleientertainment.com/forums/topic/50804-is-it-possible-to-have-a-character-mod-to-have-two-speeches/#findComment-611834 Share on other sites More sharing options...
mikeek Posted February 11, 2015 Share Posted February 11, 2015 I did something like this for a transforming character! Past a certain sanity threshold her lines change to be more violent, etc. All I did was create two copies of the speech file, one normal and one 'mad', then in the transformation functions I just called the function to set the speech lines to one or the other. I am away from my computer right now. When I get back to it I can post mpre specific examples. Link to comment https://forums.kleientertainment.com/forums/topic/50804-is-it-possible-to-have-a-character-mod-to-have-two-speeches/#findComment-612106 Share on other sites More sharing options...
DarkXero Posted February 11, 2015 Share Posted February 11, 2015 mikeek, I think I know what you mean. On transformation you run:STRINGS.CHARACTER.MYCHAR = require "NewSpeech"so that the new speech appears. Then turning back, you do the same for the initial speech. I considered this, but this has a small problem in multiplayer. Imagine two mod characters in a server.If someone transforms, the other would also have these lines, from your point of view. For single player or one character only, this works perfectly. Link to comment https://forums.kleientertainment.com/forums/topic/50804-is-it-possible-to-have-a-character-mod-to-have-two-speeches/#findComment-612163 Share on other sites More sharing options...
mikeek Posted February 12, 2015 Share Posted February 12, 2015 Yes, that's what I was doing. Admittedly I didn't test it terribly thoroughly, since it was still in the works. I suppose for the sake of robustness you'd want to come up with an alternate solution. Link to comment https://forums.kleientertainment.com/forums/topic/50804-is-it-possible-to-have-a-character-mod-to-have-two-speeches/#findComment-612181 Share on other sites More sharing options...
rezecib Posted February 12, 2015 Share Posted February 12, 2015 @DarkXero, On the other hand, it would be quite easy to network the replacement of the speech the same way on clients. Just a simple net_event or net_bool. Link to comment https://forums.kleientertainment.com/forums/topic/50804-is-it-possible-to-have-a-character-mod-to-have-two-speeches/#findComment-612217 Share on other sites More sharing options...
DarkXero Posted February 12, 2015 Share Posted February 12, 2015 rezecib, indeed. If only one person plays the mod character, you can use the net to make the speech change in the client.It's up to OP if he doesn't mind the small inconsistency that two or more mod characters may bring.I personally don't mind it. Link to comment https://forums.kleientertainment.com/forums/topic/50804-is-it-possible-to-have-a-character-mod-to-have-two-speeches/#findComment-612220 Share on other sites More sharing options...
mikeek Posted February 12, 2015 Share Posted February 12, 2015 The people I play with have a tendency to pick different characters from one another, so even if I were playing my mod character it's highly unlikely I would notice. Link to comment https://forums.kleientertainment.com/forums/topic/50804-is-it-possible-to-have-a-character-mod-to-have-two-speeches/#findComment-612272 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