h3ct0r Posted January 3, 2016 Share Posted January 3, 2016 Hello guys!I have problem with function called OverrideSymbolI porting from DST character to DS and i don't know what is wrong with thatI have the code:local function onuse(inst) inst.AnimState:OverrideSymbol("swap_bedroll", "swap_bedroll_furry", "bedroll_furry")endBut i dont know why isn't work i need the fuction.Thanks for help. Link to comment https://forums.kleientertainment.com/forums/topic/61808-problem-with-overridesymbol/ Share on other sites More sharing options...
Arkathorn Posted January 3, 2016 Share Posted January 3, 2016 First, are you sure that the function is being called? Check with a 'print' function. Second, in what way is it not working? What are you trying to do? Link to comment https://forums.kleientertainment.com/forums/topic/61808-problem-with-overridesymbol/#findComment-704845 Share on other sites More sharing options...
h3ct0r Posted January 3, 2016 Author Share Posted January 3, 2016 I have these error in 88 line is this code. Link to comment https://forums.kleientertainment.com/forums/topic/61808-problem-with-overridesymbol/#findComment-704895 Share on other sites More sharing options...
Arkathorn Posted January 4, 2016 Share Posted January 4, 2016 Could you post the entire file? I can't figure out the error otherwise. Link to comment https://forums.kleientertainment.com/forums/topic/61808-problem-with-overridesymbol/#findComment-705093 Share on other sites More sharing options...
h3ct0r Posted January 4, 2016 Author Share Posted January 4, 2016 Of course, pleaselocal assets ={ Asset("ANIM", "anim/swap_bedroll_furry.zip"),}--We don't watch "stopnight" because that would not work in a clock--without night phaselocal function wakeuptest(inst, phase) if phase ~= "night" then inst.components.sleepingbag:DoWakeUp() endendlocal function wakeuptestnoc(inst, phase) if phase ~= "day" then inst.components.sleepingbag:DoWakeUp() endendlocal function onwake(inst, sleeper, nostatechange) if inst.sleeptask ~= nil then inst.sleeptask:Cancel() inst.sleeptask = nil end if sleeper:HasTag("player") and not sleeper:HasTag("nocturn") then inst:StopWatchingWorldState("phase", wakeuptest) end if sleeper:HasTag("player") and sleeper:HasTag("nocturn") then inst:StopWatchingWorldState("phase", wakeuptestnoc) end if not nostatechange then sleeper.sg:GoToState("wakeup") end if inst.components.finiteuses ~= nil and inst.components.finiteuses:GetUses() <= 0 then inst:Remove() inst.persists = false endendlocal function onsleeptick(inst, sleeper) if sleeper.components.hunger ~= nil then -- Check SGwilson, state "bedroll", if you change this value sleeper.components.hunger:DoDelta(TUNING.SLEEP_HUNGER_PER_TICK, true, true) end if sleeper.components.sanity ~= nil and sleeper.components.sanity:GetPercentWithPenalty() < 1 then sleeper.components.sanity:DoDelta(TUNING.SLEEP_SANITY_PER_TICK, true) end if sleeper.components.health ~= nil and (not sleeper.components.hunger or sleeper.components.hunger:GetPercent() > 0) then sleeper.components.health:DoDelta(TUNING.SLEEP_HEALTH_PER_TICK, true, "bedroll", true) end if sleeper.components.temperature ~= nil then sleeper.components.temperature:SetTemperature(sleeper.components.temperature:GetCurrent() + TUNING.SLEEP_TEMP_PER_TICK) endendlocal function onsleep(inst, sleeper) -- check if we're in an invalid period (i.e. daytime). if so: wakeup if sleeper:HasTag("player") and sleeper:HasTag("nocturn") then if phase ~= "day" then inst.components.sleepingbag:DoWakeUp() end else if phase ~= "night" then inst.components.sleepingbag:DoWakeUp() end end if inst.sleeptask ~= nil then inst.sleeptask:Cancel() end inst.sleeptask = inst:DoPeriodicTask(TUNING.SLEEP_TICK_PERIOD, onsleeptick, nil, sleeper)endlocal function onuse(inst) inst.AnimState:OverrideSymbol("swap_bedroll", "swap_bedroll_furry", "bedroll_furry")endlocal function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst.AnimState:SetBank("swap_bedroll_furry") inst.AnimState:SetBuild("swap_bedroll_furry") inst.AnimState:PlayAnimation("idle") if not TheWorld.ismastersim then return inst end inst.entity:SetPristine() inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst:AddComponent("finiteuses") inst.components.finiteuses:SetConsumption(ACTIONS.SLEEPIN, 1) inst.components.finiteuses:SetMaxUses(3) inst.components.finiteuses:SetUses(3) inst:AddComponent("fuel") inst.components.fuel.fuelvalue = TUNING.LARGE_FUEL MakeSmallBurnable(inst, TUNING.LONG_BURNABLE) MakeSmallPropagator(inst) inst:AddComponent("sleepingbag") inst.components.sleepingbag.onsleep = onsleep inst.components.sleepingbag.onwake = onwake inst.onuse = onuse MakeHauntableLaunchAndIgnite(inst) return instendreturn Prefab("common/inventory/bedroll_furry", fn, assets) Link to comment https://forums.kleientertainment.com/forums/topic/61808-problem-with-overridesymbol/#findComment-705168 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