trashgarbage666 Posted January 3, 2018 Author Share Posted January 3, 2018 (edited) I tried out a new method and actually got it to work! It has one noticeable bug, but it's kind of small, and I'm thinking it can be worked out. For some reason, it's rewarding the player with 3x the normal experience for a headshot kill. I'm moving things around to try and solve the issue, but maybe I made a rookie mistake somewhere that I'm just not seeing. Maybe you can spot the problem? On all relevant ammo, I have an Impact Script that looks like this ScriptName AmmoSCRIPT BEGIN GameMode If (GetHitLocation == 1 || GetHitLocation == 2) CastImmediateOnSelf HeadshotSpell EndIf END HeadshotSpell is an Actor Effect type spell with "Disallow Absorb/Reflect", "Script Effect Always Applies", and "Area Effect Ignores LOS" all checked. HeadshotSpell only has one effect, which is to execute the HeadshotBaseEffect so long as the victim isn't wearing a relevant helmet, isn't a creature, and isn't dead. HeadshotBaseEffect has Self checked, and uses the "Script" Effect Archetype. The script it uses is called "HeadshotSCRIPT", and it looks like this ScriptName HeadshotSCRIPT BEGIN GameMode ForceAV Health 0 KillActor Player END And those are all the moving parts! In HeadshotSCRIPT, I originally used "DamageAV Health 999" without "KillActor Player", but it didn't give the player any credit for the kill, and oddly enough, dealt 999 damage to the victim three times. So I think there's a potential clue there. Edited January 3, 2018 by punchbattle Link to comment Share on other sites More sharing options...
dubiousintent Posted January 3, 2018 Share Posted January 3, 2018 No idea why you are getting it called three times, but suggest you put a "DoOnce" into the HeadShotSCRIPT. You only want to kill the actor once anyway. -Dubious- Link to comment Share on other sites More sharing options...
Mktavish Posted January 3, 2018 Share Posted January 3, 2018 (edited) Try this block instead of GameMode , for the scn HeadShotScript . "Begin ScriptEffectStart" But the DoOnce variable could work , if it is going to run a new instance of the script for every bullet that casts the spell. Therefore DoOnce always starting out as 0 , instead of needing to reset it to 0 some how ? By the way ... is that working to kill the player also ? And is the player getting xp for getting head shotted ? But I suppose that doesn't really matter since their dead and would have to start over from before the xp gain. Edited January 3, 2018 by Mktavish Link to comment Share on other sites More sharing options...
trashgarbage666 Posted January 3, 2018 Author Share Posted January 3, 2018 (edited) HAH!! IT WORKS!! Turns out "ScriptEffectStart" was the script block I needed to use! This is amazing! All this effort finally payed off! It's stable, correctly assigns wonership to each kill regardless of who did it, and awards the correct amount of EXP to the player! To answer your question Mktavish, this setup is lethal to NPCs as well as the player! Dubiousintent and Mktavish, thank you guys so much! Edited January 3, 2018 by punchbattle Link to comment Share on other sites More sharing options...
Mktavish Posted January 3, 2018 Share Posted January 3, 2018 (edited) Thats Awesome ! But still the line of "KillActor Player" is a bit worrisome.It seems that may give the player credit anytime an actor is killed by that script.Ergo ... will effect faction relation , and award xp. So umm , I guess make 2 base effect scripts , and add both to the ActorEffect. One that uses "KillActor Player"and the other "KillActor" And put conditions on them to check if it is the player doing the shooting some how ? Edited January 3, 2018 by Mktavish Link to comment Share on other sites More sharing options...
dubiousintent Posted January 3, 2018 Share Posted January 3, 2018 Congrats! Glad to see your perseverance pay off. And never forget: you learn more from your mistakes than from everything going correctly the first time through dumb luck. -Dubious- Link to comment Share on other sites More sharing options...
trashgarbage666 Posted January 3, 2018 Author Share Posted January 3, 2018 (edited) Thats Awesome ! But still the line of "KillActor Player" is a bit worrisome.It seems that may give the player credit anytime an actor is killed by that script.Ergo ... will effect faction relation , and award xp. So umm , I guess make 2 base effect scripts , and add both to the ActorEffect. One that uses "KillActor Player"and the other "KillActor" And put conditions on them to check if it is the player doing the shooting some how ? I actually had the same concern, so I spawned in a monster next to an NPC and set the monster's health to 1 so the NPC would kill it right away. When the monster died, I wasn't given any EXP, and my "Creatures Killed" stat did not go up by one. But I'm still going to follow your advice, just in case. Actually, I did manage to find a bug! If your first hit on an NPC is a headshot, it awards the correct amount of EXP. However! If you shoot a different body part first and then headshot them, you are given double EXP. It doesn't stack, though, so nine body shots and one headshot will not award the player 10x EXP. At max, you're always getting double. My guess is that multiple instances of either the headshot script or headshot spell are still running on the NPC, even after the bullet hits its target. Is there some way to tell a script to "terminate" itself at the end of its code? EDIT: Turns out my current setup does have problems assigning correct kill ownership when the player isn't involved in the fight. Like we had initially assumed, thanks to "KillActor Player", it assumes the player is responsible for every headshot that takes place. I've been tearing the wiki apart trying to find out how to get an item or script to reference itself so I can use GetOwner, but still haven't found anything. Edited January 4, 2018 by punchbattle Link to comment Share on other sites More sharing options...
Mktavish Posted January 4, 2018 Share Posted January 4, 2018 (edited) The double XP award makes sense , since you are killing the subject twice in the script. Once with ForceAV Health 0 and the other with KillActor Player. But ForceAV only gives credit if one hit of damage has been assigned previously , otherwise nobody gets credit. Not sure if "KillActor" will do the same thing ?.................. But ya on how to differentiate the player as the shooter vs everybody else. And at the Actor Effect , I see no way to do that. So it will have to be done at the ammo script , which will then determine between 2 different actor effects , each with their own base effect script. Ok since , GetOwnerLastTarget works with the ammo script. Then a conditional statement of "If IsOwner == 1"Should work ... as described here in the wiki ... http://geck.bethsoft.com/index.php?title=IsOwner ~~~~~~~~~~~ScriptName AmmoSCRIPTBEGIN GameMode If IsOwner == 1 && (GetHitLocation == 1 || GetHitLocation == 2) CastImmediateOnSelf HeadshotSpell Else If (GetHitLocation == 1 || GetHitLocation == 2) CastImmediateOnSelf HeadshotSpell2 endif endifEND~~~~~~~~~~~ And on HeadshotSpell only use "KillActor Player" leaving out the "ForceAV Health 0" The script saves , but I'm not set up to test it , so I guess we will see after your tests. Edited January 4, 2018 by Mktavish Link to comment Share on other sites More sharing options...
trashgarbage666 Posted January 5, 2018 Author Share Posted January 5, 2018 (edited) The double XP award makes sense , since you are killing the subject twice in the script. Once with ForceAV Health 0 and the other with KillActor Player. But ForceAV only gives credit if one hit of damage has been assigned previously , otherwise nobody gets credit. Not sure if "KillActor" will do the same thing ? Actually, the reason I had both was because "ForceAV Health 0" by itself wasn't killing the target. "DamageAV Health 0" does kill them, but doesn't consider the player to be the person who killed the target. Having "KillActor Player" by itself gives double XP for headshots so long as you bodyshot the target first. I'm thinking about just reducing the XP reward for killing NPCs by half, that way non-headshot kills would award full XP. I don't like that option, but if I can't find a solution, I might be stuck with it. I was able to get the AmmoSCRIPT to tell the difference between player-owned headshots and NPC-owned headshots, but there's a catch... BEGIN GameMode If (GetHitLocation == 1 || GetHitLocation == 2) If Player.GetCombatTarget != GetSelf CastImmediateOnSelf HeadshotSpell2 Else CastImmediateOnSelf HeadshotSpell EndIf EndIf END I tested this by spawning 15 NCR troopers and 15 Legion Veterans close to each other and watching them fight over and over again. None of the kills were wrongfully awarded to me unless I pointed my gun at one of them right before they died. I guess the game considers anything the player is aiming at to be the player's combat target, regardless of whether I pull the trigger or not. I feel like the solution is closeby, I just don't know what to substitute "Player.GetCombatTarget" with. I tried swapping it out for "Player.GetOwnerLastTarget", but it considered every kill to be mine no matter who did it. Edited January 5, 2018 by punchbattle Link to comment Share on other sites More sharing options...
Mktavish Posted January 5, 2018 Share Posted January 5, 2018 (edited) Nice that is tricky there with "Player.GetCombatTarget" but GetSelf won't work.You have to set a variable using GetSelf , to set a value instead of making it a command to return a value.So like this ...~~~~~~~~~~~ScriptName AmmoSCRIPT Ref rOwner Begin OnHit Set rOwner to GetSelf EndBEGIN GameMode If (GetHitLocation == 1 || GetHitLocation == 2) If Player.GetCombatTarget != rOwner CastImmediateOnSelf HeadshotSpell2 Else If (GetHitLocation == 1 || GetHitLocation == 2) ; you need this here CastImmediateOnSelf HeadshotSpell Else ; do nothing EndIf EndIfEND Edited January 5, 2018 by Mktavish Link to comment Share on other sites More sharing options...
Recommended Posts