Jump to content

xcafe

Members
  • Posts

    113
  • Joined

  • Last visited

Everything posted by xcafe

  1. Thank you! But aren't form lists persistent? If I make a new save game I don't want to equip the spellbook item and have all the other character's spells added. And since the array I'm using is an auto property, I think I can access it from another script, right? using the "[scriptref] property [propertyname] auto" format?
  2. https://forums.nexusmods.com/index.php?/topic/5095555-add-spells-from-array/ This here :D
  3. So I'm trying to make a mod that stores the player's spells in a spellbook. In theory, it would add all the spells to the player when the player equips it, and I've got a script set up that adds the spells the player learns to an array. Is there a way to have a script run through the array and add all the spells in it to the player? Please and thank you :D
  4. Awesome, thank you! D'you think that you could help me with one more thing? (I'm new to scripting :laugh: )
  5. Well in that case: Scriptname SpellTomeReadScript extends ObjectReference {Teaches Spell to player through use.} Spell Property SpellLearned Auto string Property School Auto string Property LearnSpell Auto int Property difficulty = 0 Auto Spell[] Property SpellsToAdd Auto float percentageLearned = 0.0 float modifier = 1.0 int flatgain = 10 Location Property WinterholdCollegeLocation auto Location Property WinterholdCollegeArcanaeumLocation auto Event OnEquipped(Actor reader) ;Check if player is in the College of Winterhold if (Game.GetPlayer().IsInLocation(WinterholdCollegeLocation)) flatgain += 10 endIf ;Check if player is in the Arcanaeum if (Game.GetPlayer().IsInLocation(WinterholdCollegeArcanaeumLocation)) flatgain += 5 endIf modifier += (Game.getPlayer().getAV(School) - difficulty)/100 ;Check if player knows the spell if (Game.GetPlayer().HasSpell(SpellLearned)) Debug.Notification("You already know this spell.") else percentageLearned += flatgain * modifier GoToState("Learning") endIf EndEvent State Learning Event OnBeginState() ;If spell has reached 100% learned, add spell to player if (percentageLearned >= 100) bool function ArrayAddForm() Debug.Notification("You have learned" + LearnSpell + ".") else Debug.Notification("You have learned " + percentageLearned as int + "% of " + LearnSpell + ".") endIf ;Wait an hour before allowing further study Utility.WaitGameTime(1) Debug.Notification("You feel as though your mind is ready to study " + LearnSpell + " again.") flatgain = 10 modifier = 1.0 GoToState("Done") EndEvent Event OnEquipped(Actor reader) Debug.Notification("Your mind cannot focus. Wait a while before studying this spell again.") EndEvent EndState bool function ArrayAddForm(Form[] SpellsToAdd, Form SpellLearned) int i = 0 debug.notification("SpellsToAdd.Length = " + SpellsToAdd.Length) while i < SpellsToAdd.Length if SpellsToAdd[i] == none SpellsToAdd[i] = SpellLearned debug.notification("Adding " + SpellLearned + " to the array.") return true else i += 1 endif endWhile return false endFunction Here's the whole thing!
  6. When I do that, it gives me all these errors: C:\Program Files (x86)\Steam\steamapps\common\Skyrim\Data\scripts\source\spelltomereadscript.psc(46,10): no viable alternative at input 'bool'C:\Program Files (x86)\Steam\steamapps\common\Skyrim\Data\scripts\source\spelltomereadscript.psc(46,10): no viable alternative at input 'bool'C:\Program Files (x86)\Steam\steamapps\common\Skyrim\Data\scripts\source\spelltomereadscript.psc(48,8): mismatched input 'else' expecting ENDEVENTC:\Program Files (x86)\Steam\steamapps\common\Skyrim\Data\scripts\source\spelltomereadscript.psc(49,17): mismatched input '.' expecting LPARENC:\Program Files (x86)\Steam\steamapps\common\Skyrim\Data\scripts\source\spelltomereadscript.psc(0,0): error while attempting to read script spelltomereadscript: Object reference not set to an instance of an object.:(
  7. So I've defined a custom function as: bool function ArrayAddForm(Form[] SpellsToAdd, Form SpellLearned) int i = 0 debug.notification("SpellsToAdd.Length = " + SpellsToAdd.Length) while i < SpellsToAdd.Length if SpellsToAdd[i] == none SpellsToAdd[i] = SpellLearned debug.notification("Adding " + SpellLearned + " to the array.") return true else i += 1 endif endWhile return false endFunction But I don't know how to call it! Supposedly you're supposed to call it with the function name and then the variables, but when I try and call it like this: ArrayAddForm(Spellstoadd, spelllearned) It gives me this error: "spelltomereadscript.psc(46,10): type mismatch on parameter 1 (did you forget a cast?)" Please help, I don't know how to fix this :confused:
  8. So I'm pretty competent at writing scripts for Papyrus, but I need to do something that I have absolutely no idea how to do! So I was wondering if there's a way to run a script if an item with a certain keyword is activated. (In this case, spell tomes.) Any help would be appreciated! :D
  9. Duly noted on the shortening stuff, I'll have to go back and change that! Also, the "losing progress" thing was intentional, as I needed a con to balance out the ring. Would've been kind of overpowered IMHO if I didn't put in some drawbacks! :tongue: By the way if you're interested, the mod is up at http://www.nexusmods.com/skyrim/mods/74984/?tab=1&navtag=http%3A%2F%2Fwww.nexusmods.com%2Fskyrim%2Fajax%2Fmoddescription%2F%3Fid%3D74984%26preview%3D&pUp=1 Now I just have to work on making the quest, dungeon, and npcs I'll need to actually finish the mod I want to include the ring in...all of which I've never done before. RIP my vacation time.
  10. The script is attached to a ring in the game, I believe all the float properties should be set equal to the actor values after this: DestructionSkill = Game.GetPlayer().GetActorValue("Destruction") AlterationSkill = Game.GetPlayer().GetActorValue("Alteration") ConjurationSkill = Game.GetPlayer().GetActorValue("Conjuration") IllusionSkill = Game.GetPlayer().GetActorValue("Illusion") RestorationSkill = Game.GetPlayer().GetActorValue("Restoration") THSkill = Game.GetPlayer().GetActorValue("TwoHanded") LASkill = Game.GetPlayer().GetActorValue("LightArmor") HASkill = Game.GetPlayer().GetActorValue("HeavyArmor") BlockSkill = Game.GetPlayer().GetActorValue("Block") If the creation kit wiki is anything to go by. Also, I have no idea whether or not the NSL is being filled correctly, how would I go about checking that? And I'm about to boot up the CK to try out your script NexusComa, thanks for writing that up! :D Edit: Tried out your scrip NexusComa, and the same nothing happened as when I tried mine. I'm going to try again in a clean game (e.g. no mods) and see if that helps. Edit Part Two: Tried out both NexusComa's script and my own on a clean save, both worked perfectly. Now all I have to do is figure out which out of my 200+ mods is causing the problem X_X
  11. Trying to make a mod that : A. Changes your two-handed, heavy armor, block, and light armor skills to match the level of your highest level magic skill B. Changes all your magic skills to 0 (yes, I do mean 0, not 15) C. Changes all of your stats back when you unequip the ring that I have the script attached to. I've got a (really long) script written for it, but for some reason it isn't working. It doesn't bring up any compiler errors, but when I get in the game, it just doesn't do anything at all. I'd appreciate some assistance!
×
×
  • Create New...