Fienyx Posted April 25, 2016 Posted April 25, 2016 What I'm trying to do is make some blood mage type skills, the shield being the one I want the most. What it should do is, depending on alteration level, cast a series of spells that drain health in steps, increasing the strength of the shield. Each step drains 20 hp, then at master, it's just one instant drain, and there's possibility for use with uncappers. I can't get the timer to work properly. If anyone is willing to look at what I have and maybe give some insights, it would be greatly appreciated. BloodMageShield.esp
gregathit Posted April 25, 2016 Posted April 25, 2016 Holler at some of the folks at the back of this thread: http://www.loverslab.com/topic/168-useful-community-scripts-to-start-mods-with/page-7 Also Symon is pretty script savvy.
varenne Posted April 26, 2016 Posted April 26, 2016 I took a quick look at it yesterday also, via CS/E review of your scripts and in-game testing. Where it seems to fail, and I'm having to assume intended functionality is the middle level spell calls. I don't think a timer is going to work there, or if it can it needs to be structured quite differently. (I changed my PC's Alteration levels for testing purposes via Setav; 24, 25, 49, 50, etc.) Script review with two questions as comments towards the top of the script: scn bloodshieldcast float timer begin ScriptEffectStart player.GetAVForBaseActor Alteration if (player.GetAVForBaseActor Alteration <= 24) Cast BloodShield1 player MessageEX "Bleeding Shield - First Cut" elseif (player.GetAVForBaseActor Alteration >= 25 && player.GetAVForBaseActor Alteration <= 49) Cast BloodShield1 player MessageEX "Bleeding Shield - First Cut" Cast BloodShield1 player ;why is this cast twice here? MessageEX "Bleeding Shield - First Cut" set timer to 0 set timer to timer + GetSecondsPassed if timer >= 5 LeoSpellSource.moveto player ;So you are moving a Marker to the player and having it cast a spell? I think this is where it is not currently working LeoSpellSource.Cast BloodShield2 player MessageEX "Bleeding Shield - Second Cut" LeoSpellSource.moveto LeoSpellMarker endif elseif (player.GetAVForBaseActor Alteration >= 50 && player.GetAVForBaseActor Alteration <= 74) Cast BloodShield1 player MessageEX "Bleeding Shield - First Cut" set timer to 0 set timer to timer + GetSecondsPassed if timer >= 5 Cast BloodShield2 player MessageEX "Bleeding Shield - Second Cut" set timer to 0 set timer to timer + GetSecondsPassed if timer >= 10 Cast BloodShield3 player MessageEX "Bleeding Shield - Third Cut" endif endif elseif (player.GetAVForBaseActor Alteration >= 75 && player.GetAVForBaseActor Alteration <= 99) Cast BloodShield1 player MessageEX "Bleeding Shield - First Cut" set timer to 0 set timer to timer + GetSecondsPassed if timer >= 5 Cast BloodShield2 player MessageEX "Bleeding Shield - Second Cut" set timer to 0 set timer to timer + GetSecondsPassed if timer >= 10 Cast BloodShield3 player MessageEX "Bleeding Shield - Third Cut" set timer to 0 set timer to timer + GetSecondsPassed if timer >= 15 Cast BloodShield4 player MessageEX "Bleeding Shield - Final Cut" endif endif endif elseif (player.GetAVForBaseActor Alteration >= 100) Cast BloodShield5 player MessageEX "Bleeding Shield - Master Slash" endif end LeoSpellSource Can a Marker be used to cast a spell? Personal preference, I added a MessageEX to your first script as I like to know when a new spell is being added to my PC. scn Addbloodshield Begin gamemode player.addspellns bloodshield MessageEX "Bloodshield Spell Added" end
Fienyx Posted April 26, 2016 Author Posted April 26, 2016 The cast twice, a copy/paste mistake, yes moving the marker, and yes, they can cast spells. I borrowed that part from the smoking mod I made. I'm trying to get these to work for the race I made. It's going to be a racial type thing, along with a fire spell that will just become stronger as destruction goes up, then a shock spell and frost spell will be added at higher levels. I'm trying this approach so I won't need to re hotkey spells when they get stronger. The destruction spells are easy, as the main spell will just check dest lvl, and cast the right spell. The shield is a different matter because I want it to bleed out for stronger protection until master level, where it'll be one big chunk for full shielding.
varenne Posted April 26, 2016 Posted April 26, 2016 LeoSpellSource, that's where I see this breaking down during my tests, but I was in the basement of lakeside home so maybe an invalid test. I also tried commenting out all the "Set Timer to 0" but that had no affect. I've seen those used before in scripts, but they typically happen or are placed lower as a sort of reset function. As an experiment maybe a slight rewrite and move the player to the marker to see if it works in reverse? Dunno... But the next sections also didn't work either; Alteration >= 50 && <= 74, Alteration >= 75 && <= 99 Sorry I couldn't be of more help on this.
Fienyx Posted April 26, 2016 Author Posted April 26, 2016 The Alteration >= 50 && <= 74, Alteration >= 75 && <= 99 sections, I used before in a different script that added spells. Works fine for removing the old spell and adding the new spell, but the new spell obviously has a different id, so even with the same name, still need to re hotkey. I haven't worked much on the destruction spells though. If I can't get the shield to have a sort of bleeding affect that strengthens the shield the more you bleed out, I'll figure out a different sort of power for my race. Lol, I've spent more time trying to get this shield spell to work than I spent on the smoking mod.
varenne Posted April 27, 2016 Posted April 27, 2016 Well the low level <= 24 and high level =100 are I think working as intended; bleeding effect? Check, health decreased. Resulting Shields and correct intensity? Also check. Center section of your script In order to get it to work as you describe, again I don't think a timer will work. Along with the Player Alteration check, you need to store and then read a current variable value, in this case when the last x1, x2, x3 spell was cast, then add to that value (a simple increment is all), till you reach the Master cast level. Yes? And then possibly a reset of that variable after x amount of time, otherwise it stays at the max of whatever the PC's Alteration level is. I noticed you also refer to this as a power, but it is actually configured as a casted spell.
Fienyx Posted April 27, 2016 Author Posted April 27, 2016 I intend for it to be a lesser power. I had an idea while working on something else, but I forgot what it was and didn't write it down
movomo Posted April 27, 2016 Posted April 27, 2016 If what I'm seeing is all and nothing else is below what Varenne posted, any kind timer is pointless. cause it's onScriptEffectStart block. ScriptEffectStart fires only once per spell instance, and the variables are lost upon re-cast. On the other hand, ScriptEffectUpdate block runs once every frame while the owner of the spell is on memory. A more appropriate approach would be something like this. float timer_ Begin ScriptEffectStart set timer_ to 5.0 End Begin ScriptEffectUpdate set timer_ to timer_ - ScriptEffectElapsedSeconds if timer_ <= 0.0 ;do_something endif End plus if you just want to check if the pc's skill is at a certain perk level, don't use getAVForBaseActor. Use GetAVSkillMasteryLevel instead.
Fienyx Posted April 27, 2016 Author Posted April 27, 2016 Thanks, will give that a shot. Is there somewhere to find the most up to date list of obse commands? I have the obse command documentation page bookmarked, but it doesn't seem to be up to date.
movomo Posted April 28, 2016 Posted April 28, 2016 The most up to date one can be found in your hard drive!
Fienyx Posted April 28, 2016 Author Posted April 28, 2016 Posting from phone. Had a brain blank, didn't think of the obse and plugin docs. Still just beggining to understand scripting.
Fienyx Posted April 28, 2016 Author Posted April 28, 2016 Thanks for trying to help, but I just can't get the timers and spells to play nicely. Oh well. I went a different way, check it out if you want, this is how the other spells will work. BloodMageShield.esp
movomo Posted April 28, 2016 Posted April 28, 2016 Well.... I think you did it right. Whatever you did, I know you did it right.Because there was one more reason why the timer refused to work.The spell's duration was zero. :P lol, now try this one. A little bit fancier. int slvl ; shield level int slvl_max ; max shield level float timer_ Begin ScriptEffectStart ; slvl_max is equal to pc-s mastery level + 1. ; 6 means grandmaster or something. ; Decimal values are truncated automatically. set slvl_max to 1 + (GetBaseAV Alteration)/25 if slvl_max > 6 set slvl_max to 6 endif set slvl to 1 ; Initial value of the timer. (5 secs) set timer_ to 5.0 End Begin ScriptEffectUpdate set timer_ to timer_ - ScriptEffectElapsedSeconds if timer_ > 0.0 ; Bail out as fast as you can when you don-t have anything to do in this frame. ; The quicker the better. return endif if slvl == 1 ; blood shield 1 elseif slvl == 2 ; blood shield 2 elseif slvl == 3 ; blood shield 3 elseif slvl == 4 ; blood shield 4 elseif slvl == 5 ; blood shield 5 elseif slvl == 6 ; blood shield 6 endif set slvl to slvl + 1 if slvl > slvl_max ; What now? We-ve hit the max level possible with the current alteration skill. ; Uh.. dispel, maybe. ; no point in keeping the empty timer running. endif ; timer interval increases linearly: 5x seconds. ; So its 5 secs the first time (weve already set it before), ; and 10 secs for the second cut, 15 secs for the third cut, ... set timer_ to 5.0 * slvl End
Fienyx Posted April 28, 2016 Author Posted April 28, 2016 Nope, that didn't do it either. The way in my last post will work good enough for me. Doesn't seem to work for the destruction spells, but that's fine. I mostly wanted the shield, and I have a simple working version of what I had originally hoped for.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.