Boogiepop210 Posted May 19, 2023 Share Posted May 19, 2023 (edited) So, i've been making a mod that causes entities to shoot projectiles randomly when they die, for some reason none of my print statements work so I'm guessing i messed something up on the ListenForEvent modmain.lua It doesn't crash me or anything, it just does nothing. I'm not very good at modding so this is probably something very simple. Also i looked at the logs and nothing was wrong. Edited May 19, 2023 by Boogiepop210 Link to comment https://forums.kleientertainment.com/forums/topic/147864-need-help-making-a-weird-and-useless-mod/ Share on other sites More sharing options...
Haruhi Kawaii Posted May 19, 2023 Share Posted May 19, 2023 (edited) 1 hour ago, Boogiepop210 said: So, i've been making a mod that causes entities to shoot projectiles randomly when they die, for some reason none of my print statements work so I'm guessing i messed something up on the ListenForEvent modmain.lua 2.16 kB · 2 downloads It doesn't crash me or anything, it just does nothing. I'm not very good at modding so this is probably something very simple. Also i looked at the logs and nothing was wrong. I would use AddPrefabPostInitAny in this case but it has wide scope and sometimes extraneous stuff, so be careful when using it Spoiler AddPrefabPostInitAny(function(inst) if not GLOBAL.TheWorld.ismastersim then return inst end if inst:HasTag("_combat") then inst:ListenForEvent("death", function(inst) print("hello7") z_shootprojectiles("fire_projectile", inst, 15, 3, 1, math.random(0, 360), false, inst.Transform:GetWorldPosition()) end) end end) Edited May 19, 2023 by Haruhi Kawaii Link to comment https://forums.kleientertainment.com/forums/topic/147864-need-help-making-a-weird-and-useless-mod/#findComment-1635720 Share on other sites More sharing options...
Boogiepop210 Posted May 19, 2023 Author Share Posted May 19, 2023 (edited) 10 hours ago, Haruhi Kawaii said: I would use AddPrefabPostInitAny in this case but it has wide scope and sometimes extraneous stuff, so be careful when using it Reveal hidden contents AddPrefabPostInitAny(function(inst) if not GLOBAL.TheWorld.ismastersim then return inst end if inst:HasTag("_combat") then inst:ListenForEvent("death", function(inst) print("hello7") z_shootprojectiles("fire_projectile", inst, 15, 3, 1, math.random(0, 360), false, inst.Transform:GetWorldPosition()) end) end end) Thanks, the code worked perfectly. (after some fixes with globals on my function) Edited May 19, 2023 by Boogiepop210 Link to comment https://forums.kleientertainment.com/forums/topic/147864-need-help-making-a-weird-and-useless-mod/#findComment-1635808 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