niteshadowthebiofreak Posted March 10, 2009 Share Posted March 10, 2009 Here is the script i have so far,Set to the weapon itself and NOT as an enchantment. (Names have been changed) Begin onhitwith dagger || shortsword ||longsword || claymore getisplayablerace getdead if GetIsPlayableRace== 1.00 && getdead == 1.00 Message "To avoid spoiling things i have removed this message" player.additem Item 1 elseif GetIsPlayableRace== 0.00 && getdead == 1.00 Message "To avoid spoiling things i have removed this message" Elseif getdead < 1.00 endif endif I think i know what is going wrong with this,I believe its trying to grab the needed information from the blade, and not the person being hit, It works as an enchantment, That's what has led me to believe this.We have, other plans for the enchantment slots. How can I set the ref to the person being hit? without having thousands of lines of script for every NPC in the game? ------------------Edit-----------------Seems i cannot fix that typo in the thread title....sorry. Link to comment Share on other sites More sharing options...
ihateregisteringeverywhere Posted March 10, 2009 Share Posted March 10, 2009 I'm not sure, not much of a scripter myself, but I've got a sneaky feeling that this:getisplayablerace getdead if GetIsPlayableRace== 1.00 && getdead == 1.00 should be this:if (GetIsPlayableRace==1.00) && (getdead==1.00) and I'm suspicious of some other lines as well, but as I've mentioned - I'm not that much of a scripter =\. Link to comment Share on other sites More sharing options...
niteshadowthebiofreak Posted March 10, 2009 Author Share Posted March 10, 2009 where, yes, that is a mistake,It did nothing to the script to keep it from working,(thanks for pointing it out though) as i said, this same script worked as a scripted enchantment, Link to comment Share on other sites More sharing options...
ihateregisteringeverywhere Posted March 10, 2009 Share Posted March 10, 2009 I also don't really understand the last elseif, and one endif seems to be superfluous as well. Link to comment Share on other sites More sharing options...
niteshadowthebiofreak Posted March 10, 2009 Author Share Posted March 10, 2009 I also don't really understand the last elseif, and one endif seems to be superfluous as well. and not the problem, Ive already ruled out what has been entered,im MISSING something. Link to comment Share on other sites More sharing options...
ihateregisteringeverywhere Posted March 10, 2009 Share Posted March 10, 2009 I'm slowly starting to see the problem. I think. First of all both getdead and OnhitWith need an actor reference. Like: Player.OnHitWith or Player.GetDead. No refference = the function won't return anything. You probably want a script that tells you if you managed to hit someone and if he's dead. I think that there's no direct support for that in vanilla. You have to use OBSE to check for who's at the crosshair when you attack. And use the getdead function together with the refference that function would return. I'm almost certain that you'll have to wait a frame to check for that as well. But don't take my word on that. Link to comment Share on other sites More sharing options...
jonesjoshuar Posted March 10, 2009 Share Posted March 10, 2009 i think you have to get the reference of what your hitting i think. Im not sure about that, i have not had to look into anything that requires this. your code could be neater and less likely to be buggy if you nested it instead of ands. if (getdead < 1) ; not sure the point of this but okay return ; assuming you want to terminate this script if actor is dead. else if (GetIsPlayableRace== 1.00) Message "To avoid spoiling things i have removed this message" player.additem Item 1 else Message "To avoid spoiling things i have removed this message" endif endif I read that this is a better and safer way to script in oblivion. It is also easier to read :) Link to comment Share on other sites More sharing options...
niteshadowthebiofreak Posted March 10, 2009 Author Share Posted March 10, 2009 @ihateregistering...Thats more along the lines of what im after.By any chance do you know the command? @jonesjoshuar:what Im shooting for is an event trigger that works only when you've killed a humanoid. (There is a hint as to why in my sig btw) will your code work for this? Link to comment Share on other sites More sharing options...
ihateregisteringeverywhere Posted March 10, 2009 Share Posted March 10, 2009 it's GetCrosshairRef. I'm not sure about how to check if the player started an attack though. You could probably use this approach to add effects to unarmed as well... hmm.... The easy way to script this would be with an script enchantment. Then you'd just have to: ref target set target to GetSelf and then begin target.OnHitwith SUPERWEAPONOFDOOMif (player.GetIsPlayableRace) && (target.GetDead) (By the way, if a function returns 1 when it's true then there's no need to compare it to 1 one more time... I think) In case you'd use that solution but want to let the player enchant his weapon then you can use the OBSE functions like addenchantment or modenchantment in a OnEquipt block of a weapon script. (And then remove them in a UnEquipt block) Link to comment Share on other sites More sharing options...
niteshadowthebiofreak Posted March 10, 2009 Author Share Posted March 10, 2009 the beginonhitwith should fix the problem of detecting if the player started the attack, in theory anyway. ill have to test this. I got an idea from looking at what you just posted for using this as an enchantment script. *steals*ref target set target to Getcrosshairref if (target.yadda yadda) looking at the description it returns the ref itself.The ref, unless im wrong, (I probably am) should be pasted in place of "target". Am i right? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.