allomerus Posted January 7, 2013 Share Posted January 7, 2013 Hello world! So, as I say in the title, I'm tryint to create a shield that reflects magic when the player is blocking. Now, let's be clear : I'm not going for something outrageously fancy. This shield is supposed to add, when the player is blocking, an ability that gives 100% spell reflection, then remove it when the player stops blocking. I came up with a quest script - yeah and I checked, it's marked as a quest script - that should work fine. Only it dosen't. Can anyone tell me what went wrong in my experimentations this time? hehe (Just to make sure : This is about Oblivion modding) Scn AlloDarknessShieldHeavyEffect Short HasBlockEffect Begin Gamemode If [player.GetEquipped AlloShieldDarkness == 0] && [HasBlockEffect == 0] Return Elseif [player.GetEquipped AlloShieldDarkness == 0] && [HasBlockEffect == 1] Player.RemovespellNS AlloDarknessShieldHeavyAbility Set HasBlockEffect to 0 Return Elseif [player.GetEquipped AlloShieldDarkness == 1] If [HasBlockEffect == 0] && [Player.IsBlocking == 0] return Elseif [HasBlockEffect == 0] && [Player.IsBlocking == 1] Player.AddspellNS AlloDarknessShieldHeavyAbility Set HasBlockEffect to 1 Endif If [HasBlockEffect == 1] && [Player.IsBlocking == 1] return Elseif [HasBlockEffect == 1] && [Player.IsBlocking == 0] Player.RemovespellNS AlloDarknessShieldHeavyAbility Set HasBlockEffect to 0 Endif Endif End Thank you for your time! Link to comment Share on other sites More sharing options...
wetblanket Posted January 7, 2013 Share Posted January 7, 2013 This is probably an insulting question (so apologies in advance :D): You say 'I came up with a quest script - yeah and I checked, it's marked as a quest script' but did you create an actual quest to go with it, the type that runs all the time? Sadly, that's pretty much all I know about scripting... If you get no joy here consider posting at the official forums or TESAlliance - bit more traffic there and more modders as opposed to players. Link to comment Share on other sites More sharing options...
Maskar Posted January 7, 2013 Share Posted January 7, 2013 (edited) First thing you want to do is make certain the code is working correctly. This can easily be done by sticking a few printc functions in your code (to debug). The second thing you might want to do is rewrite the code a bit. It's rather messy and way bigger than necessary. Edited January 8, 2013 by Maskar Link to comment Share on other sites More sharing options...
allomerus Posted January 8, 2013 Author Share Posted January 8, 2013 This is probably an insulting question (so apologies in advance :D): You say 'I came up with a quest script - yeah and I checked, it's marked as a quest script' but did you create an actual quest to go with it, the type that runs all the time? Sadly, that's pretty much all I know about scripting... If you get no joy here consider posting at the official forums or TESAlliance - bit more traffic there and more modders as opposed to players. An insult? Please! that damned CS is so complicated to use, that mistake is as possible as any. What would've been insulting is if I actually had forgotten it... But in that case, it would be my fault. There's no insults when talking about scripting... only a cartload of humility lessons. That being said, I went to check : I didn't forget : ) First thing you want to do is make certain the code is working correctly. This can easily be done by sticking a few printc functions in your code (to debug). The second thing you might want to do is rewrite the code a bit. It's rather messy and way bigger than necessary. PrintC... Interesting concept... Didn't know that thing even existed. I'll try to work on the script or rewrite it, we'll see what happens. I definitely like how something goes wrong everytime I believe I ''got this'' lol... Thanks for the tips guys : ) Link to comment Share on other sites More sharing options...
Lanceor Posted January 8, 2013 Share Posted January 8, 2013 If it's a quest script, it only runs once every 5 seconds by default, so it would be too slow to activate and de-activate the reflect shield AlloDarknessShieldHeavyAbility. To fix, make it an object script which would then run every frame (attached to the shield would be ideal). It's the first time I've seen [square brackets] used in a script - while it seems to compile, I'm not sure if it would work. Try (round brackets) instead. (If square brackets DO work, then I learned something new today. : )) A couple of related functions that you may find useful: set User to GetContainer if ( User.IsActor == 0 ) Return endifThis above will allow the shield to work with NPCs as well, and stop the script running if it's not in the possession of an actor. Substitute "Player" for "User" in you script. if ( User.HasSpell AlloDarknessShieldHeavyAbility == 0)The above checks whether the user currently has your spell. Oh yes, as Maskar suggested, use PrintC or even Messagebox to ensure that different parts of your script are firing as they should. :) Link to comment Share on other sites More sharing options...
allomerus Posted January 9, 2013 Author Share Posted January 9, 2013 If it's a quest script, it only runs once every 5 seconds by default, so it would be too slow to activate and de-activate the reflect shield AlloDarknessShieldHeavyAbility. To fix, make it an object script which would then run every frame (attached to the shield would be ideal). It's the first time I've seen [square brackets] used in a script - while it seems to compile, I'm not sure if it would work. Try (round brackets) instead. (If square brackets DO work, then I learned something new today. : )) A couple of related functions that you may find useful: set User to GetContainer if ( User.IsActor == 0 ) Return endifThis above will allow the shield to work with NPCs as well, and stop the script running if it's not in the possession of an actor. Substitute "Player" for "User" in you script. if ( User.HasSpell AlloDarknessShieldHeavyAbility == 0)The above checks whether the user currently has your spell. Oh yes, as Maskar suggested, use PrintC or even Messagebox to ensure that different parts of your script are firing as they should. :) Well blast it! It wuurked! You won't be learning anything today : Square brackets don't actually work. I could swear I made other scripts with those, but whatever... And an object script is indeed a better idea. Thanks a lot! Link to comment Share on other sites More sharing options...
Recommended Posts