Jump to content

Please help with quest script!


elseagoat

Recommended Posts

Ok, so I have two problems. The first one is this:

 

I have created a new perk, and put it in my tree, getting rid of the five "X spells cost half magicka" perks. I now want to make it so that once the player takes this single perk I made, the player will automatically gain each of the five half magicka perks when they reach the appropriate skill level.

 

So I made my perk, which basically has no perk entries. Then I made a quest. The quest has no name, priority 0, type "none." Originally I tried Start Game Enabled, but that didn't work, because I wanted to do this check every time the player gained skill to add the appropriate magicka cost reduction perk, so say the player reaches skill level 50 in Conjuration, the moment he skills up, he gets the "Adept Conjuration" perk automatically added. So when I tried Event OnStoryIncreaseSkill() it never got the event, because apparently that event only happens when the quest is started as a result of a skillup. Which seems really dumb to me, why not just use OnInit() if you want to do stuff when the quest starts...

 

But anyways, I changed the event from none (greying out Start Game Enabled) to Skill Increase. Then I attached this script to the quest:

 

Scriptname ESG_AdvSkillMagic extends Quest  

String Property SchoolOfMagic Auto
Perk Property MagickaPerk1 Auto
Perk Property MagickaPerk2 Auto
Perk Property MagickaPerk3 Auto
Perk Property MagickaPerk4 Auto
Perk Property MagickaPerk5 Auto


Event OnStoryIncreaseSkill(string asSkill)
Debug.Notification("Player just increased the " + asSkill+ " skill")
If (asSkill == SchoolOfMagic)
	int SkillLevel = Game.Getplayer().GetAV("Conjuration") as int
	If (SkillLevel >= 25 && Game.GetPlayer().HasPerk(MagickaPerk1) && Game.GetPlayer().HasPerk(MagickaPerk2) == false)
		Game.GetPlayer().AddPerk(MagickaPerk2)
	EndIf
	If (SkillLevel >= 50 && Game.GetPlayer().HasPerk(MagickaPerk3) == false)
		Game.GetPlayer().AddPerk(MagickaPerk3)
	EndIf
	If (SkillLevel >= 75 && Game.GetPlayer().HasPerk(MagickaPerk4) == false)
		Game.GetPlayer().AddPerk(MagickaPerk4)
	EndIf
	If (SkillLevel >= 100 && Game.GetPlayer().HasPerk(MagickaPerk5) == false)
		Game.GetPlayer().AddPerk(MagickaPerk5)
	EndIf
EndIf
endEvent

 

Now, here are my questions:

 

1) Am I doing this right? Or is there a better way to do what I have described?

 

2) Do I need to do anything with fragments in the quest stages tab? (Anyone that could elaborate on what the hell a fragment is and kmyQuest and how to use them please do).

 

3) How would I make it so that if a player is say, level 34 conjuration, and all the sudden they decide they want to put some perks in the tree, and they pick up the perk that is referenced as a property MagickaPerk1, how would I make this quest script immediately give them MagickaPerk2 instead of making them wait for their next skill up for the script to run?

 

4) How do I make this quest start each time the player skills up, and then stop, and be able to be started again on the next skill up?

 

 

 

 

 

Now, onto my second set of questions regarding a completely different scenario.

 

I have a magic effect with a script attached, and this effect needs to get the actor reference that is the target, pass it to a quest script that is always running to store it when the effect starts, and then I need to retrieve that actor reference from the quest script in a separate magic effect with a different script.

 

Essentially, I am making a spell that when cast, buffs your reanimated minion if you have one. But I don't want to have to aim it at the minion, I just want it to cast it immediately on the minion no matter where I am looking, assuming I have an undead minion.

 

So this is how I have it set up.

 

This is the first spell which gets the actor reference:

Scriptname ESG_SaveActorToQuest extends activemagiceffect

Event OnEffectStart(Actor akTarget, Actor akCaster)
   ESG_MyQuestScript.StoreActor(akTarget)
EndEvent

 

This is the script in the quest that runs all the time:

Scriptname ESG_ConjurationInstall extends Quest  

Actor AberrationStoredActor

Function AberrationStoreActor(Actor NewActor)
AberrationStoredActor = NewActor
EndFunction

Actor Function AberrationRetrieveActor()
Return AberrationStoredActor
EndFunction

 

This is the second spell which retrieves the actor reference:

Scriptname ESG_GetActorAndCastAtIt extends activemagiceffect

Spell Property BuffAbility Auto

Actor ActorToCastAt

Event OnEffectStart(Actor akTarget, Actor akCaster)
   ActorToCastAt = ESG_MyQuestScript.RetrieveActor()
If ((ActorToCastAt as ObjectReference).GetCurrentLocation() == Game.GetPlayer().GetCurrentLocation() && ActorToCastAt.IsDead() == false)
	ActorToCastAt.AddSpell(BuffAbility)
EndIf
EndEvent

 

 

So what am I doing wrong here? I need to be able to update the actor reference stored in the quest script any time I hit a new target with the first spell, and then I need to, at any time after that, be able to get that actor reference into a script on a second spell. These scripts I posted are obviously wrong, how do I do the casting for something like this?

 

 

Any help is MUCH appreciated.

Link to comment
Share on other sites

For your first set of questions, before answering, I suggest an alternate approach. Since you've taken them out of the tree and decided to merge the casting cost reduction perks into one, I assume that you've marked them as 'Hidden'. If that's the case, you don't have a problem with changing the perk entries a little bit, right?

 

Since I don't know what you're calling your new perk, I'll just use the name 'ConjurationMastery'. The conditions for the old perks (eg GetBaseActorValue and HasPerk) only controls when you can learn it when you go to the skill menu, so you can ignore them. You should click on the perk entry (Mod Spell Cost) and give some conditions to 'Perk Owner'. The conditions should be 'GetBaseActorValue >= (whatever level it should be)' and 'HasPerk ConjurationMastery'.

 

So you just add these 4 perks to the player right away, and they would only start working once the player unlocks the perk 'ConjurationMastery' and has the appropriate skill level. No need for quests at all!

 

In answer to your questions:

 

1. You're missing some conditions in your script (check if the player has the new perk), and I would have written it differently, but I think it would otherwise be fine. You did add your quest to the 'Skill Increase' event node in the story manager, right? See above for an alternate method.

 

2. You don't need to use the quest stage fragments at all. A fragment is a small piece of papyrus script. I don't think they have any native functions. 'kmyQuest' can be set for each quest stage. The choices are the scripts on the quest. It's basically a shortcut to access the script from the fragment by just using 'kmyQuest' instead of something like '(GetOwningQuest() as MyQuestScript)'.

 

3. Only way I can think of is to have a script occasionally check to see whether or not the player has your new perk.

 

4. Please read up on the Story Manager.

 

 

For your second set of questions, I think I already answered them on the bethsoft forums. (RandomNoob)

Link to comment
Share on other sites

For your first set of questions, before answering, I suggest an alternate approach. Since you've taken them out of the tree and decided to merge the casting cost reduction perks into one, I assume that you've marked them as 'Hidden'. If that's the case, you don't have a problem with changing the perk entries a little bit, right?

 

Since I don't know what you're calling your new perk, I'll just use the name 'ConjurationMastery'. The conditions for the old perks (eg GetBaseActorValue and HasPerk) only controls when you can learn it when you go to the skill menu, so you can ignore them. You should click on the perk entry (Mod Spell Cost) and give some conditions to 'Perk Owner'. The conditions should be 'GetBaseActorValue >= (whatever level it should be)' and 'HasPerk ConjurationMastery'.

 

So you just add these 4 perks to the player right away, and they would only start working once the player unlocks the perk 'ConjurationMastery' and has the appropriate skill level. No need for quests at all!

 

Thanks for the reply! Now, just to understand what you are saying, is that I should give the player the perks right off the bat so they always have them, then just have two conditions for the perk entry itself, one being that they are at or above a certain skill level and the other that they have the ConjurationMastery perk? Sounds like it should work. Will those conditions run all the time or just once? Guess I will find out.

 

1. You're missing some conditions in your script (check if the player has the new perk), and I would have written it differently, but I think it would otherwise be fine. You did add your quest to the 'Skill Increase' event node in the story manager, right? See above for an alternate method.

 

Will adding the quest to the event node create compatibility issues with other mods that also add quests to this event node? Also, I am not quite sure how to do this or what you mean, and it raises new questions if you are saying that I have to go into the event node itself (from the object window) and add the quest. Also, does that mean I could add a quest that starts on game load (instead of an event) to one of these nodes and thus receive events such as StoryOnSkillIncrease() every time it happens (even though on the wiki it says only when the quest is started via the event)?

 

 

 

 

Thank you for answering my questions. However, I tried what you suggested for my second set of questions and could not get it to work. I can't seem to get the casting right.

Edited by elseagoat
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...