BlightRaptor Posted April 4, 2020 Share Posted April 4, 2020 This is my first attempt at some scripting with a modicum amount of success. The aim is to have an outfit that uses the Upper and Lower slots add a spell to the player (maybe any actor later). Works so far, but I also want it to check that the equipped item is also considered clothing and not armor. GetObjectType or IsClothing seem relevant, but my experimentation was fruitless. Not really sure where to go from here... scn MEHClothingULQuestScript float fQuestDelayTime Begin Gamemode set fQuestDelayTime to 1 If Player.GetEquippedObject 18 Player.AddSpellNS MEHClothingULeffect endif If Player.GetEquippedObject 18 == 0 Player.RemoveSpellNS MEHClothingULeffect endif end Link to comment Share on other sites More sharing options...
mixxa77 Posted April 4, 2020 Share Posted April 4, 2020 I think you are using GetEquippedObject wrong. The function is not a boolean yes/no (1/0), but it gets the equipped item, which you need to store in a variable. After you stored it, you can run further checks on it. For example (but without testing), this should work: scn MEHClothingULQuestScript float fQuestDelayTime ref Clothing Begin Gamemode set fQuestDelayTime to 1 set Clothing to Player.GetEquippedObject 18 If Clothing.getisid != 0 && Clothing.IsClothing == 1 Player.AddSpellNS MEHClothingULeffect else Player.RemoveSpellNS MEHClothingULeffect endif end Clothing.getisid != 0 makes sure there is any object equipped (0 would be none). && makes sure that both conditions need to be true to apply the spell, if both or either is wrong, then the spell is removed (the stuff after "else"). Clothing.IsClothing == 1 makes sure it is clothing and not armor. Don't forget to create a new quest in the quest menu to which you apply the script and make sure to check the "Start Game Enabled" checkbox in the quest's menu. Link to comment Share on other sites More sharing options...
mixxa77 Posted April 4, 2020 Share Posted April 4, 2020 (edited) If it is only a specific outfit you want this to apply to, then you can just assing a script directly to the outfit without the need of a questscript running checks in the background constantly: scn ScriptDirectlyForOutfit Begin OnEquip AddSpellNS MEHClothingULeffect end begin OnUnequip RemoveSpellNS MEHClothingULeffect end Edited April 4, 2020 by mixxa77 Link to comment Share on other sites More sharing options...
BlightRaptor Posted April 4, 2020 Author Share Posted April 4, 2020 Thanks for explaining those, Mixxa. Though for this line: If Clothing.getisid != 0 && Clothing.IsClothing == 1 CS spits out "Missing parameter ObjectID" when I tried to save. Link to comment Share on other sites More sharing options...
mixxa77 Posted April 4, 2020 Share Posted April 4, 2020 (edited) Ha, speaking of using a function wrong, I used GetIsId wrong there myself. Clothing.getisid != 0 shouldn't even be necessary in the script. Edited April 4, 2020 by mixxa77 Link to comment Share on other sites More sharing options...
BlightRaptor Posted April 4, 2020 Author Share Posted April 4, 2020 Thanks, man. It saved after I removed that part, but in-game the script doesn't seem to fire off anymore. With my old example I saw the spell effect added, but with the clothing check not so much. Link to comment Share on other sites More sharing options...
mixxa77 Posted April 5, 2020 Share Posted April 5, 2020 (edited) After reading up on how IsClothing works, it turns out we both used it wrong. It is highly important to use the TES CS wiki to read up on how functions work when you are writing scripts (Because guessing how they work, as we did, often doesn't work). The wiki often provides an example syntax for how to use the function, which is how I saw that we both used IsClothing it wrong. So, this should work: scn MEHClothingULQuestScript float fQuestDelayTime ref Clothing Begin Gamemode set fQuestDelayTime to 1 set Clothing to Player.GetEquippedObject 18 if IsClothing Clothing Player.AddSpellNS MEHClothingULeffect else Player.RemoveSpellNS MEHClothingULeffect endif end Edited April 5, 2020 by mixxa77 Link to comment Share on other sites More sharing options...
BlightRaptor Posted April 5, 2020 Author Share Posted April 5, 2020 Thanks. That change worked quite well. I'd been trying the second example of syntax from the wiki( [ref.]IsClothing ) , but to no avail. Link to comment Share on other sites More sharing options...
DrakeTheDragon Posted April 5, 2020 Share Posted April 5, 2020 The difference is between references and base objects. For references the "<ref>.IsClothing" notation can be used, for base objects the "IsClothing <base>" notation has to be used instead. And GetEquippedObject just so happens to return the base object. (Sorry for intruding.) Link to comment Share on other sites More sharing options...
Recommended Posts