Why is this script not working?

Post » Tue Nov 09, 2010 6:27 am

Ok, so I'm trying to make a script that counteracts the bounty you get when you kill a guard and you aren't detected.

When I attached the script to the guard himself, it worked just fine, but when I put it into an ability, it stopped working.

scn RemoveLoneGuardBounty
Begin ScriptEffectStart

if isGuard == 0
;removes the ability if the actor is not a guard
removeSpell AbRemoveGuardBounty
endif

end

Begin OnDeath player

if player.isSctorDetected == 0
player.modCrimeGold -1000
endif

end

If anyone has any idea why this would stop working when applied as an Imperial ability, please let me know. I really don't want to have to apply this script to each guard individually. O_O

Edit: Ok, it seems that, although I added this to the Imperial race's abilities, it didn't get applied to anyone in that race. Once again, if you know why, please let me know.
User avatar
Kerri Lee
 
Posts: 3404
Joined: Sun Feb 25, 2007 9:37 pm

Post » Mon Nov 08, 2010 11:16 pm

Part of the problem is the Begin OnDeath Player part. That part will only run when the Player character dies. http://tesnexus.com/downloads/file.php?id=5977 does what you're looking for. Check it out and see how it was done.
User avatar
Trish
 
Posts: 3332
Joined: Fri Feb 23, 2007 9:00 am

Post » Mon Nov 08, 2010 8:30 pm

The script runs fine, and I found my problem. The problem was that the ability only got added to new guards (e.g. guards that were killed and respawned), not existing guards. Thanks for trying to help though.

By the way, the Begin OnDeath Player part of the script was taken directly from one of Bethesda's scripts. It specifies that the guard was killed by the player.
User avatar
Natalie J Webster
 
Posts: 3488
Joined: Tue Jul 25, 2006 1:35 pm

Post » Mon Nov 08, 2010 5:21 pm

Part of the problem is the Begin OnDeath Player part. That part will only run when the Player character dies.


The ActorID in onDeath refers to who killed the scripted actor, not the scripted actor itself (it always runs on the scripted actor thus ActorID in the way you're thinking of would be pointless.)
User avatar
Mrs. Patton
 
Posts: 3418
Joined: Fri Jan 26, 2007 8:00 am

Post » Mon Nov 08, 2010 5:34 pm

Well, the script was running fine, but now that I have the ability applied to the guards, the script isn't recognizing the player... Any help would be appreciated.

Edit: Actually, I've done some more testing, and it seems to have stopped working altogether... I really don't get why it would stop working like this,

Edit 2: I really don't get it. I went through and applied the ability to every guard in the game, but it still isn't applying until the guards die and respawn. I really don't understand why this is happening.
User avatar
Brandon Wilson
 
Posts: 3487
Joined: Sat Oct 13, 2007 1:31 am

Post » Mon Nov 08, 2010 4:25 pm

I see lots, and I mean LOTS of Imperial Guards in CS 8( I can understand why you don't want to apply the ability individually

For the race ability problem, try to put it in your current race and remove the "if not a guard remove the spell" and see if it works. If it is, then you've found your problem
User avatar
Lucie H
 
Posts: 3276
Joined: Tue Mar 13, 2007 11:46 pm

Post » Mon Nov 08, 2010 5:38 pm

Well, the script was running fine, but now that I have the ability applied to the guards, the script isn't recognizing the player... Any help would be appreciated.

Edit: Actually, I've done some more testing, and it seems to have stopped working altogether... I really don't get why it would stop working like this,

Edit 2: I really don't get it. I went through and applied the ability to every guard in the game, but it still isn't applying until the guards die and respawn. I really don't understand why this is happening.


What do you mean it is applying when the guards die and respawn - what did you check ? What applying means ? It actually runs the onDeath block ? please be clearer
Probably cause abilities are applied when actor is first loaded ? - not sure though - Try adding the ab via a quest script after recoding it :
Are you sure OnDeath functions on magic scripts ? http://cs.elderscrolls.com/constwiki/index.php/Talk:Magic_effect_scripts#Undocumented_blocktypes :deal:

psst - you do not really have if player.isSctorDetected == 0 in the script, do you ?
User avatar
Antonio Gigliotta
 
Posts: 3439
Joined: Fri Jul 06, 2007 1:39 pm


Return to IV - Oblivion