debugman18 Posted November 23, 2013 Share Posted November 23, 2013 Okay, awesome, I'm having trouble for what Wickerbottom should say regarding the rats and their tails actually, I set to to "Vermin pests!" for the rats but mmmhmm, it sounds rather weird. Considering they're not really Vermin, just robots. Yeah here http://i.imgur.com/Xc3wKwl.pngI just remembered that the tutorial mod mentioned something about 64x64, could that be it?Yes that may solve it, an inventory image is required to be 64x64. Link to comment Share on other sites More sharing options...
KidneyBeanBoy Posted November 23, 2013 Share Posted November 23, 2013 By the way, I could help now if you could give me the file where all the item quotes are supposed to be (Though in a .txt file, that's the only way my computer can comprehend it.) Link to comment Share on other sites More sharing options...
user1464576869 Posted November 23, 2013 Author Share Posted November 23, 2013 Yes that may solve it, an inventory image is required to be 64x64.Hm, it did not :l I even deleted the old TEX files to see if they weren't being replaced, they regenerated and yeah, no.Is there something wrong in my prefab?local assets={ Asset("ANIM", "anim/cable.zip"),}local function fn(Sim) local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() local anim = inst.entity:AddAnimState() anim:SetScale( .75, .75 ) MakeInventoryPhysics(inst) inst.AnimState:SetBank("cable") inst.AnimState:SetBuild("cable") inst.AnimState:PlayAnimation("idle") inst:AddComponent("stackable") inst.components.stackable.maxsize = TUNING.STACK_SIZE_SMALLITEM inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst.components.inventoryitem.atlasname = "images/inventoryimages/cable.xml" inst.components.inventoryitem.imagename = "cable" return instendreturn Prefab( "common/inventory/cable", fn, assets) By the way, I could help now if you could give me the file where all the item quotes are supposed to be (Though in a .txt file, that's the only way my computer can comprehend it.)Oh, well you would have to come back in a few days maybe, there are no files with quotes ready to be filled just yet I'm on my way making things though so.. uh, look forward to that? Or something~ Link to comment Share on other sites More sharing options...
debugman18 Posted November 23, 2013 Share Posted November 23, 2013 Hm, it did not :l I even deleted the old TEX files to see if they weren't being replaced, they regenerated and yeah, no.Is there something wrong in my prefab?local assets={ Asset("ANIM", "anim/cable.zip"),}local function fn(Sim) local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() local anim = inst.entity:AddAnimState() anim:SetScale( .75, .75 ) MakeInventoryPhysics(inst) inst.AnimState:SetBank("cable") inst.AnimState:SetBuild("cable") inst.AnimState:PlayAnimation("idle") inst:AddComponent("stackable") inst.components.stackable.maxsize = TUNING.STACK_SIZE_SMALLITEM inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst.components.inventoryitem.atlasname = "images/inventoryimages/cable.xml" inst.components.inventoryitem.imagename = "cable" return instendreturn Prefab( "common/inventory/cable", fn, assets) Oh, well you would have to come back in a few days maybe, there are no files with quotes ready to be filled just yet I'm on my way making things though so.. uh, look forward to that? Or something~Well, the appropriate assets need to be declared in Assets, IIRC. Asset( "ATLAS", "images/inventoryimages/cable.xml" ),Asset( "IMAGE", "images/inventoryimages/cable.tex" ), Link to comment Share on other sites More sharing options...
user1464576869 Posted November 23, 2013 Author Share Posted November 23, 2013 Well, the appropriate assets need to be declared in Assets, IIRC. Asset( "ATLAS", "images/inventoryimages/cable.xml" ),Asset( "IMAGE", "images/inventoryimages/cable.tex" ), Of courssseee.So uh, turns out the cables doesn't really HAVE to be 64x64, but I can't recommend it enoughWeird because I did resize them, maybe I'll have to run another TEX generating test see if I can update them.EDIT: Ayup, all fixed now Looks incredibly fabulous.EDIT: Okay so now I'm looking into adding drops and health to the rats, I've added the loot code and it seemed to work just fine, but I can't really test without killing it can I?Now to add health do I need a custom tuning file somewhere? I looked at the knight's file and it stated that it's health will be determined by a tuning file, which indeed did determine the knight's and many other prefab's settings. Link to comment Share on other sites More sharing options...
Malacath Posted November 23, 2013 Share Posted November 23, 2013 You can either write everything directly inside the code or you set up a tuning file similiar to the strings file.a)inst:AddComponent("health")inst.components.health:SetMaxHealth(300)b)inst:AddComponent("health")inst.components.health:SetMaxHealth(TUNING.RAT_HEALTH)And additionally the file "tuning_yourmod.lua"NEWTUNING = { RAT_HEALTH = 1,}return NEWTUNINGAnd in modmainTUNING = TableMerge(TUNING, GLOBAL.require("tuning_yourmod"))If you have defined the function TableMerge further up the code, which you will have done when you added the strings. Again, it looks like b) is a lot more complicated. But it allows for so much easier balancing and finetuning that I think it is totally worth the effort. Link to comment Share on other sites More sharing options...
user1464576869 Posted November 23, 2013 Author Share Posted November 23, 2013 You can either write everything directly inside the code or you set up a tuning file similiar to the strings file.I think a tuning file sounds manageable.There's probably something freaky going on with defining the TableMerge like you said I got an "attempt to index global '_G' (a nil value)" Here's the bit from my modmain if needed, I probably pasted the bits in wrong place?local function TableMerge(t1, t2) for k,v in pairs(t2) do if type(v) == "table" then if type(t1[k] or false) == "table" then TableMerge(t1[k] or {}, t2[k] or {}) else t1[k] = v end else t1[k] = v end end return t1end GLOBAL.STRINGS = TableMerge(GLOBAL.STRINGS, GLOBAL.require("strings_testmod"))TUNING = TableMerge(TUNING, _G.require("tuning_testmod"))EDIT: I temporarily added health without the tuning file, when the rat dies of fire damage it still doesn't seem to drop anything. Is that because of the fire's properties of usually destroying items or have I done goofed in the prefab file?local assets={ Asset("ANIM", "anim/rat.zip"),}local prefabs ={ "cable", "gears",}SetSharedLootTable( 'rat',{ {'gears', .5}, {'cable', 1.0},})local function init_prefab() local inst = CreateEntity() local trans = inst.entity:AddTransform() local anim = inst.entity:AddAnimState() local shadow = inst.entity:AddDynamicShadow() shadow:SetSize( 1.5, .75 ) MakeCharacterPhysics(inst, 50, .5) inst.Physics:CollidesWith(COLLISION.WORLD) anim:SetBank("rat") anim:SetBuild("rat") anim:PlayAnimation("idle", true ) anim:SetScale( 1.3, 1.3 ) inst:AddComponent("inspectable") inst:AddComponent("health") --inst.components.health:SetMaxHealth(TUNING.RAT_HEALTH) inst.components.health:SetMaxHealth(10) inst:AddComponent("lootdropper") inst.components.lootdropper:SetChanceLootTable('rat') return instendreturn Prefab( "monsters/rat", init_prefab, assets, nil) Link to comment Share on other sites More sharing options...
Malacath Posted November 23, 2013 Share Posted November 23, 2013 Sorry, simplex taught me to use _G instead of GLOBAL so I have_G = GLOBALat the to of every modmain. So you can replace it with GLOBAL in your code. I don't see right now why it doesn't drop its stuff right now. If you want to upload the whole mod I can see if I find the problem. Link to comment Share on other sites More sharing options...
user1464576869 Posted November 23, 2013 Author Share Posted November 23, 2013 That's clever~I don't see right now why it doesn't drop its stuff right now. If you want to upload the whole mod I can see if I find the problem.Okay, well the health works I also haven't made it so that you can attack the rat yet, that's why I kill it with fire instead. Gonna need help with that eventually Test mod.zip Link to comment Share on other sites More sharing options...
Malacath Posted November 23, 2013 Share Posted November 23, 2013 Of course, i got it...It's a tiny bit more complicated than your previous problems... a tiny bit meaning hugely xDThe lootdropper is usually triggered when the entity goes into its "death" state. Since you don't have a stategraph at the moment you don't have anything that triggers it. It's advisable to use a stategraph later on, I think Cheerios creature tutorial is the best thing to start for that. But for now you can listen for the event death and then trigger the lootdrop, likeinst:ListenForEvent("death", function(inst) inst.components.lootdropper:DropLoot(inst:GetPosition())end)EDIT: You might want to download _simplex_testing from simplex which enables DebugKeys and let's you kill everything by pressing CTRL+K (don't know the Mac equivalent) while hovering over it. Link to comment Share on other sites More sharing options...
user1464576869 Posted November 23, 2013 Author Share Posted November 23, 2013 Of course, i got it...I'll maybe get that tool in the future~Okay well it's fine I'll just go about adding a stategraph immediately, I have Cheerio's tutorials already and should've followed the later tutorials instead now that I think of it.But of course something goes wrong down the line, after adding the stategraph and only including an idle state (that can supposedly rotate) the mod crashes. I've added the file again for all of your checking needs. And once it's working I can add the death state yeah?Test mod.zip Link to comment Share on other sites More sharing options...
Malacath Posted November 23, 2013 Share Posted November 23, 2013 You have the order of the return in SGrat wrong, it should bereturn StateGraph("rat", states, events, "idle")Where events is just {} for now. Then it works.Now you'll want to do like thislocal events={ CommonHandlers.OnDeath(),}To add the eventhandler for the "death" event and expand the table states to add a "death" state. In the onenter function of that state you can trigger the lootdropping. Try it for yourself by looking at other stategraphs and if you fail then try this ; )local events={ CommonHandlers.OnDeath(),}local states={ State{ name = "idle", tags = {"idle", "canrotate"}, onenter = function(inst, playanim) inst.AnimState:PlayAnimation("idle", true) end, }, State { name = "death", tags = {"busy"}, onenter = function(inst) inst.AnimState:PlayAnimation("idle2") RemovePhysicsColliders(inst) inst.components.lootdropper:DropLoot() end, },}return StateGraph("rat", states, events, "idle") Link to comment Share on other sites More sharing options...
user1464576869 Posted November 23, 2013 Author Share Posted November 23, 2013 Try it for yourself by looking at other stategraphs and if you fail then try this ; )Hahaaah I made it work with local events={ CommonHandlers.OnDeath(), EventHandler("death", function(inst) inst.sg:GoToState("death") end),}local states={ State{ name = "idle", tags = {"idle", "canrotate"}, onenter = function(inst, playanim) inst.AnimState:PlayAnimation("idle", true) end, }, State{ name = "death", tags = {"busy"}, onenter = function(inst) --inst.SoundEmitter:PlaySound("dontstarve/creatures/koalefant/yell") -- yeah that'll change once I have custom sound --inst.AnimState:PlayAnimation("something once it's done") RemovePhysicsColliders(inst) inst.components.lootdropper:DropLoot() end, }}return StateGraph("rat", states, events, "idle")I got some extra line at local events, is that unnecessary or did ya against all odds miss out on it? Link to comment Share on other sites More sharing options...
Malacath Posted November 23, 2013 Share Posted November 23, 2013 I got some extra line at local events, is that unnecessary or did ya against all odds miss out on it?Sweet ^^That extra line is simply a copy of the common handler you added in the line above, so it doesn't do anything. You can keep it, but it's not necessary so you can decide for which line you prefer and terminate the other one ; ) Link to comment Share on other sites More sharing options...
KidneyBeanBoy Posted November 24, 2013 Share Posted November 24, 2013 I'm not sure if this needed to be bumped or not. :/ Link to comment Share on other sites More sharing options...
user1464576869 Posted November 24, 2013 Author Share Posted November 24, 2013 Sweet ^^That extra line is simply a copy of the common handler you added in the line above, so it doesn't do anything. You can keep it, but it's not necessary so you can decide for which line you prefer and terminate the other one ; )Welp. xD I'm gonna stick with the short one, because it's short I'm not sure if this needed to be bumped or not. :/Don't worry about it If the topic dies it's likely because I died, until then I'm probably going to "spam" questions on how to code things once every day. It'll be rather impossible to die as long as people answer them.Speaking of which, I'm just drawing the rat from different perspectives and was wondering where in the code you tell a prefab to spin about? I found this code here inst.Transform:SetFourFaced() and it works rather well when it comes to mirroring the creature (since that is all it can do for now). But what about up and down facing once I've finished those images? Link to comment Share on other sites More sharing options...
debugman18 Posted November 24, 2013 Share Posted November 24, 2013 Welp. xD I'm gonna stick with the short one, because it's short Don't worry about it If the topic dies it's likely because I died, until then I'm probably going to "spam" questions on how to code things once every day. It'll be rather impossible to die as long as people answer them.Speaking of which, I'm just drawing the rat from different perspectives and was wondering where in the code you tell a prefab to spin about? I found this code here inst.Transform:SetFourFaced() and it works rather well when it comes to mirroring the creature (since that is all it can do for now). But what about up and down facing once I've finished those images?They should work with SetFourFaced(). I'm pretty sure they have to have a particular animation name, but I'm not sure what they are. Link to comment Share on other sites More sharing options...
user1464576869 Posted November 24, 2013 Author Share Posted November 24, 2013 They should work with SetFourFaced(). I'm pretty sure they have to have a particular animation name, but I'm not sure what they are.Hm, I figured so too. So it should be easy to make, just a little hassle figuring out the names.Anyone else know?Also how do I make the rat attack-able? So that holding any weapon makes it say "Attack" instead of examining it and all that? Link to comment Share on other sites More sharing options...
debugman18 Posted November 24, 2013 Share Posted November 24, 2013 Hm, I figured so too. So it should be easy to make, just a little hassle figuring out the names.Anyone else know?Also how do I make the rat attack-able? So that holding any weapon makes it say "Attack" instead of examining it and all that?inst:AddComponent("combat")inst:AddComponent("health")inst.components.health:SetMaxHealth(health) should do the trick. Link to comment Share on other sites More sharing options...
Malacath Posted November 24, 2013 Share Posted November 24, 2013 Anyone else know?I have this for you, all hail the Cheerio for his wisdom ^^ Link to comment Share on other sites More sharing options...
user1464576869 Posted November 24, 2013 Author Share Posted November 24, 2013 I have this for you, all hail the Cheerio for his wisdom ^^Hm, I'm slightly confused still, is it in the spriter file here I should name the different animations things like "idle_loop_up" or uh.. Somewhere else?And why is the 'loop' part necessary? Couldn't it be 'idle_up', 'run_side'? Link to comment Share on other sites More sharing options...
Malacath Posted November 24, 2013 Share Posted November 24, 2013 And why is the 'loop' part necessary? Couldn't it be 'idle_up', 'run_side'?Absolutely right about that one. You name all animations however you want them, you simply add the suffixes "_up", "_down" and "_side" to them. So if your animation is called "idle" you'll have "idle_up", "idle_down" and "idle_side". Now whenever you use the lineinst.AnimState:PlayAnimation("idle")It will implicitly add the appropriate suffix depending on camera and entity angle. This is how I understand it and I'm also quite certain about it. Tbh though I have never used it myself, just a guess. Link to comment Share on other sites More sharing options...
user1464576869 Posted November 24, 2013 Author Share Posted November 24, 2013 Absolutely right about that one.Hahaa, it does work I added some silly place holders of the rat's face pointing up and down to test it.Thing is, it's pointing the wrong way looking left and right, I think the default idle animation needs to look to the right, since mine is to the left it's all mirrored in-game now.I'll have to mirror all of the animations inside my spriter file now, yay. x)EDIT: So messing around with the rats I happened to get close to some pigs that felt it was necessary to smash 'em up. That was fun to see. However other chess pieces does the same. And that's not as fun. I had an "chess" tag to the rat and thought that would've been enough for creatures to behave correctly to the rats. Since chess pieces doesn't attack each other I need help on how to prevent that EDIT: I have another rather big problem now and I really have no idea how it could be fixable.After I finished my images for the rat looking up I put them in the same folder as the rest of it's parts. And then I just assembled everything inside the idle_up animation. And it looked all great and stuff. However as I opened up the mod on my windows computer again the example head from the last time was still there. I looked into the spriter file again but this time through windows, and that's when I saw something freaky had happened.This is what it looked like on my mac originally.This is though how it looked after opening up the file on my windowsWhat has happened? None of the new files I assembled are there? Test mod.zip Link to comment Share on other sites More sharing options...
Malacath Posted November 25, 2013 Share Posted November 25, 2013 @ Sorry but I have to ask this stupid question: Did you copy everything exactly as is from your mac? Because when I look at the scml (it's just a text file, you can do it yourself) I think I see files that are referenced but not existent. Could it be that you changed your folder structure somehow?Try to take the scml straight from your mac and into your exported folder and don't open it in windows. See if the conversion works fine in that case. It could be that the windows build of spriter does fancy things with the mac build, if that happens to solve your problem it would be in the best interest of the Spriter community to report that bug (if someone else did not already do that) Link to comment Share on other sites More sharing options...
user1464576869 Posted November 25, 2013 Author Share Posted November 25, 2013 If that happens to solve your problem it would be in the best interest of the Spriter community to report that bug (if someone else did not already do that)* Hm, well uh, I copied the entire mod folder as it was without changing it in any way I'm pretty sure, but I can double check for good measures. EDIT: Yeah so, I can't see anything different at least..* That's what I did the first time though, just copied the files over and started up the mod immediately.I think this is the same problem I had before, some file is deleted in my spriter project and spriter doesn't want to forget about it. Cheerio helped me by replacing those with placeholders. I don't know what those deleted files could be called or anything though so I probably need his help again?EDIT: No wait actually, uh, that time I could still open up the project on my windows and it would look fine, just not work fine. Now however it does neither. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.