cyberjock045 Posted April 8, 2015 Share Posted April 8, 2015 I have created a custom character with a custom item. I do not want to make the item character specific or I would use the tutorial for that. Instead I would simply like to induce insanity like the Nightmare Amulet when when a character other than the custom character welds it. I am putting this bit of code below in the local function onequip of the custom item. I know I am not either calling the right variables or not calling them correctly for the "if" statement. I am trying to test if the owner is not playercharacter ninjajoe. If not then induce insanity. So If ninjajoe equips the item = nothing happens if wilson (or any other character) equips the item = induce insanity. if owner ~= ("ninjajoe") then owner.components.sanity:SetInducedInsanity() endAny suggestions? Link to comment Share on other sites More sharing options...
DarkXero Posted April 9, 2015 Share Posted April 9, 2015 (edited) This is the purple amulet code:---PURPLElocal function induceinsanity(val, owner) if owner.components.sanity ~= nil then owner.components.sanity:SetInducedInsanity(val) endendlocal function onequip_purple(inst, owner) owner.AnimState:OverrideSymbol("swap_body", "torso_amulets", "purpleamulet") if inst.components.fueled then inst.components.fueled:StartConsuming() end induceinsanity(true, owner)endlocal function onunequip_purple(inst, owner) owner.AnimState:ClearOverrideSymbol("swap_body") if inst.components.fueled then inst.components.fueled:StopConsuming() end induceinsanity(nil, owner)end What you want:local function induceinsanity(val, owner) if owner.components.sanity ~= nil and owner.prefab ~= "ninjajoe" then owner.components.sanity:SetInducedInsanity(val) endendlocal function onequip(inst, owner) owner.AnimState:OverrideSymbol("swap_body", "torso_amulets", "purpleamulet") induceinsanity(true, owner)endlocal function onunequip(inst, owner) owner.AnimState:ClearOverrideSymbol("swap_body") induceinsanity(nil, owner)end With onequip, and onunequip being the locals you want.Replacing torso_amulets and purpleamulet with whatever you made your item and put where.Although I don't know if it's a hat or armor or amulet what you have. I assume you know. Edited April 9, 2015 by DarkXero Link to comment Share on other sites More sharing options...
Maris Posted April 9, 2015 Share Posted April 9, 2015 owner.prefab ~= "ninjajoe" Link to comment Share on other sites More sharing options...
cyberjock045 Posted April 10, 2015 Author Share Posted April 10, 2015 Thanks guys! it worked perfectly! I just uploaded him to the steam workshop at the link below. Thanks for helping complete him! http://steamcommunity.com//sharedfiles/filedetails/?id=422460997&searchtext= 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