RagnaHighArc Posted September 14, 2009 Share Posted September 14, 2009 ScriptName parryWithBlock float timer short parrywithblock begin gamemode ;RETURN IF WEAPON IS NOT OUT if player.isweaponout == 0 return endif ;CHECKS TO SEE IF WEARING GAUNTLETS OTHERWISE PARRY WON'T WORK if player.getEquipped 0015985D == 0 elseif player.getEquipped 000661C2 == 0 elseif player.getEquipped 00024765 == 0 elseif player.getEquipped 0001C6D2 == 0 elseif player.getEquipped 00023199 == 0 elseif player.getEquipped 0001C6D8 == 0 elseif player.getEquipped 0001C6D6 == 0 elseif player.getEquipped 00036346 == 0 elseif player.getEquipped 0002C100 == 0 elseif player.getEquipped 0003634C== 0 elseif player.getEquipped 0002299E == 0 elseif player.getEquipped 00036352 == 0 elseif player.getEquipped 00036340 == 0 elseif player.getEquipped 00036358 == 0 elseif player.getEquipped 000347F7 == 0 return else set parrywithblock to 1 endif end ;RETURN IF ALREADY BLOCKING begin gamemode if iscontrolpressed 6 && parrywithblock == 1 return ; DO NOTHING IF PLAYER IS ONLY BLOCKING elseif iscontrolpressed 6 && parrywithblock == 0 && (player.isattacking == 0 && player.ispowerattacking == 0) set parrywithblock to 1 return endif end ;NULLUFYING ALL DAMAGE IF BLOCK IS PRESSED WITHIN THE TIME FRAME begin OnHit player if (timer >= 0.51) return elseif (timer <= 0.50) && iscontrolpressed 6 && (player.isattacking == 0 || player.ispowerattacking == 0) con_setgamesetting fblockMax 1.0 con_setgamesetting FblockScoreNoShieldMult 1.0 con_setgamesetting FblockAmountWeaponMult 1.0 con_setgamesetting FblockAmountHandToHandMult 1.0 ModActorValue Block 100 set parrywithblock to 2 else return endif end ;RESETS CHANGES TO OB'S DEFAULT VALUES WHEN BLOCK IS RELEASED(CHANGE TO SUIT YOUR NEEDS) begin gamemode if parrywithblock <= 1 return elseif con_setgamesetting FblockMax to 0.75 con_setgamesetting FblockScoreNoShieldMult to 0.50 con_setgamesetting FblockAmountWeaponMult to 0.50 con_setgamesetting FblockAmountWeaponMult to 0.25 ModActorValue Block -100 set parrywithblock to 0 endif end Whenever i try to save it as an object script nothing happens and saving it as a quest gives me an error due to the use of the "begin onhit" line. I got another parry script and i was able to save it and it worked in Oblivion, so the problem has to be in my script. Can anyone help? Also, i haven't figured out how to negate the damage inflicted on the player when parrying so the "begin onhit" block is just there for testing purposes... which is something i haven't been able to do. And this is my first script so i won't feel bad if any of you make a giant list of all the mistakes in the script hehe Link to comment Share on other sites More sharing options...
thePhilanthropy Posted September 14, 2009 Share Posted September 14, 2009 it would be helpful if you would inlude the error message, if there is any. btw, to check whether a gauntlet is equipped, try this (I haven't tested it yet): ref Gauntlets set Gauntlets to player.GetEquippedObject 4 if (Gauntlets != 0) ;gaunlets equipped elseif ;no gaunlets equipped endif EDIT: Have you launched the CS via OBSE-loader? Otherwise you can't save OBSE scripts. Link to comment Share on other sites More sharing options...
RagnaHighArc Posted September 14, 2009 Author Share Posted September 14, 2009 it would be helpful if you would inlude the error message, if there is any. btw, to check whether a gauntlet is equipped, try this (I haven't tested it yet): ref Gauntlets set Gauntlets to player.GetEquippedObject 4 if (Gauntlets != 0) ;gaunlets equipped elseif ;no gaunlets equipped endif EDIT: Have you launched the CS via OBSE-loader? Otherwise you can't save OBSE scripts. Thx for the code. And yeah i launch CS via the OBSE-loader. (E:\Ob\obse_loader.exe -editor) The only message i get is when i try to close the script window or if i try to open other scripts ---------------------------Save Current Script?---------------------------Do you want to save the current script? Current = ---------------------------Yes No --------------------------- if i click on yes nothing happens, but if click on no the CS closes completely. /// I replaced my gauntlet code for yours and i get an error while trying to save it "OBSE---------------------------Error: Mismatched block structure." Link to comment Share on other sites More sharing options...
thePhilanthropy Posted September 14, 2009 Share Posted September 14, 2009 you need to put the line "ref Gauntlets" directly below the scriptname. Maybe your "begins" and "ends" don't match up? And sorry, I can't really help right now. I don't even have the CS installed. :whistling: good luck! ps: check out http://cs.elderscrolls.com/constwiki/index...ortal:Scripting Link to comment Share on other sites More sharing options...
LoginToDownload Posted September 14, 2009 Share Posted September 14, 2009 What happens if you comment-out the OBSE functions? I don't think that's the reason it's not working. This sort of thing only happens to me when something is wrong with my if/endif loops or their parentheses, but yours look fine. Try narrowing it down, commenting each Begin/End block out until you've found where the problem is. Also, OnHit only works for the actor the script is attached to. OnHit Player checks if said actor is being hit by the player. Attaching a script to the player is generally frowned upon. As for negating the damage, you can store the player's old, higher health in a variable and use ModAV2 to restore it. Still wouldn't help if the blow would kill the player, though. Link to comment Share on other sites More sharing options...
RagnaHighArc Posted September 14, 2009 Author Share Posted September 14, 2009 OK now i don't get any errors but i still can't save it. Clicking on the save icon does nothing. Script menu to save does nothing.the only way to get a message is to either close the Script Edit Window or by clicking on one of the "to next script" arrow icon. The message I get is ---------------------------Save Current Script?---------------------------Do you want to save the current script? Current = -------------------------- Why is the area after "Current = " blank? isn't that were the script's name should go? here's the new version of the script ScriptName ParryBlock ref Gauntlets float timer short parrywithblock begin gamemode ;RETURN IF WEAPON IS NOT OUT if player.isweaponout == 0 return endif end ;CHECKS TO SEE IF WEARING GAUNTLETS OTHERWISE PARRY WON'T WORK begin gamemode ref Gauntlets set Gauntlets to player.GetEquippedObject 4 if (Gauntlets != 0) ;gaunlets equipped elseif ;no gaunlets equipped endif end ;RETURN IF ALREADY BLOCKING begin gamemode if iscontrolpressed 6 && parrywithblock == 1 return ;DO NOTHING IF PLAYER IS ONLY BLOCKING elseif iscontrolpressed 6 && parrywithblock == 0 && (player.isattacking == 0 && player.ispowerattacking == 0) set parrywithblock to 1 return endif end ;NULLUFYING ALL DAMAGE IF BLOCK IS PRESSED WITHIN THE TIME FRAME begin OnHit player if (timer >= 0.51) return elseif (timer <= 0.50) && iscontrolpressed 6 && (player.isattacking == 0 || player.ispowerattacking == 0) con_setgamesetting fblockMax 1.0 con_setgamesetting FblockScoreNoShieldMult 1.0 con_setgamesetting FblockAmountWeaponMult 1.0 con_setgamesetting FblockAmountHandToHandMult 1.0 ModActorValue Block 100 set parrywithblock to 2 else return endif end ;RESETS CHANGES TO OB'S DEFAULT VALUES WHEN BLOCK IS RELEASED(CHANGE TO SUIT YOUR NEEDS) begin gamemode if parrywithblock <= 1 return elseif con_setgamesetting FblockMax to 0.75 con_setgamesetting FblockScoreNoShieldMult to 0.50 con_setgamesetting FblockAmountWeaponMult to 0.50 con_setgamesetting FblockAmountWeaponMult to 0.25 ModActorValue Block -100 set parrywithblock to 0 endif end I was planning on attaching this script to the player, but if I shouldn't, what other type of code can i use instead of "begin onhit"? /// can i use the player's block animation as a starting point for the parry timer instead of using "OnHit"? After commenting all the lines the 1st error came from the new gauntlet code. so here's the new v. begin gamemode ref Gauntlets set Gauntlets to player.GetEquippedObject 4 if (Gauntlets == 0) return endif end all it needed was a return command. and i found the problem. It has something to do with the last block. /// AH HA! HHAHAHAHA!!!! I got it! The error came from having a "to" between the modified setting and the value in con_setGameSetting. So Yeah thanks to LoginToDownload and the_philanthropy for the help. Link to comment Share on other sites More sharing options...
LoginToDownload Posted September 14, 2009 Share Posted September 14, 2009 The only way I can think of is to use IsAnimGroupPlaying BlockHit to check if the player blocked a blow. Sometimes I just check the player's health against what it was a few frames ago, but that would return true for arrows, spells, and continuous effects as well. Link to comment Share on other sites More sharing options...
RagnaHighArc Posted September 14, 2009 Author Share Posted September 14, 2009 Well the mod doesn't work. ScriptName BlockParry ;ref Gauntlets ;ref WeaponsnoGauntlet float timer short parrywithblock short bMagicEffect ;RETURN IF WEAPON IS NOT OUT begin gamemode if (player.isweaponout == 0) return endif end ;CHECKS TO SEE IF WEAPON IS EQUIPPED WITHOUT GAUNTLETS ;begin gamemode ; ;ref Weapons ;set Weapons to player.GetEquippedObject 16 ; if (Weapons == 0 || Gauntlets == 0) ; return ; endif ;end ;CHECKS TO SEE IF WEARING GAUNTLETS - PARRY WON'T WORK FOR GAUNTLETLESS HANDTOHAND ;SIMPLIFIED VERSION OF THIS CODE CAME FROM the_philanthropy ;begin gamemode ; ;ref Gauntlets ;set Gauntlets to player.GetEquippedObject 4 ; if (Gauntlets == 0 || Weapons == 0) ; return ; endif ;end ;RETURN IF ALREADY BLOCKING begin gamemode if (iscontrolpressed 6) && (parrywithblock == 1) return ;DO NOTHING IF PLAYER IS ONLY BLOCKING elseif (iscontrolpressed 6) && (parrywithblock == 0) && (player.isattacking == 0 && player.ispowerattacking == 0) set parrywithblock to 0 return endif end begin OnMagicEffectHit set bMagicEffect to 1 end begin gamemode if bMagicEffect == 0 set timer to 0 endif end ;NULLUFYING ALL DAMAGE IF BLOCK IS PRESSED WITHIN THE TIME FRAME begin OnHit player if (bMagicEffect == 0) && (timer >= 0.51) return endif if (timer <= 0.50) && (timer > 0) && (iscontrolpressed 6) && (player.isattacking == 0 && player.ispowerattacking == 0) MessageBox "Normally I'd Parry right now, but this is just a test." ; con_setgamesetting fblockMax 1.0 ; con_setgamesetting FblockScoreNoShieldMult 1.0 ; con_setgamesetting FblockAmountWeaponMult 1.0 ; con_setgamesetting FblockAmountHandToHandMult 1.0 ; ModActorValue Block 100 set parrywithblock to 1 endif end ;RESETS CHANGES TO OB'S DEFAULT VALUES WHEN BLOCK IS RELEASED, CHANGE TO SUIT YOUR NEEDS begin gamemode if (timer >= 0.51) && (parrywithblock == 1) ; con_setgamesetting fblockMax 0.75 ; con_setgamesetting FblockScoreNoShieldMult 0.50 ; con_setgamesetting FblockAmountWeaponMult 0.50 ; con_setgamesetting FblockAmountHandtoHandMult 0.25 ; ModActorValue Block -100 set parrywithblock to 0 endif end Does anyone have any suggestions? If not then guess i just have to start from scratch. BTW here's the code for a parry mod that actually works... Scriptname MartialArtsBlockParryScript short PCIsBlocking float timer short bMagicEffect Begin OnMagicEffectHit set bMagicEffect to 1 End Begin OnHit if (bMagicEffect == 0) && (timer > 0) && (timer <= 0.5) MessageBox "Normally I'd Parry right now, but this is just a test." endif End Begin GameMode set bMagicEffect to 0 ;If the player has just started blocking, set the variable to track ;this state and begin timer if (player.IsBlocking) && (PCIsBlocking == 0) Set PCIsBlocking to 1 Set timer to 0 endif ;If the player is currently blocking, increment the timer if (player.IsBlocking) && (PCIsBlocking == 1) set timer to timer + getSecondsPassed endif ;If the player has stopped blocking, reset state and timer if (player.IsBlocking == 0) && (PCIsBlocking == 1) Set PCIsBlocking to 0 Set timer to 0 endif End Link to comment Share on other sites More sharing options...
LoginToDownload Posted September 15, 2009 Share Posted September 15, 2009 Firstly, I'm not sure how multiple Begin/End blocks with the same qualifier relate to eachother, but I'm fairly certain a Return block would only matter for the one it's used in. Taking a quick look with the blocks bashed together and commented-out lines removed for clarity. I'm having trouble understanding ParryWithBlock's role in all this. ScriptName BlockParry ;ref Gauntlets ;ref WeaponsnoGauntlet float timer short parrywithblock short bMagicEffect ;RETURN IF WEAPON IS NOT OUT begin gamemode if (player.isweaponout == 0) return endif if (iscontrolpressed 6) && (parrywithblock == 1) return elseif (iscontrolpressed 6) && (parrywithblock == 0) && (player.isattacking == 0 && player.ispowerattacking == 0) set parrywithblock to 0;Why is ParryWithBlock being set to 0 in an if-loop that will only run if it's already 0? return endif if bMagicEffect == 0;Automatically resetting the timer if the player isn't under a magic effect? Why? set timer to 0 endif if (timer >= 0.51) && (parrywithblock == 1);You're never increasing the timer. set parrywithblock to 0 endif end begin OnMagicEffectHit set bMagicEffect to 1;You're never setting this to 0 again, so it will permanently treat the player as "hit with a magic effect" once hit once. end begin OnHit player;Aside from the previous problem with "OnHit player" mentioned, this still requires slapping a script on them. Did the Script you copied do that? if (bMagicEffect == 0) && (timer >= 0.51);It will only return if the player has both not been hit by a magic effect and blocking for over half a second? Why? return endif if (timer <= 0.50) && (timer > 0) && (iscontrolpressed 6) && (player.isattacking == 0 && player.ispowerattacking == 0) MessageBox "Normally I'd Parry right now, but this is just a test." set parrywithblock to 1 ;This won't run because, as established before, Timer is never greater than 0. endif end Link to comment Share on other sites More sharing options...
RagnaHighArc Posted September 15, 2009 Author Share Posted September 15, 2009 My blockparry script was just a bunch of ideas put together in the order that i thought they should go in. When the mod didn't work i decided to use some of the ideas from the "MartialArtsBlockParryScript", but it got too messy. So now i'm using the "MartialArtsBlockParryScript" as the template for my new script. Let's see.. The "bMagicEffect" needed to be set to zero in order to run the next block, which wasn't written well. I completely abandoned my "blockparry" script. The only thing i used from it is the gamesetting code But I did manage to get my new script to kinda work. The only problems i have with it is that holding block also holds the modActorValue block modifier until i release it and the "fBlockMax 1.0" seems to start right after i get hit. so i still take damage, unless i keep holding block in which case it ends up turning into somesort of godmode after the 1st parry. /// BTW how do you check the player's health against what it was a few frames ago? Link to comment Share on other sites More sharing options...
Recommended Posts