Merkyrrie Posted April 7, 2025 Share Posted April 7, 2025 5 minutes ago, Doodle Monster said: wramp.luaUnavailable It might be because I didn't include the fx in my prefab files Not sure that would cause this, but it might Well that file unfortunately isn't loading on the forums You shouldn't have to include it, so idk. I did get the fx working on my end like this, -- In master_postinit inst.components.combat.onhitotherfn = WrampShadowWeaponFx -- Outside and above master_postinit local function WrampShadowWeaponFx(inst, target) if (inst.components.sanity and inst.components.sanity:GetPercent() <= .5) and target ~= nil and target:IsValid() then -- If sanity is below 50% and target is valid, skipping the other if statement. local fx_prefab = "wanda_attack_shadowweapon_old_fx" if fx_prefab ~= nil then -- Makes sure the fx prefab name was given before trying to spawn it local fx = SpawnPrefab(fx_prefab) -- Spawns the fx local x, y, z = target.Transform:GetWorldPosition() -- Gets the target's world position local radius = target:GetPhysicsRadius(.5) -- Get target's radius local angle = (inst.Transform:GetRotation() - 90) * DEGREES -- Get target's angle fx.Transform:SetPosition(x + math.sin(angle) * radius, 0, z + math.cos(angle) * radius) -- Moves the fx to the same position in the world as the target end end end This is kinda the absolute bare minimum required to make it function Link to comment https://forums.kleientertainment.com/forums/topic/165121-adding-fx-to-character-attack-when-below-sanity-threshold/page/2/#findComment-1811092 Share on other sites More sharing options...
Doodle Monster Posted April 7, 2025 Author Share Posted April 7, 2025 Okay, I think the problem is somewhere else in my prefab file if you can get it to work. Let me try moving the function to the top wramp.lua Link to comment https://forums.kleientertainment.com/forums/topic/165121-adding-fx-to-character-attack-when-below-sanity-threshold/page/2/#findComment-1811093 Share on other sites More sharing options...
Doodle Monster Posted April 7, 2025 Author Share Posted April 7, 2025 Where do I put the function? I had it above local function onload wramp.lua Link to comment https://forums.kleientertainment.com/forums/topic/165121-adding-fx-to-character-attack-when-below-sanity-threshold/page/2/#findComment-1811094 Share on other sites More sharing options...
Merkyrrie Posted April 7, 2025 Share Posted April 7, 2025 4 minutes ago, Doodle Monster said: Where do I put the function? I had it above local function onload wramp.lua 5.58 kB · 1 download I believe the 'and print("NORMAL_FX")' is whats currently breaking it. Change it from this local fx_prefab = "wanda_attack_shadowweapon_normal_fx" and print("NORMAL FX") or nil to just this local fx_prefab = "wanda_attack_shadowweapon_normal_fx" Link to comment https://forums.kleientertainment.com/forums/topic/165121-adding-fx-to-character-attack-when-below-sanity-threshold/page/2/#findComment-1811095 Share on other sites More sharing options...
Doodle Monster Posted April 7, 2025 Author Share Posted April 7, 2025 OH I think I found it I have something else looking for the same thing inst:ListenForEvent("sanitydelta", CalculateStrength) wramp.lua Link to comment https://forums.kleientertainment.com/forums/topic/165121-adding-fx-to-character-attack-when-below-sanity-threshold/page/2/#findComment-1811096 Share on other sites More sharing options...
Merkyrrie Posted April 7, 2025 Share Posted April 7, 2025 2 minutes ago, Merkyrrie said: I believe the 'and print("NORMAL_FX")' is whats currently breaking it. Change it from this local fx_prefab = "wanda_attack_shadowweapon_normal_fx" and print("NORMAL FX") or nil to just this local fx_prefab = "wanda_attack_shadowweapon_normal_fx" and change the start of the function to this local function WrampShadowWeaponFx(inst, target, damage, stimuli, weapon) Link to comment https://forums.kleientertainment.com/forums/topic/165121-adding-fx-to-character-attack-when-below-sanity-threshold/page/2/#findComment-1811097 Share on other sites More sharing options...
Doodle Monster Posted April 7, 2025 Author Share Posted April 7, 2025 (edited) Alrighty giving it a test Edited April 7, 2025 by Doodle Monster Link to comment https://forums.kleientertainment.com/forums/topic/165121-adding-fx-to-character-attack-when-below-sanity-threshold/page/2/#findComment-1811098 Share on other sites More sharing options...
Doodle Monster Posted April 7, 2025 Author Share Posted April 7, 2025 (edited) I got this crash once I loaded into the server [string "scripts/mainfunctions.lua"]:160: Error loading file prefabs/wramp [string "../mods/Wramp Clothier Damage effect rewrite/scripts/prefabs/wr..."]:161: ')' expected near 'WrampShadowWeaponFx' LUA ERROR stack traceback: =[C] in function 'assert' scripts/mainfunctions.lua(160,1) =(tail call) ? =[C] in function 'xpcall' scripts/mods.lua(189,1) scripts/mods.lua(666,1) in function '_RegisterPrefabs' local MS_MODNAME = 'workshop-2812783478';local a = {} Edited April 7, 2025 by Doodle Monster Link to comment https://forums.kleientertainment.com/forums/topic/165121-adding-fx-to-character-attack-when-below-sanity-threshold/page/2/#findComment-1811100 Share on other sites More sharing options...
Merkyrrie Posted April 7, 2025 Share Posted April 7, 2025 2 minutes ago, Doodle Monster said: I got this crash once I loaded into the server [string "scripts/mainfunctions.lua"]:160: Error loading file prefabs/wramp [string "../mods/Wramp Clothier Damage effect rewrite/scripts/prefabs/wr..."]:161: ')' expected near 'WrampShadowWeaponFx' LUA ERROR stack traceback: =[C] in function 'assert' scripts/mainfunctions.lua(160,1) =(tail call) ? =[C] in function 'xpcall' scripts/mods.lua(189,1) scripts/mods.lua(666,1) in function '_RegisterPrefabs' local MS_MODNAME = 'workshop-2812783478';local a = {} would mean you're missing a closing parenthesis on line 161 of the wramp.lua file Link to comment https://forums.kleientertainment.com/forums/topic/165121-adding-fx-to-character-attack-when-below-sanity-threshold/page/2/#findComment-1811101 Share on other sites More sharing options...
Doodle Monster Posted April 7, 2025 Author Share Posted April 7, 2025 (edited) I think I must have forgotten to close a function further up Edited April 7, 2025 by Doodle Monster Link to comment https://forums.kleientertainment.com/forums/topic/165121-adding-fx-to-character-attack-when-below-sanity-threshold/page/2/#findComment-1811102 Share on other sites More sharing options...
Doodle Monster Posted April 7, 2025 Author Share Posted April 7, 2025 (edited) This is line 161, I think it has closeing parethesis inst:ListenForEvent("sanitydelta," WrampShadowWeaponFx) Edited April 7, 2025 by Doodle Monster Link to comment https://forums.kleientertainment.com/forums/topic/165121-adding-fx-to-character-attack-when-below-sanity-threshold/page/2/#findComment-1811103 Share on other sites More sharing options...
Doodle Monster Posted April 7, 2025 Author Share Posted April 7, 2025 (edited) Oh man, I left a comma in there! Edited April 7, 2025 by Doodle Monster Link to comment https://forums.kleientertainment.com/forums/topic/165121-adding-fx-to-character-attack-when-below-sanity-threshold/page/2/#findComment-1811104 Share on other sites More sharing options...
Merkyrrie Posted April 7, 2025 Share Posted April 7, 2025 2 minutes ago, Doodle Monster said: This is line 161, I think it has closeing parethesis inst:ListenForEvent("sanitydelta," WrampShadowWeaponFx) Yeah, which means you are correct its for a missing one further up somewhere Link to comment https://forums.kleientertainment.com/forums/topic/165121-adding-fx-to-character-attack-when-below-sanity-threshold/page/2/#findComment-1811105 Share on other sites More sharing options...
Doodle Monster Posted April 7, 2025 Author Share Posted April 7, 2025 (edited) I fixed the syntax, but I got this crash when going insane; Edited April 7, 2025 by Doodle Monster Link to comment https://forums.kleientertainment.com/forums/topic/165121-adding-fx-to-character-attack-when-below-sanity-threshold/page/2/#findComment-1811106 Share on other sites More sharing options...
Merkyrrie Posted April 7, 2025 Share Posted April 7, 2025 This should be a working version with a tweaked (and shortened) function wramp.lua 1 Link to comment https://forums.kleientertainment.com/forums/topic/165121-adding-fx-to-character-attack-when-below-sanity-threshold/page/2/#findComment-1811107 Share on other sites More sharing options...
Doodle Monster Posted April 7, 2025 Author Share Posted April 7, 2025 (edited) It works! Thank you so much for the help! Do you want me to mention you for credit in the mod description? Edited April 7, 2025 by Doodle Monster 2 Link to comment https://forums.kleientertainment.com/forums/topic/165121-adding-fx-to-character-attack-when-below-sanity-threshold/page/2/#findComment-1811108 Share on other sites More sharing options...
Merkyrrie Posted April 7, 2025 Share Posted April 7, 2025 43 minutes ago, Doodle Monster said: It works! Thank you so much for the help! Do you want me to mention you for credit in the mod description? No problem! You can if you'd like to, but there's really no need. Good luck with the rest of the mod! Link to comment https://forums.kleientertainment.com/forums/topic/165121-adding-fx-to-character-attack-when-below-sanity-threshold/page/2/#findComment-1811113 Share on other sites More sharing options...
oregu Posted April 7, 2025 Share Posted April 7, 2025 (edited) On 4/4/2025 at 2:39 PM, Doodle Monster said: @oregu Sorry for the ping! You seemed more knowlegeable then me on this, any help or pointers would be awesome. Again, I somehow did not receive the notification! But I can try to work on this. Edit: Nevermind, I guess. Glad you all found a solution. Edited April 7, 2025 by oregu Link to comment https://forums.kleientertainment.com/forums/topic/165121-adding-fx-to-character-attack-when-below-sanity-threshold/page/2/#findComment-1811121 Share on other sites More sharing options...
Doodle Monster Posted April 8, 2025 Author Share Posted April 8, 2025 No worries, Thanks for the help with the crafting recipie btw! Link to comment https://forums.kleientertainment.com/forums/topic/165121-adding-fx-to-character-attack-when-below-sanity-threshold/page/2/#findComment-1811320 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