Jump to content

[LE] Quick Questions, Quick Answers


Recommended Posts

Ok, LegallyBlindGamer727, a couple of things;

 

- weapons don't need to be skinned, so remove all that

- weapons need to be positioned in a certain spot so that the character can hold it properly, check a vanilla sword for placement and try to align your sword to it

- weapons require collision, BSX Flags and a NiStringExtraData line to tell the game it's a weapon, again, check how a vanilla sword is set up

Link to comment
Share on other sites

Ok, LegallyBlindGamer727, a couple of things;

 

- weapons don't need to be skinned, so remove all that

- weapons need to be positioned in a certain spot so that the character can hold it properly, check a vanilla sword for placement and try to align your sword to it

- weapons require collision, BSX Flags and a NiStringExtraData line to tell the game it's a weapon, again, check how a vanilla sword is set up

Got it. I tired looking into a couple tutorials but that was more like swapping weapons or textures than custom models. I'll see what I can do.

 

Edit: Tried using the IronClaymore as base to copy from, but now when I go to enter the new nif into the CK it keeps crashing.

 

Edit 2: Ok, I eventually figured it out. Not sure what I did but I just redid the process again and it seems to kind of work. It can at least load in game.

Link to comment
Share on other sites

  • 1 month later...

Ok, sorry but I've tried doing different things and none seem to be working here. I want the Relationship Points when you give a gift to go up by the amount of the item you give. Like just giving one beer gives +5 but giving three beers gives +15. I think I've got that working, but when I go to test it I'm not seeing any changes. And trying to put negative values was difficult since it doesn't like the "-" operator. But honestly, the biggest issue I'm having is the Relationship Rank not going up when you hit a point threshold, which is a different script. If i would get that going this character would more or less be done.

criptname Dan_RelationshipScript extends Quest

GlobalVariable Property Dan_RelPoints Auto
GlobalVariable Property Dan_RelRank Auto
GlobalVariable Property Dan_CanFollower Auto
GlobalVariable Property Dan_CanHire Auto
GlobalVariable Property Dan_CanCourt Auto
Int Property MaxPoints = 1000 Auto ;default max relationship points
Int Property PointStep = 50 Auto ;default step to advance relationship
Int PointTest = 0 

Function Dan_RelTrack()
  Int RelPoints = Dan_RelPoints.GetValueInt()
  Int RelRank = Dan_RelRank.GetValueInt()

  While (RelPoints < MaxPoints) && (RelPoints > PointTest)
    If RelPoints > (PointTest + PointStep)
      Dan_RelRank.Mod(1) ;increases value by 1
	RelPoints = 0
    EndIf
  EndWhile
EndFunction

Function Dan_RelStatus()

Int RelRank = Dan_RelRank.GetValueInt()

	if RelRank >=1
	Dan_CanHire.Mod(1)
	Endif
	if RelRank >=2
	Dan_CanFollower.Mod(1)
	Endif
	if RelRank >= 4
	Dan_CanCourt.Mod(1)
	Endif
EndFunction

 

Scriptname TestGiftSystemAliasScript extends ReferenceAlias  

FormList Property Dan_LikedGifts Auto
FormList Property Dan_LovedGifts Auto
FormList Property Dan_DislikedGifts Auto
FormList Property Dan_HatedGifts Auto
GlobalVariable Property Dan_GiftLike Auto
GlobalVariable Property Dan_GiftLove auto
GlobalVariable Property Dan_GiftDislike Auto
Globalvariable Property Dan_GiftHate auto
GlobalVariable Property Dan_GiftStatus Auto
GlobalVariable Property Dan_RelPoints Auto
Scene  Property Dan_GiftStartQuestLike Auto
Scene  Property Dan_GiftStartQuestLove Auto
Scene  Property Dan_GiftStartQuestDisLike Auto
Scene  Property Dan_GiftStartQuestHate Auto

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
  If akSourceContainer == Game.GetPlayer() ; is it the player adding the item
    If (Dan_LikedGifts.HasForm(akBaseItem)) && (Dan_GiftStatus.GetValue() != 0)
      Self.GetReference().RemoveItem(akBaseItem,aiItemCount)
	Dan_GiftLike.SetValue(1)
	Dan_RelPoints.SetValueInt(Dan_RelPoints.GetValueInt()*(aiItemCount)+1) 
	Dan_GiftStartQuestLike.Start()
    EndIf
   If (Dan_LovedGifts.HasForm(akBaseItem)) && (Dan_GiftStatus.GetValue() != 0)
      Self.GetReference().RemoveItem(akBaseItem,aiItemCount)
	Dan_GiftLove.SetValue(1)
	Dan_RelPoints.SetValueInt(Dan_RelPoints.GetValueInt()*(aiItemCount)+2)
	Dan_GiftStartQuestLove.Start()
    EndIf
   If (Dan_DislikedGifts.HasForm(akBaseItem)) && (Dan_GiftStatus.GetValue() != 0)
      Self.GetReference().RemoveItem(akBaseItem,aiItemCount)
	Dan_GiftDislike.SetValue(1)
	Dan_RelPoints.SetValueInt(Dan_RelPoints.GetValueInt()*(aiItemCount)*(-1))
	Dan_GiftStartQuestDisLike.Start()
    EndIf
   If (Dan_HatedGifts.HasForm(akBaseItem)) && (Dan_GiftStatus.GetValue() != 0)
      Self.GetReference().RemoveItem(akBaseItem,aiItemCount)
	Dan_GiftHate.SetValue(1)
	Dan_RelPoints.SetValueInt(Dan_RelPoints.GetValueInt()*(aiItemCount)*(-2))
	Dan_GiftStartQuestHate.Start()
    EndIf
   EndIf
EndEvent

 

Link to comment
Share on other sites

I never had luck getting the value of a global variable while inside the function to set the same global variable. I would recommend splitting that up.

 

From:

Dan_RelPoints.SetValueInt(Dan_RelPoints.GetValueInt()*(aiItemCount)+1)

To:

Int CurrentValue = Dan_RelPoints.GetValueInt()
Dan_RelPoints.SetValueInt(CurrentValue * (aiItemCount)+1) 

Now I am a little concerned about the numbers being added and subtracted. I do not think the math will go the way that you want.

Let us say that the aiItemCount is equal to 2. And the current value of Dan_RelPoints is 1.

Like = 1 * (2) + 1 = 3

Love = 1 * (2) + 2 = 4

Dislike = 1 * (2) * (-1) = -2

Hate = 1 * (2) * (-2) = -4

With aiItemCount equal to 5 instead

Like = 1 * (5) + 1 = 6

Love = 1 * (5) + 2 = 7

Dislike = 1 * (5) * (-1) = -5

Hate = 1 * (5) * (-2) = -10

 

And when Dan_RelPoints is at 2 and aiItemCount at 2

Like = 2 * (2) + 1 = 5

Love = 2 * (2) + 2 = 6

Dislike = 2 * (2) * (-1) = -4

Hate = 2 * (2) * (-2) = -8

With aiItemCount equal to 5

Like = 2 * (5) + 1 = 11

Love = 2 * (5) + 2 = 12

Dislike = 2 * (5) * (-1) = -10

Hate = 2 * (5) * (-2) = -20

 

In any event, when do you call the functions on the posted quest script? These functions won't run themselves. If they do not get called, the relationship rank will not update at all.

Link to comment
Share on other sites

Ah, that explains it. I had thought they were like regular scripts and put them in the scripts for the gift quest. If I have to call them, I assume it would be after the dialogue that is initiated after the gift is given or possibly during the scene.

 

https://www.creationkit.com/index.php?title=Function_Reference#Examples

Calling them during the dialog would make sense. You may need to know the following information: Accessing functions from other scripts

Link to comment
Share on other sites

 

Ah, that explains it. I had thought they were like regular scripts and put them in the scripts for the gift quest. If I have to call them, I assume it would be after the dialogue that is initiated after the gift is given or possibly during the scene.

 

https://www.creationkit.com/index.php?title=Function_Reference#Examples

Calling them during the dialog would make sense. You may need to know the following information: Accessing functions from other scripts

Yep, that's where i've been looking but the examples are confusing to my small brain lol. I'm assuming I can do that in the papyrus fragment window in the dialogue screen. I'm thinking this example is the one I'd want to use since the script should be updating based on what actions the player is doing with the follower.

Find an Actor's linked reference, and conditionally access the script functions on that reference:

ObjectReference possibleTable1 = Actor1.GetLinkedRef()
if (possibleTable1 as Furniture) == magicTable                         ;is the actor linked to a magicTable?
  magicTableScript TableScript1 = possibleTable1 as magicTableScript
  TableScript1.explode()                                               ;if so, use the magicTable's script function to make the magicTable explode!
endif

I'm looking at https://www.creationkit.com/index.php?title=ObjectReference.GetLinkedRef_(Papyrus) as well since this example uses that. So making a quick test idea I think this is what I have to do?

ObjectReference DanTest = Dan.GetLinkedRef() ;the refalias in quest
if (DanTest as Actor) == Dan1 ;whatever i guess its setting the variable?
  Dan_RelationshipScript DanScript1 = DanTest as Dan_RelationshipScript ;no idea what this does;where it's confusing me
DanScript1.Dan_RelTrack()
EndIf
                                            

 

 

Link to comment
Share on other sites

Fragments on quest records should have a 'kmyquest' drop down. If the fragment you are working on does have this, then you can do the following:

Dan_RelationshipScript varName = kmyquest as Dan_RelationshipScript  
  ; the right side casts the quest object into the script stored on the quest then shoves it into the variable declared as the script on the left side
varName.Dan_RelTrack()
  ; go run the function on the script previously associated with the leading variable

If the fragment does not have such a drop down, you can use GetFormFromFile instead

Dan_RelationshipScript varName = (Game.GetFormFromFile(0x00123456, "myMod.esp") as Quest) as Dan_RelationshipScript
  ; the right side gets the form with the given FormID in hex format from the passed in plugin
  ; casts it into the specific record type and then casts into the attached script.
  ; finally shoves that into the variable declared as the script on the left side
varName.Dan_RelTrack()
  ; go run the function on the script previously associated with the leading variable

The other stuff in the example on the wiki is necessary to make that specific example work. Not all usage must follow that particular pattern. The above two options demonstrate the bare minimum needed.

 

Note, if using GetFormFromFile, the load order position digits are always 00.

Link to comment
Share on other sites

  • 9 months later...

The script below works... 


-------------------------------------------------------

Scriptname aaaTimerScript extends Quest

Float Property DelayHours Auto
GlobalVariable Property aaaTimerGlobal Auto
Message Property aaaTimerMessage Auto

function OnInIt()

If Self.IsRunning()

self.RegisterForSingleUpdateGameTime(DelayHours)

EndIf

EndFunction

Function OnUpdateGameTime()

If aaaTimerGlobal.GetValue() == 1
aaaTimerGlobal.SetValue(2)

aaaTimerMessage.Show()

EndFunction

 

---------------------------------------------------------------------------------------

 

Problem is, it only works once.

The way this quest runs, it's supposed to be repeatable. The timer script triggers a message which shows after 8 hours, and the Timer global does move to 2. And then as dialog commences (my gal takes an NPC somewhere) the TimerGlobal returns to 1 eventually.  

All of that worked once, but I want to be able to repeat the use of this timer indefinitely. I have a feeling it's the first block of text (the self..Register... etc.) which needs to be changed. 

 

----------------------------------------

Edited by xenaclone
Link to comment
Share on other sites

You need to re-register for a single update timer possibly at the same point as resetting the TimerGlobal value back to one.  Where and when you re-register depends on your mod and its needs. You may also need to remotely call a function on your quest script that will do the re-registration.

You do not want to use a continuous update timer as these can get baked into the save file and cause issues should the mod / script be changed or removed.  Always use the single updates with a repeat registration when necessary.

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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