ZeTrystan Posted March 10, 2014 Author Share Posted March 10, 2014 This is all I was able to find for the miner's hat: if name == "miner" then table.insert(assets, Asset("ANIM", "anim/hat_miner_off.zip")) end__________________________________________________________________________________________ local function miner_turnon(inst) local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner if inst.components.fueled:IsEmpty() then if owner then onequip(inst, owner, "hat_miner_off") end else if owner then onequip(inst, owner) end inst.components.fueled:StartConsuming() inst.SoundEmitter:PlaySound("dontstarve/common/minerhatAddFuel") inst.Light:Enable(true) end end local function miner_turnoff(inst, ranout) if inst.components.equippable and inst.components.equippable:IsEquipped() then local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner if owner then onequip(inst, owner, "hat_miner_off") end end inst.components.fueled:StopConsuming() inst.SoundEmitter:PlaySound("dontstarve/common/minerhatOut") inst.Light:Enable(false) end local function miner_equip(inst, owner) miner_turnon(inst) end local function miner_unequip(inst, owner) onunequip(inst, owner) miner_turnoff(inst) end local function miner_perish(inst) local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner if owner then owner:PushEvent("torchranout", {torch = inst}) end miner_turnoff(inst) end local function miner_drop(inst) miner_turnoff(inst) end local function miner_takefuel(inst) if inst.components.equippable and inst.components.equippable:IsEquipped() then miner_turnon(inst) end end local function miner() local inst = simple() inst.entity:AddSoundEmitter() local light = inst.entity:AddLight() light:SetFalloff(0.4) light:SetIntensity(.7) light:SetRadius(2.5) light:SetColour(180/255, 195/255, 150/255) light:Enable(false) inst.components.inventoryitem:SetOnDroppedFn( miner_drop ) inst.components.equippable:SetOnEquip( miner_equip ) inst.components.equippable:SetOnUnequip( miner_unequip ) inst:AddComponent("fueled") inst.components.fueled.fueltype = "CAVE" inst.components.fueled:InitializeFuelLevel(TUNING.MINERHAT_LIGHTTIME) inst.components.fueled:SetDepletedFn(miner_perish) inst.components.fueled.ontakefuelfn = miner_takefuel inst.components.fueled.accepting = true return inst end__________________________________________________________________________________________ elseif name == "miner" then fn = miner__________________________________________________________________________________________ MakeHat("miner"),__________________________________________________________________________________________ I think the parts in red are the important parts about how the light of the hat works. Since I don't code, I can't really be sure... but yeah. Link to comment https://forums.kleientertainment.com/forums/topic/32290-creating-an-object-with-complicated-unique-effect/page/2/#findComment-428003 Share on other sites More sharing options...
seronis Posted March 10, 2014 Share Posted March 10, 2014 Lights are omnidirectional if thats what you're looking for. Link to comment https://forums.kleientertainment.com/forums/topic/32290-creating-an-object-with-complicated-unique-effect/page/2/#findComment-428007 Share on other sites More sharing options...
zeropoint101 Posted March 10, 2014 Share Posted March 10, 2014 (edited) Ok, I wrote a big long post and then the forum logged me out for some reason, which it's been doing lately and I'd LOVE to know why the forum has been acting so weird. But anyway.. I'm not up for writing my whole post again, so I'm sorry if this seems a bit short. Yea, the miner hat is just an omnidirectional light like seronis said. The cone I'm seeing is probably just part of the hat's animation and not an actual light. So here's another idea. Do you have the Screecher mod on Mac? I assume you do. The flashlight in that mod is NOT omnidirectional. Go look at the flashlight_particles.lua file and you may learn something about the light effect you're going for. With the "dusk" thing, dusk will still be there in the game for things you need to do during dusk. You could just give your camera 2 settings(day/night) for now and add in the "dusk" setting later when you get other things figured out. As to the file indexing, I didn't mean just that you could see the files, but that if you index their contents... well let's say you find a function call for DoThisThing or DoThatOtherThing, and you want to find the file where that function is defined and see what it does exactly. If you've indexed the contents and not just the filenames, the search will help you find which file you need to look at. But you'll have to find out how Mac indexes files. I think this mod is very doable, but it'll take some work. If you're up for it, I think it really is an amazing idea. Edited March 10, 2014 by zeropoint101 Link to comment https://forums.kleientertainment.com/forums/topic/32290-creating-an-object-with-complicated-unique-effect/page/2/#findComment-428023 Share on other sites More sharing options...
JackSlender Posted March 10, 2014 Share Posted March 10, 2014 If you want the effect to happen in a cone, you should make 4-6 circles of increasing radius appear one in front of the other. That should pretty much fake a cone. Link to comment https://forums.kleientertainment.com/forums/topic/32290-creating-an-object-with-complicated-unique-effect/page/2/#findComment-428143 Share on other sites More sharing options...
zeropoint101 Posted March 10, 2014 Share Posted March 10, 2014 If you want the effect to happen in a cone, you should make 4-6 circles of increasing radius appear one in front of the other. That should pretty much fake a cone. Honest question here, not trying to be argumentative. But why would that work better than to just work off of the flashlight_particles.lua I described above? With your suggestion, wouldn't you have to create an object for each light source and also connect it perfectly to the characters' movement? That seems like it would be really difficult to impossible... Link to comment https://forums.kleientertainment.com/forums/topic/32290-creating-an-object-with-complicated-unique-effect/page/2/#findComment-428256 Share on other sites More sharing options...
JackSlender Posted March 10, 2014 Share Posted March 10, 2014 That's what flashlight.lua does. It creates 5 instances of flashlight_particles.lua and arranges them in front of the player. I do, however, see the error in this. In the Screecher mod, the player always faces forwards so there is no need to worry about the character changing directions. I don't know how to accomplish this with a player that turns... It would be very difficult, but I'm sure it would be possible somehow. Link to comment https://forums.kleientertainment.com/forums/topic/32290-creating-an-object-with-complicated-unique-effect/page/2/#findComment-428318 Share on other sites More sharing options...
ZeTrystan Posted March 11, 2014 Author Share Posted March 11, 2014 That's what flashlight.lua does. It creates 5 instances of flashlight_particles.lua and arranges them in front of the player. I do, however, see the error in this. In the Screecher mod, the player always faces forwards so there is no need to worry about the character changing directions. I don't know how to accomplish this with a player that turns... It would be very difficult, but I'm sure it would be possible somehow. Oh. That's bad.Is it possible to turn effects? Link to comment https://forums.kleientertainment.com/forums/topic/32290-creating-an-object-with-complicated-unique-effect/page/2/#findComment-428463 Share on other sites More sharing options...
zeropoint101 Posted March 11, 2014 Share Posted March 11, 2014 That's what flashlight.lua does. It creates 5 instances of flashlight_particles.lua and arranges them in front of the player. I do, however, see the error in this. In the Screecher mod, the player always faces forwards so there is no need to worry about the character changing directions. I don't know how to accomplish this with a player that turns... It would be very difficult, but I'm sure it would be possible somehow. Very interesting. Well, glad I asked. I tried figuring out what was going on in the flashlight particles lua, but had no idea. I'm still stuck on some simpler stuff. Link to comment https://forums.kleientertainment.com/forums/topic/32290-creating-an-object-with-complicated-unique-effect/page/2/#findComment-428556 Share on other sites More sharing options...
zeropoint101 Posted March 11, 2014 Share Posted March 11, 2014 Oh. That's bad.Is it possible to turn effects? Hopefully someone else will come back with a better answer, but the particles file is just another prefab. The player does turn, but the camera turns with him. I would just try something similar to the particles file, and see how it looks with the camera setup in the normal Don't Starve position. Then tinker with it from there. Link to comment https://forums.kleientertainment.com/forums/topic/32290-creating-an-object-with-complicated-unique-effect/page/2/#findComment-428558 Share on other sites More sharing options...
JackSlender Posted March 11, 2014 Share Posted March 11, 2014 The problem is that the particles follow the camera, not the player (I'm pretty sure). If you copied it in Don't Starve, it would be forward the whole time, and it wouldn't follow the player. Link to comment https://forums.kleientertainment.com/forums/topic/32290-creating-an-object-with-complicated-unique-effect/page/2/#findComment-428573 Share on other sites More sharing options...
squeek Posted March 11, 2014 Share Posted March 11, 2014 (edited) I'm not sure what you guys are talking about, flashlight_particles is totally unused; all the lines that use it are commented out. The screecher flashlight creates multiple flashlight_lightpiece prefabs (very simple prefabs with just a Light) and adds them all to the flashlight's 'lightbeam' component. The lightbeam component updates every frame and does the following: it gets the player's position and facing direction and then positions its flashlight_lightpiece prefabs accordingly. You could pretty much use the lightbeam component directly as is (but you'd probably want to remove the transition-related stuff that deals with searching containers and whatnot). Check out mods/screecher/scripts/components/lightbeam.lua. Edited March 11, 2014 by squeek Link to comment https://forums.kleientertainment.com/forums/topic/32290-creating-an-object-with-complicated-unique-effect/page/2/#findComment-428594 Share on other sites More sharing options...
zeropoint101 Posted March 11, 2014 Share Posted March 11, 2014 I'm not sure what you guys are talking about, flashlight_particles is totally unused; all the lines that use it are commented out. The screecher flashlight creates multiple flashlight_lightpiece prefabs (very simple prefabs with just a Light) and adds them all to the flashlight's 'lightbeam' component. The lightbeam component updates every frame and does the following: it gets the player's position and facing direction and then positions its flashlight_lightpiece prefabs accordingly.You could pretty much use the lightbeam component directly as is (but you'd probably want to remove the transition-related stuff that deals with searching containers and whatnot). Check out mods/screecher/scripts/components/lightbeam.lua. My bad. I'm trying to comment on something way above my skill level. I guess I should have said there's probably something to do with the flashlight he could use, but I don't know any more than that. Link to comment https://forums.kleientertainment.com/forums/topic/32290-creating-an-object-with-complicated-unique-effect/page/2/#findComment-428610 Share on other sites More sharing options...
JackSlender Posted March 15, 2014 Share Posted March 15, 2014 Ah, okay. I looked at the flashlight prefab a while ago, so I was only vaguely aware of what it did with the circles of light. Thank you for the clarification. Link to comment https://forums.kleientertainment.com/forums/topic/32290-creating-an-object-with-complicated-unique-effect/page/2/#findComment-432179 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