• addon will not show up under entities
    4 replies, posted
hi, i have been trying to get a Gmod 12 addon to work with Gmod 13. i have made a post in another thread, but that thread seemed dea, and this is probably a such a small issue, that it would be faster to just make a new thread than to bump an old one. here is the addon i am trying to convert. [url]http://www.garrysmod.org/downloads/?a=view&id=81139[/url] (i am only trying to convert the storm/ tornado part, the effects part was already converted). this addon added some entities (which use wire) which create storms and tornados after putting it into gmod, i changed the "info.txt" into addon.txt. and it did seem to have load into gmod, since it produced this LUA error [CODE] [ERROR] addons/weather/lua/entities/wm_lightning/cl_init.lua:5: bad argument #2 to 'Exists' (string expected, got no value) 1. Exists - [C]:-1 2. unknown - addons/weather/lua/entities/wm_lightning/cl_init.lua:5 [ERROR] addons/weather/lua/entities/wm_tornado/cl_init.lua:6: bad argument #2 to 'Exists' (string expected, got no value) 1. Exists - [C]:-1 2. unknown - addons/weather/lua/entities/wm_tornado/cl_init.lua:6 [/CODE] also, none of the entities showed up anywhere under the entities tab or anywhere in the game i tried to fix this error by going to the files and sections noted in the error, i changed the naming of some lua stuff (which were outdated) into this [CODE] if(file.Exists("../materials/entities/wm_lightning_killicon.vmt", "MOD")) then killicon.Add("wm_lightning","entities/wm_lightning_killicon",Color(255,255,255)) (in the cl_init.lua file under addons/weather/lua/entities/wm_lightning) and... if(file.Exists("../materials/entities/wm_tornado_killicon.vmt", "MOD")) then killicon.Add("wm_tornado","entities/wm_tornado_killicon",Color(255,255,255)) (in the cl_init.lua file under addons/weather/lua/entities/wm_tornado) [/CODE] after i did that, the lua errors iun the console were gone, the console also showed signs that the addon was working (the addon normally tells you that conditions are "right" for a storm, and it was doing that in gmod 13." however, the actual spawnable entities dont show up in game. i am hoping that one of you far more experienced lua coders could help me fix this. (its my first day with lua). thanks for any help!
[code] if(file.Exists("materials/entities/wm_lightning_killicon.vmt", "GAME")) then killicon.Add("wm_lightning","entities/wm_lightning_killicon",Color(255,255,255)) if(file.Exists("materials/entities/wm_tornado_killicon.vmt", "GAME")) then killicon.Add("wm_tornado","entities/wm_tornado_killicon",Color(255,255,255)) [/code] Try that, not sure if it'll change anything, but it should work. Basically you must not use ../ in files functions now.
[QUOTE=Robotboy655;41389842][code] if(file.Exists("materials/entities/wm_lightning_killicon.vmt", "GAME")) then killicon.Add("wm_lightning","entities/wm_lightning_killicon",Color(255,255,255)) if(file.Exists("materials/entities/wm_tornado_killicon.vmt", "GAME")) then killicon.Add("wm_tornado","entities/wm_tornado_killicon",Color(255,255,255)) [/code] Try that, not sure if it'll change anything, but it should work. Basically you must not use ../ in files functions now.[/QUOTE] yeah, i tried that too. same effect. no lua errors, but the entities are not spawnable. perhaps i have not been clear nough on my issue, but my question is how do you make this addon entity spawnable in gmod 13? im guessing it is different than in gmod 12. i think thats the reason why it wont show up. i think the addon itself works, i just dont know how to spawn it.
Oh. You'll need to do ENT.Spawnable = true and replace ENT.AdminSpawnable to ENT.AdminOnly. In shared.lua.
thanks, i checked all the entities, all the ENT.spawnables were set to false for some reason, so i changed it to true. i will check it now to see if its fixed. EDIT: they are now spawnable, thank you for your help. the thing generates a ton of lua errors now when spawned (although most of them dont seem to really do anything) there is one that is pointing out to a problem. when you get near a tornado, you should pulled in and lose health. that is what is supposed to happen. however, if you get close to the tornado, no damage (or the tornado throwing you about) happens. it also gives me this lua error [CODE] [ERROR] addons/weather/lua/entities/wm_tornado/init.lua:152: attempt to index local 'Pull' (a nil value) 1. unknown - addons/weather/lua/entities/wm_tornado/init.lua:152 [/CODE] i suppose its a function that no longer exists in gmod 13 ( or has a different name now). i am still trying to fix it (mostly with google, since i know little about lua) but any help is appreciated. here is the line of LUA which the error mentions [CODE]Pull = Vector(Pull.x, Pull.y, 0.325*math.Clamp(1-(ZDif/(range/7)), 0, 1))[/CODE] thanks for any help EDIT again: here is every line where "pull" is used, not sure if it will help [CODE] 145 1 local Pull = ((self:GetPos() - v:GetPos()):Normalize()) 146 local Pull2 = self:GetPos() - v:GetPos() 147 local Length = Vector(Pull2.x,Pull2.y,0):Length() 148 149 local ZDif = (Vector(0,0,origin.z) - Vector(0,0,vorigin.z)):Length() 150 --print(ZDif) 151 152 Pull = Vector(Pull.x, Pull.y, 0.325*math.Clamp(1-(ZDif/(range/7)), 0, 1)) 153 Pull = Pull * ( (1-(Length/range))^3.3 ) 154 local force = Pull * (64000*(2^(self.sFScale^1.425))) 155 local force2 = Pull * (64000*(2^(self.sFScale^1.425))) 156 force2:Rotate(Angle(0,-90,0)) 157 local force3 = (((force*0.55) + (force2*0.45))) --Adjust ratio between pull and spin[/CODE] (the numbers ahead of each part are the line number)
Sorry, you need to Log In to post a reply to this thread.