Trying to create a set piece bonus. (And its going HORRIBLY

Post » Mon Nov 19, 2012 3:07 am

What I'm trying to do:

Create a 3 piece armor that doubles the wearers speed ONLY when all three piece are worn.
Has to work for NPCs as well as the Player.


My Approach:

http://www.creationkit.com/Variables_and_Properties_(Papyrus)
I've attached one ObjectReference script to each of the armor pieces, each script creates a Public Int Property that the OTHER scripts can check.
This Property starts at 0, and is then set to 1 using the OnEquipped event. (And reset to 0 using the OnUnEquipped Event)
After that its a simple If statement to check if all three properties are equal or higher then 3.

This means setting up references for each script in each script, and using those references for the If statement in each script.


Here is the Code:

The Set is called the Spellblade set, this is the code for the Boots:
Spoiler

Scriptname Exo_SpellbladeBootsSCRIPT extends ObjectReference;A Script trying to add set bonuses to three pieces of armor.Exo_SpellbladeChestSCRIPT Property myChest_SCRIPT Auto               ;Here I set a property for the Script attached to the Chest pieceExo_SpellbladeGlovesSCRIPT Property myGloves_SCRIPT Auto             ;Here I set a Property for the Script attached to the GlovesInt Property myBoots_SB Auto                                         ;This is the Public Int Property for the BootsInt myBoots_SB = 0                                                   ;It starts at 0Event OnEquipped(Actor akActor)     myBoots_SB = 1                                                                     ;When the actor equips them, the property is set to 1     If (myBoots_SB + myChestSCRIPT.myChest_SB + myGlovesSCRIPT.myGloves_SB >= 3)       ;Then we check if at least three pieces of armor are equipped          akActor.SetActorValue("SpeedMult", 2)		                                ;And we double that actors speed.     endIfendEventEvent OnUnEqipped(Actor akActor)     myBoots_SB = 0	                                               ;When the Item is unequipped we reset the Int property to 0      akActor.SetActorValue("SpeedMult", 0)                             ;And remove the effect. No need for another If statement here as so far its only a 3 piece armor anyway.endEvent

Here is the Code for the Chest Piece:
Spoiler

Scriptname Exo_SpellbladeChestSCRIPT extends ObjectReference  Exo_SpellbladeBootsSCRIPT Property myBoots_SCRIPT Auto			;Here I set a property for the Script attached to the Boots	Exo_SpellbladeGlovesSCRIPT Property myGloves_SCRIPT Auto 		;Here I set a property for the Script attached to the GlovesInt Property myChest_SB Auto 		        ;This is the Public Int Property for the Chest PieceInt myChest_SB = 0 				;It starts at 0Event OnEquipped(Actor akActor)		myChest_SB = 1 				                                        ;When the actor equips them, the property is set to 1	If (myBoots_SCRIPT.myBoots_SB + myChest_SB + myGlovesSCRIPT.myGloves_SB >= 3) 	;Then we check if at least three pieces of armor are equipped			akActor.SetActorValue("SpeedMult", 2)                                   ;And we double that actors speed.	endIfendEventEvent OnUnEqipped(Actor akActor)	myChest_SB = 0 					   ;When the Item is unequipped we reset the Int property to 0	akActor.SetActorValue("SpeedMult", 0) 		   ;And remove the effect. No need for another If statement here as so far its only a 3 piece armor anyway.endEvent

And this is the gloves:
Spoiler

Scriptname Exo_SpellbladeGlovesSCRIPT extends ObjectReference Exo_SpellbladeChestSCRIPT Property myChest_SCRIPT Auto 		;Here I set a property for the Script attached to the Chest pieceExo_SpellbladeBootsSCRIPT Property myBoots_SCRIPT Auto 		;Here I set a property for the Script attached to the BootsInt Property myGloves_SB Auto		        ;This is the Public Int Property for the Gloves Int myGloves_SB = 0				;It starts at 0Event OnEquipped(Actor akActor)		myGloves_SB = 1 		                                                ;When the actor equips them, the property is set to 1	If (myBootsSCRIPT.myBoots_SB + myChestSCRIPT.myChest_SB + myGloves_SB >= 3)	;Then we check if at least three pieces of armor are equipped		akActor.SetActorValue("SpeedMult", 2)					; And we double that actors speed.	endIfendEventEvent OnUnEqipped(Actor akActor)	myGloves_SB = 0 			        ;When the Item is unequipped we reset the Int property to 0	akActor.SetActorValue("SpeedMult", 0) 		;And remove the effect. No need for another If statement here as so far its only a 3 piece armor anyway.endEvent

This is NOT compiling, and here are the error messages:

This is for the Boots script:
Spoiler

Starting 1 compile threads for 1 files...
Compiling "Exo_SpellbladeBootsSCRIPT"...
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeGlovesSCRIPT.psc(15,5): variable myBootsSCRIPT is undefined
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeGlovesSCRIPT.psc(15,19): none is not a known user-defined type
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeGlovesSCRIPT.psc(15,32): variable myChestSCRIPT is undefined
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeGlovesSCRIPT.psc(15,46): none is not a known user-defined type
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeGlovesSCRIPT.psc(15,30): cannot add a none to a none (cast missing or types unrelated)
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeGlovesSCRIPT.psc(15,57): cannot add a none to a int (cast missing or types unrelated)
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeGlovesSCRIPT.psc(15,71): cannot compare a none to a int (cast missing or types unrelated)
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeGlovesSCRIPT.psc(15,71): cannot relatively compare variables to None
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeChestSCRIPT.psc(13,46): variable myGlovesSCRIPT is undefined
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeChestSCRIPT.psc(13,61): none is not a known user-defined type
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeChestSCRIPT.psc(13,44): cannot add a int to a none (cast missing or types unrelated)
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\Exo_SpellbladeBootsSCRIPT.psc(14,18): variable myChestSCRIPT is undefined
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\Exo_SpellbladeBootsSCRIPT.psc(14,32): none is not a known user-defined type
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\Exo_SpellbladeBootsSCRIPT.psc(14,16): cannot add a int to a none (cast missing or types unrelated)
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\Exo_SpellbladeBootsSCRIPT.psc(14,45): variable myGlovesSCRIPT is undefined
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\Exo_SpellbladeBootsSCRIPT.psc(14,60): none is not a known user-defined type
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\Exo_SpellbladeBootsSCRIPT.psc(14,43): cannot add a int to a none (cast missing or types unrelated)
No output generated for Exo_SpellbladeBootsSCRIPT, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on Exo_SpellbladeBootsSCRIPT

This is for the Chest script.
Spoiler

Starting 1 compile threads for 1 files...
Compiling "Exo_SpellbladeChestSCRIPT"...
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeGlovesSCRIPT.psc(14,4): variable myBootsSCRIPT is undefined
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeGlovesSCRIPT.psc(14,18): none is not a known user-defined type
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeGlovesSCRIPT.psc(14,31): variable myChestSCRIPT is undefined
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeGlovesSCRIPT.psc(14,45): none is not a known user-defined type
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeGlovesSCRIPT.psc(14,29): cannot add a none to a none (cast missing or types unrelated)
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeGlovesSCRIPT.psc(14,56): cannot add a none to a int (cast missing or types unrelated)
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeGlovesSCRIPT.psc(14,70): cannot compare a none to a int (cast missing or types unrelated)
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeGlovesSCRIPT.psc(14,70): cannot relatively compare variables to None
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeBootsSCRIPT.psc(14,18): variable myChestSCRIPT is undefined
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeBootsSCRIPT.psc(14,32): none is not a known user-defined type
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeBootsSCRIPT.psc(14,16): cannot add a int to a none (cast missing or types unrelated)
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeBootsSCRIPT.psc(14,45): variable myGlovesSCRIPT is undefined
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeBootsSCRIPT.psc(14,60): none is not a known user-defined type
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeBootsSCRIPT.psc(14,43): cannot add a int to a none (cast missing or types unrelated)
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\Exo_SpellbladeChestSCRIPT.psc(13,46): variable myGlovesSCRIPT is undefined
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\Exo_SpellbladeChestSCRIPT.psc(13,61): none is not a known user-defined type
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\Exo_SpellbladeChestSCRIPT.psc(13,44): cannot add a int to a none (cast missing or types unrelated)
No output generated for Exo_SpellbladeChestSCRIPT, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on Exo_SpellbladeChestSCRIPT

And this is for the gloves script:
Spoiler

Starting 1 compile threads for 1 files...
Compiling "Exo_SpellbladeGlovesSCRIPT"...
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeBootsSCRIPT.psc(14,18): variable myChestSCRIPT is undefined
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeBootsSCRIPT.psc(14,32): none is not a known user-defined type
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeBootsSCRIPT.psc(14,16): cannot add a int to a none (cast missing or types unrelated)
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeBootsSCRIPT.psc(14,45): variable myGlovesSCRIPT is undefined
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeBootsSCRIPT.psc(14,60): none is not a known user-defined type
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeBootsSCRIPT.psc(14,43): cannot add a int to a none (cast missing or types unrelated)
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeChestSCRIPT.psc(13,46): variable myGlovesSCRIPT is undefined
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeChestSCRIPT.psc(13,61): none is not a known user-defined type
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\Exo_SpellbladeChestSCRIPT.psc(13,44): cannot add a int to a none (cast missing or types unrelated)
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\Exo_SpellbladeGlovesSCRIPT.psc(15,5): variable myBootsSCRIPT is undefined
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\Exo_SpellbladeGlovesSCRIPT.psc(15,19): none is not a known user-defined type
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\Exo_SpellbladeGlovesSCRIPT.psc(15,32): variable myChestSCRIPT is undefined
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\Exo_SpellbladeGlovesSCRIPT.psc(15,46): none is not a known user-defined type
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\Exo_SpellbladeGlovesSCRIPT.psc(15,30): cannot add a none to a none (cast missing or types unrelated)
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\Exo_SpellbladeGlovesSCRIPT.psc(15,57): cannot add a none to a int (cast missing or types unrelated)
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\Exo_SpellbladeGlovesSCRIPT.psc(15,71): cannot compare a none to a int (cast missing or types unrelated)
c:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\Exo_SpellbladeGlovesSCRIPT.psc(15,71): cannot relatively compare variables to None
No output generated for Exo_SpellbladeGlovesSCRIPT, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on Exo_SpellbladeGlovesSCRIPT


Conclusion:

I'm stumped, I'm still new at this, and ill be the first one to admit that there are a lot of balls in the air here. once I started linking the scripts the compiler started error checking all scripts at the same time, meaning I wont be able to successfully compile them until they are all correct.
So maybe there's a simple error I've overlooked in one of them, maybe im misunderstanding how to use public properties (compiler keeps calling it a variable, which I don't get)
Or maybe I'm just stupid.
Any help is appreciated greatly.
User avatar
Sophie Morrell
 
Posts: 3364
Joined: Sat Aug 12, 2006 11:13 am

Post » Mon Nov 19, 2012 6:06 am

The Scripts look like you changed over from Java. Many things are alike at Papyrus, however Properties are a difference here. They only need to be declared.
Int myBoots_SB = 0
Is completely wrong. Firts you would use myboots_SB.setvalue(0) for it, second and most of all you don't set a standardvalue, because you only need to declare the properties, and FILL them externaly in the property editor once the scripts is done.

Well most of the errors are for non-existent property types. The script-properties for example. Your script-properties say:
Exo_SpellbladeBootsSCRIPT Property myBoots_SCRIPT Auto

Which is wrong. YOu need to use

SCRIPT Property myBoots_SCRIPT Auto

and then set the script you want in it in the property window. Otherwise you tell the game it is not a Int or a Script but a Exo_SpellbladeBootsSCRIPT which Skyrim doesn't know as object-type



But you need 3 huge scripts to do something very simple. If you make a global variable and use it, you can use one and the same script for every variable.


This would give you the following advantages:
- Since all the scripts do the exact same you can simply make just this one script and attach it to all of your setitems
- Your scripts will be much shorter and much simpler. This will save space on the disk and make it much easier for you find errors
- It can be easily expanded upon in the future. If you want to add another 2 Setitems for another bonus you can simply have the if statement check for any value bigger or equal to 5, instead of having to constantly check 2 more Variables.

ALSO on a sidenote: setting the speedmult to 0 will make you unmovable. Since anything 0 times is 0. I am not sure if you need to set it to 1 to restore the original, or to 0.5 to half the multiplied value but 0 is definitely wrong.


As a example i made a script for you. You may use it if you want, if you actually release the mod though i would be glad if you gave me credits.

It should work seamlessly if you put exactely this script into all of your setitems.

In Papyrus you only declare that there will be a property. What the property contains is set in the property editor for each item seperately.

So for the SetCount Global Variable you put the same GlobalVariable in all setitemscripts. If you want several sets though you need to put a own GlobalVariable into the property for each set. So Set1 gets Variable1 into SetCount and Set2 gets Variable2 instead of Variable1

If you plan on expanidng the setbonus to do a additional thing at 5 Items for example then you will also need a own Casted property for each additional Bonus.

Scriptname a0Setbonus extends ObjectReferenceGlobalVariable Property SetCount  Auto   ; This keeps track of how many SetItems are equippedGlobalVariable Property Casted1  Auto  ; This keeps track of if the bonus was casted alreadyEvent OnEquip(Actor akActor)SetCount.setvalue(SetCount.getvalue() + 1 ) ; Increase the worn count by one.If SetCount.getvalue() >= 3	  ; Check if 3 Setitems are beeing worn  If Casted1.getvalue() == 0	  ; Makes sur ethe setbonus has not been casted already to prevent it from beeing used multiple times	akActor.SetActorValue("SpeedMult", 2)  ; SetBonus   Casted1.setvalue(1)	  ;Sets Casted to one so it counts as casted already  EndIfEndIfEndEventEvent OnUnEquip(Actor akActor)SetCount.SetValue(SetCount.getvalue() - 1)  ; Decrease the worn count by one.If SetCount.getvalue() < 3	  ; Checks if unequipping it drops your count under the required count(Should be same as OnEquip to prevent bugs)   akActor.SetActorValue("SpeedMult", 1)   ; Reverts the Bonus  Casted1.setvalue(0)	   ; Sets the bonus to uncastedEndIfEndEvent


I hope it helped you and feel free to ask again if you still need help.

Nice idea btw
User avatar
Milad Hajipour
 
Posts: 3482
Joined: Tue May 29, 2007 3:01 am

Post » Mon Nov 19, 2012 4:59 am

I think you might be better off using a Global Variable to keep track of how many pieces are equipped. It'll make things a lot simpler. Something like the following:

1. Create a new GlobalVariable from the object list. Call it "ExoArmorCount". Give it an initial value of 0
2. Attach the following script to all three pieces of armor, be sure to hit the auto button in the properties window so that the property in the script gets linked to the actual GlobalVariable
Spoiler
Scriptname Exo_ArmorSetSCRIPT extends ObjectReference;A Script trying to add set bonuses to three pieces of armor.GlobalVariable Property ExoArmorCount  autoEvent OnEquipped(Actor akActor)   ExoArmorCount.SetValue(ExoArmorCount.GetValue() + 1)   CheckCount()endEventEvent OnUnEqipped(Actor akActor)   ExoArmorCount.SetValue(ExoArmorCount.GetValue() - 1)   CheckCount()endEventFunction CheckCount(Actor akActor)   If (ExoArmorCount.GetValue() >= 3)      akActor.SetActorValue("SpeedMult", 2)   ElseIf (ExoArmorCount.GetValue() < 3)      akActor.SetActorValue("SpeedMult", 0)   EndIfEndFunction

The script was off the top of my head, im not able to test it for you as I'm not at home. If it doesn't compile, post the error. if it does, then I give it a test in-game. Good luck

EDIT: Ninja'd...too slow typing on my phone!

- Hypno
User avatar
Monika Fiolek
 
Posts: 3472
Joined: Tue Jun 20, 2006 6:57 pm

Post » Mon Nov 19, 2012 5:37 am

Hypnos way could work too. But my script is shorter and does pretty much the same. Also i compiled mine without any erros. I did not test it ingame though but it should work if you fill the properties properly.

With this i don't want to say that Hypnos script does not work or if it gives compiler errors. I did not test it in any way so i can't say anything.
User avatar
WTW
 
Posts: 3313
Joined: Wed May 30, 2007 7:48 pm

Post » Mon Nov 19, 2012 7:50 am

Ah there is such a thing as global variable, I had no idea. Obviously that is the way to go.

Thanks guys, ill make sure to give the appropriate mentions ofc.

-Exo

P.S. Randy19 wins a teddy bear for guessing my background in Java.
User avatar
stephanie eastwood
 
Posts: 3526
Joined: Thu Jun 08, 2006 1:25 pm

Post » Sun Nov 18, 2012 11:59 pm

hehe ^^

Knew it. Using Java myself and knew that way of initializing variables.

Anyway, hope you get your mod working. if you release it send me a PM. Would love to check it out!
User avatar
Blessed DIVA
 
Posts: 3408
Joined: Thu Jul 13, 2006 12:09 am

Post » Sun Nov 18, 2012 5:39 pm

After extensive testing I cant seem to get this to work.
Im using Randy19's Script, simplefied, as I removed the Casted1 property to try to find the error.

Scriptname Exo_SpellbladeGlobalSCRIPT extends ObjectReference  ;A Script trying to add set bonuses to three pieces of armor using a global variableGlobalVariable Property SetCount  Auto     			    ;This keeps track of how many SetItems are equippedEvent OnEquip(Actor akActor)	Debug.Notification("You feel your body surge!")	SetCount.setvalue(SetCount.getvalue() + 1 ) 		    ; Increase the worn count by one.		If SetCount.getvalue() >= 3      		    ; Check if 3 Setitems are beeing worn			Debug.Notification("You feel Faster!")   			akActor.SetActorValue("SpeedMult", 5)  	    ; SetBonus   		EndIfEndEventEvent OnUnEquip(Actor akActor)	SetCount.SetValue(SetCount.getvalue() - 1)  		    ; Decrease the worn count by one.		If SetCount.getvalue() < 3       		    ; Checks if unequipping it drops your count under the required count(Should be same as OnEquip to prevent bugs)	   		akActor.SetActorValue("SpeedMult", 1)       ; Reverts the Bonus		EndIfEndEvent

I pointed the GlobalVariable to my own, by copying and renaming an existing one, its variable type short with a value of 0.
As you can see ive added some debug.notifications at various places to see whats going on.
None of them are showing, I never gain the speedboost (even setting it at 5 as I now did).

Ive tried equipping each item in turn, shutting down the inventory menu between each one, but still nothing... no messages, no speed increase...

-Exo
User avatar
Kay O'Hara
 
Posts: 3366
Joined: Sun Jan 14, 2007 8:04 pm

Post » Mon Nov 19, 2012 1:02 am

If not even the first message is showing it must be something with the item itself. How did you attach it? Did you attach it to the object itself or do you apply it using a enchantment or something similar?

EDIT: I tested it myself. The script is not firing at all. The debugging messages are not activated, the global does not increase. The script itself looks fine. Maybe it is the event i am using. I will take a closer look.

EDIT2: Ok the script should be fine. The events are the right ones and if the script itself was wrong then it would trigger at least the debugnotification. The only thing i can assume is that for some reason it does not send a equipped event to the armor...

Maybe it would work better to make it a enchantment for the armor?

It is really late here now, but i will take a look into making it an echantment tomorrow. Although if anyone finds out why the script is not triggering that would be even better. The Script is fine, but for some reason it simply isn't triggered when the armor is equipped.
User avatar
Madeleine Rose Walsh
 
Posts: 3425
Joined: Wed Oct 04, 2006 2:07 am

Post » Sun Nov 18, 2012 5:36 pm

I'll have a look into it now.

I have a feeling the script is not seeing the new variable. you might need a quest script so you can use http://www.creationkit.com/UpdateCurrentInstanceGlobal_-_Quest

I'm going to make a quick test.esp, bare with me

- Hypno
User avatar
Life long Observer
 
Posts: 3476
Joined: Fri Sep 08, 2006 7:07 pm

Post » Mon Nov 19, 2012 7:35 am

OK, just tested this out and it works

Here's what i've set up

1. Deplicate 3 armour pieces and give them a unique id
2. Create a GlobalVariable called "TESTArmourCount" with an initial value of 0
3. Create a new quest called "TESTArmourBonusQuest"
4. Added the following script to the scripts tab of the quest window, and set the values in the properties button
Spoiler
Scriptname TESTArmourCountScript extends Quest  GlobalVariable Property TESTArmourCount  autoBool Property BonusAdded = False  autoFunction CountAdd()   UpdateCurrentInstanceGlobal(TESTArmourCount)   TESTArmourCount.SetValue(TESTArmourCount.GetValue() + 1)   debug.messagebox("Added to count")EndFunctionFunction CountSubtract()   UpdateCurrentInstanceGlobal(TESTArmourCount)   TESTArmourCount.SetValue(TESTArmourCount.GetValue() - 1)   debug.messagebox("Subtracted from count")EndFunctionFunction CheckCount(Actor akActor)   UpdateCurrentInstanceGlobal(TESTArmourCount)   If (TESTArmourCount.GetValue() >= 3)	  If (BonusAdded == False)		 ; insert bonus here		 debug.messagebox("Bonus should be added")		 BonusAdded = True	  EndIf   ElseIf (TESTArmourCount.GetValue() <= 2)	  If (BonusAdded == True)		 ; remove bonus here		 debug.messagebox("bonus should be removed")		 BonusAdded = False	  EndIf   EndIfEndFunction
5. Added the following script to each piece of armour, again not forgetting to set the values in the properties button
Spoiler
Scriptname TESTArmorBonusScript extends ObjectReference  TESTArmourCountScript Property ArmourCount  autoEvent OnEquipped(Actor akActor)   ArmourCount.CountAdd()   ArmourCount.CheckCount(akActor)endEventEvent OnUnEquipped(Actor akActor)   ArmourCount.CountSubtract()   ArmourCount.CheckCount(akActor)endEvent

Just add your bonus to the quest script and change the names to whatever you want

- Hypno
User avatar
jodie
 
Posts: 3494
Joined: Wed Jun 14, 2006 8:42 pm

Post » Mon Nov 19, 2012 7:40 am

So, you're not getting any message boxes?

Perhaps it's something weird with using a global variable; have you tried just using an integer property? Since the number is never touched outside of the quest, there isn't really any need for a global anymore (unless I missed something easy).

DE
User avatar
QuinDINGDONGcey
 
Posts: 3369
Joined: Mon Jul 23, 2007 4:11 pm

Post » Mon Nov 19, 2012 1:56 am

Sorry DireExigency, i posted my cry for help a bit too soon. Had one typo in the script sending everything off (i left out the "u" in OnEquipped :facepalm:). Edited my post above to reflect that i it worked.

Yeh you're probably right about using an integer property in the quest script rather then a globalVariable. So many routes to the same goal

- Hypno
User avatar
kitten maciver
 
Posts: 3472
Joined: Fri Jun 30, 2006 2:36 pm

Post » Mon Nov 19, 2012 2:40 am

Glad you got it working. You have to love those little typos.
User avatar
Chelsea Head
 
Posts: 3433
Joined: Thu Mar 08, 2007 6:38 am

Post » Sun Nov 18, 2012 9:00 pm

Jeez great work guys, way to go above and beyond. (Don't u hate it when something is SUPPOSED to work but just doesn't)
Let me get some breakfast in me and ill start testing, I've never touched Quest scripting so far so this'll be fun.
But would this still work for NPCs? Part of the idea is that the set bonuses would apply to Companions and mobs alike.

-Exo
User avatar
Nicola
 
Posts: 3365
Joined: Wed Jul 19, 2006 7:57 am

Post » Sun Nov 18, 2012 9:02 pm

I think it will. In the script I kept all the akActor mentions, so it should work out of the box. You may want to make your bonus a perk that gets added and removed with the script. That way you'll see something in the active effects list when the bonus is in effect

- Hypno
User avatar
Sophh
 
Posts: 3381
Joined: Tue Aug 08, 2006 11:58 pm

Post » Sun Nov 18, 2012 10:58 pm

I Don't get it!
[img]http://farm1.staticflickr.com/38/157390867_05cbf896a2_z.jpg[/img]

Ure Still using the OnEquip Event, the one that is not flagging.

So how did u make it work? I couldn't. tried ur script out and im still not getting the thing to flag.

But I found a solution, by moving the script over to MagicEffect instead.

Thanks guys.

-Exo
User avatar
Janette Segura
 
Posts: 3512
Joined: Wed Aug 22, 2007 12:36 am

Post » Mon Nov 19, 2012 6:21 am

I just noticed in the script you posted, you wrote "OnEquip()"...it's OnEquipped() . You missed out the "ped". Understandable, i was tearing my hair out for 10mins until I noticed I had "OnUneqipped"! I would've thought there would be an error during compiling :shrug:

I have no idea why the way I outlined didn't work for you, as in test.esp i made I had all the debug.message boxes popping up no matter how many times I equipped/unequipped

- Hypno
User avatar
Shaylee Shaw
 
Posts: 3457
Joined: Wed Feb 21, 2007 8:55 pm

Post » Sun Nov 18, 2012 6:11 pm

No Way!! Uve gotta be kidding me. Did I do that?

I must have made another mistake with ur code (since i copied and pasted).
But why did my code compile with the error?

Damn, let me look at this.

-Exo
User avatar
:)Colleenn
 
Posts: 3461
Joined: Thu Aug 31, 2006 9:03 am

Post » Sun Nov 18, 2012 10:09 pm

But why did my code compile with the error?

I've got no idea. I was asking the same question when I made a typo in the OnEquipped(). No compiler errors, so I had 10mins of scratching my head until I noticed it

- Hypno
User avatar
mimi_lys
 
Posts: 3514
Joined: Mon Apr 09, 2007 11:17 am


Return to V - Skyrim