mechatech Posted June 19, 2016 Share Posted June 19, 2016 Can someone show me a simple script that does the following. Item with script attached is unequipped but is in inventory, character is visible sneaking or notItem is equipped and character is visible when not sneaking and invisible when sneaking. I want to make a cloak that when worn applies chameleon to the character when sneaking only.The cloak already as an enchantment of protection and I want that to stay permanently. I tried something but I really don't have a clue with scripting. Maybe I'm asking too much but I don't know that or not either. Thanks in advance. Link to comment Share on other sites More sharing options...
lubronbrons Posted June 20, 2016 Share Posted June 20, 2016 Hi mecha ! you already created some mods, Good ! then you can use CSE I will assume your cloak is equipped at slot 2 (Upper Body), Change if you use other slot you can see for slot info in cs wiki GetEquippedObject use this script and attach it to your invis Cloak scn InvisCLoakObjectScript ref me begin OnEquip Let me := GetContainer end begin GameMode if me == 0 return ;prevent script running on non actor endif if me.HasSpell Mg06JskarInvis ;we can use Jskar Chameleon (from Bruma Mages Guild), or you can make custom chameleon spell by yourself if me.IsSneaking == 0 || InvisCloakEditorID == me.GetEquippedObject 2 ;-----------------> Change this slot if not upper body me.RemoveSpellNS Mg06JskarInvis endif elseif me.IsSneaking if InvisCloakEditorID == me.GetEquippedObject 2 ;-----------------> Change this slot if not upper body me.AddSpellNS Mg06JskarInvis endif endif end Link to comment Share on other sites More sharing options...
mechatech Posted June 20, 2016 Author Share Posted June 20, 2016 What a quick response! Thanks! Anyway never used the CSE before. Put it in. What a difference in scripting it makes. Anyway after some mind numbing stupidity on my part. I'm still working on it. Will post results soon. Link to comment Share on other sites More sharing options...
lubronbrons Posted June 20, 2016 Share Posted June 20, 2016 hmm ... I see that you are still learning :) you know, you should change that ' InvisCloakEditorID ' with your Invisible Cloak Editor ID editor ID is the unique ID every reference have, example remember Martin? the Emperor's child if you want to do something with martin you should use MartinRef. So .... just replace that 'InvisCloakEditorID' with your invisible cloak which item I-don't-know-whats-that-Editor-ID is Link to comment Share on other sites More sharing options...
mechatech Posted June 21, 2016 Author Share Posted June 21, 2016 The script works, sort of. I made a custom chameleon spell. If I apply it using the console it works. But if it is applied by the script my character flickers and is detected. I tried using Mg06JskarInvis with the same result. Strange thing is if I apply Mg06JskarInvis manually it doesn't work at all and if I remove it I get the message not found on my character. What's really weird is Mg06JskarInvis worked last night. It seems the script works but the game engine is not applying it properly. Link to comment Share on other sites More sharing options...
lubronbrons Posted June 21, 2016 Share Posted June 21, 2016 (edited) Great !happy to hear the script is working well hmm.... I don't know about that, but maybe mod conflict ?mod such as SDR by Saebel can detect Player even in Chameleon 100% right? I don't see any other reasons that thatthis is probably conflict with mod that modify detection setting or the Game Setting itself EDIT : ahh I am sorry the code is wrong ! There's little terrible mistake this line is wrong !! this what's causing flicker if me.IsSneaking == 0 || InvisCloakEditorID == me.GetEquippedObject 2 ;-----------------> Change this slot if not upper body it should be like this, notice there is different in == (script above) and != (script below) if me.IsSneaking == 0 || InvisCloakEditorID != me.GetEquippedObject 2 ;-----------------> Change this slot if not upper body and here's the new revision.This will work much better than the previous code,can be applied to any equipment you wants :D no need to replace the obj with you invis Cloak EDID !!!Try it, and tell me what you think scn InvisCLoakObjectScript ref me ref obj begin OnEquip Let me := GetContainer Let obj := GetSelf end begin GameMode if me == 0 return endif if me.HasSpell Mg06JskarInvis if me.IsSneaking == 0 || obj != me.GetEquippedObject 2 ;-----------------> Change this slot if not upper body me.RemoveSpellNS Mg06JskarInvis endif elseif me.IsSneaking if obj == me.GetEquippedObject 2 ;-----------------> Change this slot if not upper body me.AddSpellNS Mg06JskarInvis endif endif end Edited June 21, 2016 by lubronbrons Link to comment Share on other sites More sharing options...
mechatech Posted June 22, 2016 Author Share Posted June 22, 2016 It doesn't work. I started with just the base game and the latest version of OBSE, plus only this mod containing this script and nothing else. I tried this experiment with Mg06JskarInvis and a custom spell. This is what happens. Using the console I add the spell and my character disappears. I remove the spell and my character reappears. Using the console I add the scripted item (at present it has no enchantments). I then equip the item. I use the console again to add and remove the spell and the spell works as expected. I go into sneak and nothing happens. If I add the spell, that spell doesn't work anymore, sneaking or not. i unequip the item, the spell still doesn't work using console. Removing the spell gives the message that the spell is not on the character. The spell will only work if I remove the item from inventory. Somehow the script, once running, stops the spell from being applied. edit - I'm wondering if the flickering with the first script was the script fighting with itself. Applying and removing the spell repeatedly. Link to comment Share on other sites More sharing options...
lubronbrons Posted June 22, 2016 Share Posted June 22, 2016 (edited) Yess ! the frist script I've given to you made that happenyou see.... this line >>> if me.HasSpell Mg06JskarInvismeans : current host already Jskar invis or not this line >>> if me.IsSneaking == 0 || InvisCloakEditorID == me.GetEquippedObject 2me.RemoveSpellNS Mg06JskarInvismeans : current host is currently sneaking or equipped the invis cloak then the condition meet, TRUEevaluation : This is my first mistake ! The correct one should be like this ---> InvisCloakEditorID != me.GetEquippedObject 2 (notice the different in != )that is why you have flicker effect bug since the condition is always TRUE in my first script, the Second script I think should be fineor you can use the better version, the second script will have it running by itself you DON'T have to write EDID for Invis cloak manually like in the first scriptbegin OnEquipLet me := GetContainerLet obj := GetSelfend...if me.IsSneaking == 0 || obj != me.GetEquippedObject 2... Edited June 22, 2016 by lubronbrons Link to comment Share on other sites More sharing options...
mechatech Posted June 22, 2016 Author Share Posted June 22, 2016 Your second script using "obj" is the one I'm using. There is no flicker, nothing happens. Link to comment Share on other sites More sharing options...
mechatech Posted June 23, 2016 Author Share Posted June 23, 2016 Out of curiosity I made my custom spell using both chameleon and then invisibility into a power than a less power and a spell and that doesn't work either.I don't get it. I'm doing everything right and it just won't work. Link to comment Share on other sites More sharing options...
Recommended Posts