dragonacool Posted July 22, 2015 Share Posted July 22, 2015 hey guys. i have a few questions. my mod is almost complete just having a few issues with some things. 1) is i cant seem to get the "over_charge" sound to play when the projectile is used. now do i place the sound in the projectile or the weapon that creates the projectile. 2)i have been looking around on trying to get the hunger to go down every time the projectile is used.again do i place this in the weapon or the projectile itself. every time i have tried either nothing happens or it crashes. i dont even know if im using the right code for it. 3) i have the code for the book" the end is neigh" in my projectile sequence. now when i use the weapon i hear the sound and the screen even goes dark indicating that the lightning happened. but i dont see it and it doesnt do anything to the surrounding area. 4)where is the "day" indicator stored. i would like my character to change animations on the tenth day. or when an item is used. this will change the players speed, health and hunger. how would i go about doing this. if you cant figure these outs its ok. im just really excited to get this mod complete as i have been working on it for a while now. Enclosed bellow is the weapon and the projectile if that helps (weapon)local assets={ Asset("ANIM", "anim/tm24.zip"), Asset("ANIM", "anim/swap_tm24.zip"), Asset("ATLAS", "images/inventoryimages/tm24.xml"), Asset("IMAGE", "images/inventoryimages/tm24.tex"), Asset("SOUND", "sound/wx78.fsb"), Asset("SOUNDPACKAGE", "sound/dontstarve.fev"),}local prefabs ={ "sparks",}local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() MakeInventoryPhysics(inst) inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddSoundEmitter("dontstarve/characters/wx78/charged", "overcharge_sound") inst.entity:AddNetwork() inst.AnimState:SetBank("tm24") inst.AnimState:SetBuild("tm24") inst.AnimState:PlayAnimation("idle") if not TheWorld.ismastersim then return inst end local function OnEquip(inst, owner) owner.AnimState:OverrideSymbol("swap_object", "swap_tm24", "swap_tm24") owner.AnimState:Show("ARM_carry") owner.AnimState:Hide("ARM_normal") end local function OnUnequip(inst, owner) owner.AnimState:Hide("ARM_carry") owner.AnimState:Show("ARM_normal") end inst:AddComponent("inventoryitem") inst.components.inventoryitem.keepondeath = true inst.components.inventoryitem.imagename = "tm24" inst.components.inventoryitem.atlasname = "images/inventoryimages/tm24.xml" inst:AddComponent("equippable") inst.components.equippable:SetOnEquip( OnEquip ) inst.components.equippable:SetOnUnequip( OnUnequip ) inst.components.inventoryitem.keepondeath = true inst:AddComponent("inspectable") inst:AddTag("shadow") inst:AddComponent("weapon") inst.components.weapon:SetDamage(80) inst.components.weapon:SetRange(6, 8) inst.components.weapon:SetProjectile("tm24_projectile") inst.SoundEmitter:KillSound("overcharge_sound") inst.SoundEmitter:PlaySound("dontstarve/characters/wx78/charged", "overcharge_sound") return inst end return Prefab("common/inventory/tm24", fn, assets)(projectile)local assets ={ Asset("ANIM", "anim/tm24_projectile.zip"), Asset("ANIM", "anim/bishop_attack.zip"), Asset("SOUND", "sound/wx78.fsb"), Asset("SOUNDPACKAGE", "sound/dontstarve.fev"), }local function fn(inst) local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddNetwork() MakeInventoryPhysics(inst) RemovePhysicsColliders(inst) inst.AnimState:SetBank("bishop_attack") inst.AnimState:SetBuild("bishop_attack") inst.AnimState:PlayAnimation("idle", true) if not TheWorld.ismastersim then return inst end inst:AddTag("projectile") inst.entity:SetPristine() inst:AddComponent("projectile") inst.components.projectile:SetSpeed(30) inst.components.projectile:SetOnHitFn(inst.Remove) inst.components.projectile:SetOnMissFn(inst.Remove) inst.SoundEmitter:KillSound("overcharge_sound") inst.SoundEmitter:PlaySound("dontstarve/characters/wx78/charged", "overcharge_sound") ---------------------------------------------------------------------- --Lighting effect---commented out for the momment ------------------------------------------------------------------------ --[[ local pt = Vector3(inst.Transform:GetWorldPosition()) local num_lightnings = 16 inst:StartThread(function() for k = 0, num_lightnings do local rad = math.random(3, 15) local angle = k * 4 * PI / num_lightnings local pos = pt + Vector3(rad * math.cos(angle), 0, rad * math.sin(angle)) TheWorld:PushEvent("ms_sendlightningstrike", pos) Sleep(math.random( .3, .5)) end end) ]] return instendreturn Prefab("common/inventory/tm24_projectile", fn, assets) Link to comment Share on other sites More sharing options...
dragonacool Posted July 22, 2015 Author Share Posted July 22, 2015 just a pointer aswell. the code on line 45 of the projectile doesnt work i keep getting an error --:45: attempt to index field 'SoundEmitter' (a nil value) Link to comment 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