addtofaction(aadpBlockElemAttack) No longer works?

Post » Tue Jan 22, 2013 9:51 pm

This one is kicking my backside so much it is now NUMB!

Why in the known world would this not be working?
I am not seeing my debug message, and other tests I have done shows the attacker is not added to the faction.
I have checked the faction a dozen times to be sure it is set in the properties.

Scriptname aadpTestScript extends ActiveMagicEffect  Faction Property aadpBlockElemAttack  AutoEvent OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)actor attacker = (akAggressor as Actor)attacker.addtofaction(aadpBlockElemAttack)if attacker.isinfaction(aadpBlockElemAttack) == trueDebug.messagebox("Working")endifendevent
User avatar
Vincent Joe
 
Posts: 3370
Joined: Wed Sep 26, 2007 1:13 pm

Post » Tue Jan 22, 2013 11:36 pm

There are few things I would check:

- Did OnHit actually fire?
- Was attacker/akAggressor ref(s) NOT 'none'?
User avatar
KU Fint
 
Posts: 3402
Joined: Mon Dec 04, 2006 4:00 pm

Post » Tue Jan 22, 2013 11:19 pm

Did you not forget to set the property on the faction? If you forgot the property, the faction can't be added either.
User avatar
Mrs shelly Sugarplum
 
Posts: 3440
Joined: Thu Jun 15, 2006 2:16 am

Post » Wed Jan 23, 2013 4:17 am

I put this in :


attacker.addtofaction(aadpBlockElemAttack)

if attacker.isinfaction(aadpBlockElemAttack) == true
debug.messagebox("working")
elseif (attacker.isincombat())
debug.messagebox("Attacker is a good ref and in combat")
endif

AND I DO GET THE "GOOD REF" MESSAGE!!!!??? :wallbash:

WTH is going on? I have used factions just like this several times before over the last few months with no issues. :cry:

I do not even know where to go with this now. Is the only thing left to do is DELETE all the code/CT edits for this and start from scratch?

There are few things I would check:

- Did OnHit actually fire?
- Was attacker/akAggressor ref(s) NOT 'none'?
User avatar
Lexy Corpsey
 
Posts: 3448
Joined: Tue Jun 27, 2006 12:39 am

Post » Tue Jan 22, 2013 11:50 pm

"a dozen times". :(

But lets just pretend that I did not, how would I check this IN the script itself?

We need a function like:

aadpBlockElemAttack.IsAGoodProperty() == true


Did you not forget to set the property on the faction? If you forgot the property, the faction can't be added either.
User avatar
Chris Duncan
 
Posts: 3471
Joined: Sun Jun 24, 2007 2:31 am

Post » Tue Jan 22, 2013 7:10 pm

Did this:


aadpBlockElemAttack.SetCrimeGold(10)
debug.messagebox(aadpBlockElemAttack.GetCrimeGold())

And I get ZERO! :eek:

This would make be think I did NOT set the proerpties BUT I DID:

Faction Property aadpBlockElemAttack Auto

and in the properties tab I slide the view over to the right and it reads the value as "aadpBlockElemAttack"

This must be some corruption of some kind, I will delete all the edits related to this faction and start again. :pinch:
User avatar
Maria Garcia
 
Posts: 3358
Joined: Sat Jul 01, 2006 6:59 am

Post » Wed Jan 23, 2013 1:19 am

HOLY CRAP!

I deleted it all, saved, exit out of the CT then re-opened the program....remade everything:

Faction Property aadpElemBlockingFaction Auto ;--- NEW NAME


aadpElemBlockingFaction.SetCrimeGold(10)
debug.messagebox( aadpElemBlockingFaction.GetCrimeGold())


and I am STILL GETTING ZERO!

PLEASE will someone that has SKSE and 1.6 Skyrim try this, I just want to be sure this is not some kind of fluke bug after the last upgrade from Bethesda/SKSE. :bowdown:
User avatar
Beulah Bell
 
Posts: 3372
Joined: Thu Nov 23, 2006 7:08 pm

Post » Tue Jan 22, 2013 2:34 pm

I copied/pasted your very first script, just replacing your Faction with BanditFaction, in a ReferenceAlias script on Player.

Then launched a fight in Whiterun and got "Working" on every hit. Your problem must come from your ME/Spell, but not AddToFaction.
User avatar
jeremey wisor
 
Posts: 3458
Joined: Mon Oct 22, 2007 5:30 pm

Post » Tue Jan 22, 2013 4:09 pm

"a dozen times". :(

But lets just pretend that I did not, how would I check this IN the script itself?

We need a function like:

aadpBlockElemAttack.IsAGoodProperty() == true

Just mentioned in the SKSE thread what you can do :P
User avatar
Gracie Dugdale
 
Posts: 3397
Joined: Wed Jun 14, 2006 11:02 pm

Post » Wed Jan 23, 2013 3:08 am

I will do the same thing as you did with the Bandit faction just to see if any thing changes.

And I need to start a new game in case this is some strange dirty save game type bug, I will do that first, should probably done that already but up till now I had no problem with my testing and the save game I use for testing.

I cannot believe this stupid issue is holding my work up now for 2 days.

I copied/pasted your very first script, just replacing your Faction with BanditFaction, in a ReferenceAlias script on Player.

Then launched a fight in Whiterun and got "Working" on every hit. Your problem must come from your ME/Spell, but not AddToFaction.
User avatar
Danger Mouse
 
Posts: 3393
Joined: Sat Oct 07, 2006 9:55 am

Post » Tue Jan 22, 2013 9:53 pm

I know this may sound like a silly questtion but what is the script running on, extends ????
User avatar
C.L.U.T.C.H
 
Posts: 3385
Joined: Tue Aug 14, 2007 6:23 pm

Post » Wed Jan 23, 2013 4:14 am

Oh for pete sake....

IT WAS A "DIRTY" SAVEGAME.

I started a new game and it worked fine, god oh mighty this game is fickle. So the new lines of script MAY work in a script that is running in a save game but new properties will not. Ok... lesson learned.

Thank you all and sorry to have taken some of your moding time on this.
User avatar
Jerry Jr. Ortiz
 
Posts: 3457
Joined: Fri Nov 23, 2007 12:39 pm

Post » Wed Jan 23, 2013 4:29 am

I hope you are aware of scripts & their properties being persisted in saves game? This makes updating mod AND uninstalling mod unpleasant experience. Clean save won't work as it did for Oblivion

http://www.gamesas.com/topic/1386485-uninstalling-scripts-vs-leaving-them-in-but-replacing-with-blanks/ is the topic that address some of the work-around.

Basically, you should attach your scripts to quest, reference aliases, .... So every time you need to clean up/updating scripts, you should stop the said quest and start the quest again. When the quest stop, it will force all its script/reference aliases' script to stop.

If you attach a script to 'placeAtme' object, that object should be disable then deleted when you update your mod OR uninstall your mod, to ensure the attach script dies before disable the esp.
User avatar
Nichola Haynes
 
Posts: 3457
Joined: Tue Aug 01, 2006 4:54 pm

Post » Wed Jan 23, 2013 5:47 am

Yes I do. That is why I said it might be an issue with a "dirty save game". In fact I was the first moder as far as I know to include a clean savegame in my mod zip for player troubleshooting.

However I do not agree with you about using aliases and place at me objects, but that may just be my preference for the advantages I get by using magic abilities instead.

I should have checked for the dirty save game as the source of the issue first but I had been using a special "clean" testing save game with no problems until now. I think I may have saved over it while testing the same script a few days ago without realizing it. At least that is the simple explanation. All I had to do was go back to my back up and use that same save game from my back up and all was fine.

I apologize for not thinking of that before using up everyone's time on this.

I hope you are aware of scripts & their properties being persisted in saves game? This makes updating mod AND uninstalling mod unpleasant experience. Clean save won't work as it did for Oblivion

User avatar
Mimi BC
 
Posts: 3282
Joined: Sat Oct 07, 2006 10:30 pm

Post » Wed Jan 23, 2013 12:51 am

However I do not agree with you about using aliases and place at me objects, but that may just be my preference for the advantages I get by using magic abilities instead.

Abilities (as well as factions and scripts) work awesomely in conjunction with ReferenceAliases (assuming you're not adding abilities to a bajillion actors at once). Instead of calling AddSpell/RemoveSpell, you can just ForceRefTo and Clear an alias. The real beauty of it, though is what rongphale mentioned. If you stop the quest the aliases are attached to, everything gets automatically booted out of the aliases, removing any abilities, factions, scripts, or packages added via alias.
User avatar
marie breen
 
Posts: 3388
Joined: Thu Aug 03, 2006 4:50 am

Post » Wed Jan 23, 2013 2:23 am

Aliases are great if you know in advance how many you are going to need, not so great if you need to work with an arbitrary number of actors. If only we had alias arrays! :cool:

Abilities (as well as factions and scripts) work awesomely in conjunction with ReferenceAliases (assuming you're not adding abilities to a bajillion actors at once). Instead of calling AddSpell/RemoveSpell, you can just ForceRefTo and Clear an alias. The real beauty of it, though is what rongphale mentioned. If you stop the quest the aliases are attached to, everything gets automatically booted out of the aliases, removing any abilities, factions, scripts, or packages added via alias.
User avatar
Pete Schmitzer
 
Posts: 3387
Joined: Fri Sep 14, 2007 8:20 am

Post » Tue Jan 22, 2013 3:47 pm

Abilities (as well as factions and scripts) work awesomely in conjunction with ReferenceAliases (assuming you're not adding abilities to a bajillion actors at once). Instead of calling AddSpell/RemoveSpell, you can just ForceRefTo and Clear an alias. The real beauty of it, though is what rongphale mentioned. If you stop the quest the aliases are attached to, everything gets automatically booted out of the aliases, removing any abilities, factions, scripts, or packages added via alias.

But we all know that spooky (and me too :P) add our scripts to every single actor out there :P However, doesn't the same really count if you add a scripted spell to someone? When the mod is deactivated, won't that also remove the spells from all actors, and therefore the scripts too?
User avatar
Sammygirl500
 
Posts: 3511
Joined: Wed Jun 14, 2006 4:46 pm

Post » Wed Jan 23, 2013 6:30 am

from other posts I've read about mod uninstalls and save games...it sounds like a shady process at best

The real downside I've found is that its incredibly tedious to edit them en masse. After they're created, updating them is a real chore.
User avatar
Rinceoir
 
Posts: 3407
Joined: Thu Jun 29, 2006 1:54 am

Post » Tue Jan 22, 2013 2:04 pm

When the mod is deactivated, won't that also remove the spells from all actors, and therefore the scripts too?

Spells that are ability type with script attached, no, since the script will always be running, even at the time of uninstalling/updating said mod. What you want is to make the script stop some how when update your mod or uninstall altogether. (Manually removeSpell or something?)

If, for some reason, you are updating/removing your mod at the middle of battle, when all crazy spells being cast, and the magic effects still lingering on.... You can figure out the rest
User avatar
Fam Mughal
 
Posts: 3468
Joined: Sat May 26, 2007 3:18 am


Return to V - Skyrim