Jump to content

[LE] Help with two scripts


Recommended Posts

Hello,

 

I made an animal follower. This actor has this script:

 

 

 

Scriptname HappySabreCatScript extends ObjectReference  

DialogueFollowerScript Property DialogueFollower Auto
GlobalVariable Property PlayerAnimalCount Auto
Message Property FollowerMessage Auto
;Actor property dog auto

auto state Waiting
event onActivate(objectReference AkActivator)
    ;if player does not have an animal, make this animal player's animal
    If PlayerAnimalCount.GetValueInt() == 0
        (DialogueFollower as DialogueFollowerScript).SetAnimal(self)
       FollowerMessage.show()
    EndIF
endEvent
endState

state done
endstate

 

 

 

 

My question is, how can I let this script only run, if a certain quest is completed?

 

 

Another question:

With "ModActorValue" you can alter teh health, for example. So you can rise it from 100/100 to 110/110. Can I do again and again?
I want to give my follower a little piece of dialogue, which rises his health, etc...

 

Which leads me to my last question: Is it possible that you can use this dialogue only once per day? Or, just have an effect only once per day?

Link to comment
Share on other sites

1. You're looking for: https://www.creationkit.com/index.php?title=IsCompleted_-_Quest

 

2. Yes quite right. If you have an idea of how to do what you want... then why not just try it? :)

 

3. There's an "Hours until reset" setting in your topic info window. Try setting it to 24.0, I think that would work. Otherwise ask, and I will help you script your way to the result.

Link to comment
Share on other sites

Hello!

 

:laugh:

 

Thank you for your help!

Bad news:
I tried just to ad

"if (HappySabreCatQuestProperty.IsCompleted())"

to the script i posted in my first post after "event...". Well, it just can not compile. Well, of course, i thought, it has no matchin property. Ok, make new property, it failed...

 

Ok, make it the other way. Made the property, it worked, even found the right quest itsself.

Then added the "if iscomplete..." again and compiled. Now it said

 

"mismatched input 'endEvent' expecting ENDIF"

:sad:

 

 

The other thing:

I just added

HappySabreCat.ModAV("Health", 100.0)

to the end script of the dialogue. Added also a 1 h timer as you said. Well it compiled with no complains.

 

So i tried it. but it did nothing and after i used the dialogue once it never came back up.

ok, back to creation kit, ad a property, was my first idea.

Made a property with type Actor.

But wenn i want to edit the value, it only let me choose it from the render window. Is this ok?

 

 

Edit: Wow...

Sorry for my bad English...
Feel free to read my post with an Russian or German accent in your mind, If this helps...

Edited by TheTetrahedron
Link to comment
Share on other sites

The error it gives you means that you're missing an "EndIf" in your script.

 

Remember to always make the appropiate properties and fill them, otherwise your script won't work.

 

So, yes... HappySabreCat needs to be an actor property before the script will compile, and you need to fill this property with the correct actor reference. But if HappySabreCat refers to the actor reference you're currently having a conversation with, then just use "akSpeaker" instead. This is a dialogue-specific keyword that refers to the actor you're talking to.

akSpeaker.ModAV("Health", 100.0)

By the way, if you're having trouble with understanding Skyrim scripting, be sure to check up on the official wiki tutorials.

Link to comment
Share on other sites

  • 3 weeks later...

Hello!

 

i am back after weeks...

 

Thanks again for your help.

 

Well, I experimented a little bit today and a miracle occured. :ohmy:

 

The timer for the dialogue worked, now it only shows up once a day. Also the "akSpeaker.ModAV" was the right hint, it works fine.

 

I even managed to get the Property on the actor working

 

My skript now looks like this:

 

 

Scriptname TatzeScript extends ObjectReference

DialogueFollowerScript Property DialogueFollower Auto
GlobalVariable Property PlayerAnimalCount Auto
Message Property FollowerMessage Auto
Quest Property HappySabreCatQuest Auto
;Actor property dog auto


if (HappySabreCatQuestProperty.IsCompleted())

auto state Waiting
event onActivate(objectReference AkActivator)
;if player does not have an animal, make this animal player's animal

if (HappySabreCatQuest.IsCompleted())
If PlayerAnimalCount.GetValueInt() == 0
(DialogueFollower as DialogueFollowerScript).SetAnimal(self)
FollowerMessage.show()
EndIF
endEvent
endState

state done
endstate

else

DamageAV("Health", 295.0)
DamageAV("SpeedMult", 99.0)

EndIf

 

 

 

Now it says EoF is missing...

 

Another question, what reference should i put before DamageAV? Actor?

Link to comment
Share on other sites

DamageActorValue needs to be called on an actor, or an objectreference/referencealias that is cast to actor. Furthermore, extra care should be taken with such a high damage value. If the player has 295 max health and they are at full health, this will kill them. It's also not very clear what you want to do with that script. You want the damage to occur when they try activating the thing and the quest is not completed?

Link to comment
Share on other sites

Hello,

 

after a little bit of try and error I created a working script:

 

 

 

 

Scriptname TatzeScript extends ObjectReference  

DialogueFollowerScript Property DialogueFollower Auto
GlobalVariable Property PlayerAnimalCount Auto
Message Property FollowerMessage Auto
Quest Property HappySabreCatQuest  Auto
Actor Property EncSabreCatFollower  Auto
;Actor property dog auto



auto state Waiting
event onActivate(objectReference AkActivator)
    ;if player does not have an animal, make this animal player's animal

if (GetStage.HappySabreCatQuest() < 30)
EncSabreCatFollower.DamageAV("Health", 295.0)
EncSabreCatFollower.DamageAV("SpeedMult", 99.0)
 
    ElseIf PlayerAnimalCount.GetValueInt() == 0
        (DialogueFollower as DialogueFollowerScript).SetAnimal(self)
       FollowerMessage.show()
    EndIF
endEvent
endState

state done
endstate

 

Well, now this works (More or less, one last problem, if you cancel the dialogue in the quest, you can not start it again, but well...).

 

I still have another idea, but I do not know if I should open another topic in the forum. A dialogue which only apears if the player has at least one of several objects in his inventory (meat for the cat :laugh:) and then removes one would be nice...

Edited by TheTetrahedron
Link to comment
Share on other sites

 

 

Well, now this works (More or less, one last problem, if you cancel the dialogue in the quest, you can not start it again, but well...).

 

I still have another idea, but I do not know if I should open another topic in the forum. A dialogue which only apears if the player has at least one of several objects in his inventory (meat for the cat :laugh:) and then removes one would be nice...

 

Make a formlist with the base forms of all the ingredient types you want to support (the meats). Then on the dialogue put a condition of GetItemCount >= 1 and for the item specify the form list. For run on choose the player. That will only show the dialogue topic if the player has at least 1 of any item in the form list.

 

Then for removing only 1 of any of the items the fragment would need to have an if tree checking each type. Or it could be a loop on the form list if you want it to be completely dynamic where you can change the list at will and have it fully supported without needing to update the topic info fragment. However for larger lists, probably > 100 entries, there will be a noticeable performance impact to loop such a list. Smaller lists like 10-15 entries will be pretty fast loops. And if written properly you would exit as soon as you find 1 item so statistically it would only have to search half the list on average.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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