Orim Posted June 30, 2015 Share Posted June 30, 2015 Is such a thing possible?Example: a character is wearing the "Thulecite Crown" which has a proc that causes the player to be shielded for 4 seconds and upon the proc, the character says something related to it.I couldn't think of anything that does something similar so I am in the dark as to how to code it. Link to comment https://forums.kleientertainment.com/forums/topic/55778-say-string-on-proc/ Share on other sites More sharing options...
Developer ImDaMisterL Posted June 30, 2015 Developer Share Posted June 30, 2015 Can't you just take the name of the thing ot does then put ANNOUNCE_EFFECT = "Well, this shield is cool!" Link to comment https://forums.kleientertainment.com/forums/topic/55778-say-string-on-proc/#findComment-651003 Share on other sites More sharing options...
Orim Posted June 30, 2015 Author Share Posted June 30, 2015 Maybe? What would be the proper format for it and where would I put it?I use the ruinshat parts of the "hats" prefab. Link to comment https://forums.kleientertainment.com/forums/topic/55778-say-string-on-proc/#findComment-651004 Share on other sites More sharing options...
Seiai Posted June 30, 2015 Share Posted June 30, 2015 (edited) @Orim,inst.components.talker:Say("Hey i said something!", 2.5,true) and u could put it into an eventlistener that listens for when your character equips something, and check whether its the crown. Edited June 30, 2015 by Seiai Link to comment https://forums.kleientertainment.com/forums/topic/55778-say-string-on-proc/#findComment-651022 Share on other sites More sharing options...
Orim Posted June 30, 2015 Author Share Posted June 30, 2015 @Seiai,That's the code I attempted to use originally and it crashed when the proc happened, which is when I would like for the character to say a line. Something about a nil value. Here's the crash log and I also attached the prefab, if it makes things easier. I added the code to line 20, which is after the game spawns the forcefieldfx. Still very new to coding stuff without an example of something similar [00:00:28]: [string "../mods/Adralmech/scripts/prefabs/orim_hat...."]:20: attempt to index field 'talker' (a nil value)LUA ERROR stack traceback:../mods/Adralmech/scripts/prefabs/orim_hat.lua:20 in (upvalue) ruinshat_proc (Lua) <14-49> inst = 110198 - orim_hat(LIMBO) (valid:true) owner = 109608 - adralmech (valid:true) fx = 110359 - forcefieldfx (valid:true)../mods/Adralmech/scripts/prefabs/orim_hat.lua:53 in (upvalue) tryproc (Lua) <51-55> inst = 110198 - orim_hat(LIMBO) (valid:true) owner = 109608 - adralmech (valid:true)../mods/Adralmech/scripts/prefabs/orim_hat.lua:75 in (local) fn (Lua) <75-75>scripts/entityscript.lua:938 in (method) PushEvent (Lua) <932-955> self (valid:true) = DynamicShadow = DynamicShadow (42125E10) inlimbo = false GetMoistureRateScale = function - scripts/prefabs/player_common.lua:97 SetCameraDistance = function - scripts/prefabs/player_common.lua:1042 ScreenFlash = function - scripts/prefabs/player_common.lua:1096 player_classified = 109609 - player_classified (valid:true) playercolour = table: 2BC8A4F0 IsOverheating = function - scripts/prefabs/player_common.lua:67 Light = Light (421266B0) OnRemoveEntity = function - scripts/prefabs/player_common.lua:530 pendingtasks = table: 2F10E6D0 ShowHUD = function - scripts/prefabs/player_common.lua:1036 sg = sg="wilson", state="idle", time=0.20, tags = "idle,canrotate," IsHUDVisible = function - scripts/prefabs/player_common.lua:1026 ApplyScale = function - scripts/prefabs/player_common.lua:1111 SetGhostMode = function - scripts/prefabs/player_common.lua:446 ShowActions = function - scripts/prefabs/player_common.lua:1030 HUD = HUD OnWakeUp = function - scripts/prefabs/player_common.lua:959 Transform = Transform (42125570) actionreplica = table: 2F10D280 event_listening = table: 2F10E9F0 actioncomponents = table: 2F10C410 lower_components_shadow = table: 2F10C398 GetMaxMoisture = function - scripts/prefabs/player_common.lua:87 prefab = adralmech updatecomponents = table: 26EB7220 ShakeCamera = function - scripts/prefabs/player_common.lua:1056 OnDespawn = function - scripts/prefabs/player_common.lua:977 persists = false MiniMapEntity = MiniMapEntity (421263D0) IsFreezing = function - scripts/prefabs/player_common.lua:57 _OnLoad = function - ../mods/Adralmech/scripts/prefabs/adralmech.lua:54 OnSetSkin = function - scripts/prefabs/player_common.lua:1004 replica = table: 2F10C488 GetTemperature = function - scripts/prefabs/player_common.lua:47 OnSleepIn = function - scripts/prefabs/player_common.lua:931 ghostenabled = true EnableMovementPrediction = function - scripts/prefabs/player_common.lua:407 worldstatewatching = table: 30D2FED0 Network = Network (42126990) GetMoisture = function - scripts/prefabs/player_common.lua:77 LightWatcher = LightWatcher (421260F0) inherentactions = table: 245B03A0 spawntime = 0.033333335071802 SnapCamera = function - scripts/prefabs/player_common.lua:1048 ScreenFade = function - scripts/prefabs/player_common.lua:1089 Physics = Physics (41F653F0) entity = Entity (1D893AE0) children = table: 3D5B5DC8 name = Orim, Samite Healer AttachClassified = function - scripts/prefabs/player_common.lua:519 OnLoad = function - scripts/prefabs/player_common.lua:909 IsActionsVisible = function - scripts/prefabs/player_common.lua:1020 AnimState = AnimState (42125850) SoundEmitter = SoundEmitter (42125B30) CanExamine = function - scripts/prefabs/player_common.lua:20 OnSave = function - scripts/prefabs/player_common.lua:900 GUID = 109608 soundsname = maxwell userid = KU_PrO0aTIH DetachClassified = function - scripts/prefabs/player_common.lua:525 components = table: 2F10C3E8 event_listeners = table: 2F10E838 event = attacked data = table: 3194[00:00:28]: [string "../mods/Adralmech/scripts/prefabs/orim_hat...."]:20: attempt to index field 'talker' (a nil value)LUA ERROR stack traceback: ../mods/Adralmech/scripts/prefabs/orim_hat.lua:20 in (upvalue) ruinshat_proc (Lua) <14-49> ../mods/Adralmech/scripts/prefabs/orim_hat.lua:53 in (upvalue) tryproc (Lua) <51-55> ../mods/Adralmech/scripts/prefabs/orim_hat.lua:75 in (local) fn (Lua) <75-75> scripts/entityscript.lua:938 in (method) PushEvent (Lua) <932-955> scripts/components/combat.lua:435 in (method) GetAttacked (Lua) <372-452> scripts/components/combat.lua:735 in (method) DoAttack (Lua) <701-763> scripts/stategraphs/SGfrog.lua:171 in (field) fn (Lua) <171-171> scripts/stategraph.lua:562 in (method) UpdateState (Lua) <530-574> scripts/stategraph.lua:601 in (method) Update (Lua) <593-621> scripts/stategraph.lua:123 in (method) Update (Lua) <107-146> scripts/update.lua:205 in () ? (Lua) <146-219> [00:00:28]: SCRIPT ERROR! Showing error screen [00:00:36]: Shutdown: shutting up talkerorim_hat.lua Link to comment https://forums.kleientertainment.com/forums/topic/55778-say-string-on-proc/#findComment-651023 Share on other sites More sharing options...
Seiai Posted June 30, 2015 Share Posted June 30, 2015 @Orim, because u are trying to make the item talk, not the owner. Link to comment https://forums.kleientertainment.com/forums/topic/55778-say-string-on-proc/#findComment-651040 Share on other sites More sharing options...
Orim Posted June 30, 2015 Author Share Posted June 30, 2015 @SeiaiOh, duh! How would I go about making it so when the event proc, the line fires? Like you said, it is most likely done through an eventlistener function but the game files are not of much help. Link to comment https://forums.kleientertainment.com/forums/topic/55778-say-string-on-proc/#findComment-651044 Share on other sites More sharing options...
Seiai Posted June 30, 2015 Share Posted June 30, 2015 @Orim, well, u are calling the talker-component for inst, which has a reference to the item at that point. but instead u want to call it for the owner. now have a close look around in that function, if there would be any variable, that looks like it would be holding the owner of the item. Link to comment https://forums.kleientertainment.com/forums/topic/55778-say-string-on-proc/#findComment-651072 Share on other sites More sharing options...
Orim Posted June 30, 2015 Author Share Posted June 30, 2015 @Seiai,The ruinshat_proc local function has multiple mentions of the owner. The parent of the fx.entity is set to the owner so it knows where to spawn the forcefield effect. Same for when the function listens for the "blocked" event which is active when the forcefield is up which in turn fires the sanity damage. Then of course there's the block where the forcefield is removed from the owner entity.No matter where I add the code, I still get the nil value. I assume that's because I either have to change something or something is missing? Link to comment https://forums.kleientertainment.com/forums/topic/55778-say-string-on-proc/#findComment-651080 Share on other sites More sharing options...
Seiai Posted July 1, 2015 Share Posted July 1, 2015 (edited) @Orim, stop looking for other ****, this is the error: [00:00:28]: [string "../mods/Adralmech/scripts/prefabs/orim_hat...."]:20: attempt to index field 'talker' (a nil value) concerning this line, and this line alone: inst.components.talker:Say("Hey I said something!", 2.5,true) and this line crashes, just because u call it on inst, which is the item at that point, and all u have to do, is to call it for owner instead: owner.components.talker:Say("Hey I said something!", 2.5,true) ... Edited July 1, 2015 by Seiai Link to comment https://forums.kleientertainment.com/forums/topic/55778-say-string-on-proc/#findComment-651164 Share on other sites More sharing options...
Orim Posted July 1, 2015 Author Share Posted July 1, 2015 @Seiai, I swear I tried that one, but it works now, thanks. Sorry for not knowing much about LUA and causing you frustration.See, I am not familiar with LUA beyond what I can see in the game files so checking at examples, I didn't even know you could change the "inst" part as the game seems to use primarily that. Link to comment https://forums.kleientertainment.com/forums/topic/55778-say-string-on-proc/#findComment-651188 Share on other sites More sharing options...
Amalleus Posted July 1, 2015 Share Posted July 1, 2015 (edited) this is just pointers. In this example:Inst points to the item.Owner points to the guy.Components points to "folder" of components.Talker points to specific components - not every entity has it, like item can't have Health component (so you can't use inst.components.health for item):Say - function from component Talker, you can read about it, what it does Edited July 1, 2015 by Amalleus Link to comment https://forums.kleientertainment.com/forums/topic/55778-say-string-on-proc/#findComment-651221 Share on other sites More sharing options...
Orim Posted July 1, 2015 Author Share Posted July 1, 2015 @Amalleus,That is very helpful, thank you! Link to comment https://forums.kleientertainment.com/forums/topic/55778-say-string-on-proc/#findComment-651231 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