Jump to content

jim555511

Members
  • Posts

    11
  • Joined

  • Last visited

Posts posted by jim555511

  1. Hi, thanks for the help. So I have a string of dialogue that occurs between the player and an NPC, I want it so that the NPC will make a punching animation and then the player will blackout after. I'm not sure if I would put this in the ending script fragment of the dialogue, and even then I don't know how I would add in the animation, or if I would put this in a reference alias attached to the actor and player, any help would be much appreciated
  2. Hi there, thanks for the help. So i have a message box, lets call it message box A. Message box A has a couple of different selections in it and when a certain selection is made a new message box appears which we'll call message box B. Now i have a back button in message box B but i'm not for sure how to script it, how can i get it so that when you select back on message box B you go back to message box A?

  3. Small example:

    Scriptname SampleMessageBox extends ObjectReference
     
    Message Property MyMessage Auto
    MiscObject Property Gold01 Auto
    Actor Property PlayerRef Auto
     
    Event OnActivate(akActionRef)
      If akActionRef == PlayerRef
        Int iButton = MyMessage.Show()
        If IButton == 0
          PlayerRef.AddItem(Gold01,100)
        Else
          Debug.Notification("Sorry, no gold for you!")
        EndIf
      EndIf
    EndEvent
    

    Player gets gold if they press the first button. Any other button, they do not get gold.

    Thank you so much, that's a lot of help

  4. First problem I see is you are missing a parameter. You're missing a bool for abBashAttack before blocked. Easiest thing is to copy the declaration line from the source file or copy from the wiki page https://www.creationkit.com/index.php?title=OnHit_-_ObjectReference. That way you don't miss things like that. Though the variable names will differ slightly from what you have written. Here's the lines from ObjectReference.psc for simple copying.

    Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
    EndEvent
    

    Rather than getting 2 actor values and doing the math yourself you could just use

    Float HealthPercent = myself.GetActorValuePercentage("health")
    

    That will return a float between 0 and 1 for the percentage. The event would then look like this

    Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
        Float HealthPercent = myself.GetActorValuePercentage("health")
         
        if HealthPercent < 0.5
            Magelight.Cast(myself,myself)
        endif
    EndEvent
    

    Something to keep in mind though, is that if the health ever went back up above 50% and then got hit again it would retrigger without any check if the spell is already active or any cooldown between casts. Maybe this is desired.

    Thank you so much, your help is greatly appreciated, makes me feel stupid that i was only missing one thing haha

  5. Hi there, thanks for the help.

    So i'm trying to create a script that will read the actors health each time they are hit and based off their health percent will cast mage light on them. I've almost got everything working but the only problem is the onhit function. Heres my script

    Scriptname SecondaryLeonardoScript extends Activemagiceffect
    Spell Property Magelight auto
    Actor myself
    event oneffectstart(actor aktarget,actor akcaster)
    myself = aktarget
    endevent
    Event onhit(ObjectReference aktarget, Form aksource,Projectile akprojectile,Bool abPowerAttack,Bool abSneakAttack,Bool abHitBloacked)
    Float Health = myself.GetActorValue("Health")
    Float BaseHealth = myself.GetBaseActorValue("Health")
    Float HealthPercent = (Health/BaseHealth) * 100
    if HealthPercent < 0.5
    Magelight.Cast(myself,myself)
    endif
    endevent
    It gives me a compiling issue and tells me that the onhit function doesn't match the parent script and i am out of ideas, please help :)
  6. Well, I never scripted anything on Skyrim, but I did on Oblivion, and I imagine that, dispite some superficial differences, they can not be that much different essentialy. So, regarding the parent script not being an object reference, I think you are supposed to create a reference variable. Name it the way you want, and then set it to a special type of value wich returns an specific instance of the game to the script. In Oblivion, this it GetSelf, so should be Set YourReference to GetSelf. This makes the script get whoever the script is applied on -the x enemy your attacking-; and then

     

    If YourReference.GetActorValue Health == 30 / <= 60 / etc. (this are examples)

    MageLightSpell.Cast (YourReference, YourReference)

     

    So, what we have is the next: you have a Reference Variable, named YourReference in my example. Once yo set the reference value to GetSelf (IMPORTANT: I think in Skyrim is not GetSelf, but just "Self"; I do not know, and you will have to find that out), the script will get whoever it is activated on (whoever you hit). Once he gets that, with the functions I transcribed, the script will check his health; put the value you want, but I do not know how to make it the 50% of the NPC health. You'll have to figure that out too. If the health matches the conditions of your If statement, the spell you want will be casted from him to himself, if you put the function as I've written.

     

    The functions I transcribed I took from here: https://www.creationkit.com/index.php?title=List_of_Papyrus_Functions#G

     

    Because I DO NOT KNOW Skyrim lenguage I only passed you the arquitecture of your script, how you should build it. But the GetSelf function, for example, I do not know how it is on Skyrim. I think I wrote the example scripts fine, 'cause I followed the syntax in the web I passed to you, but since I never wrote anything to Skyrim there might be a problem, so check them out just in case. Of course, this would have to begin OnHit, and attach the script to whatever NPC type you want it to work on (necromancer, for example).

     

    As I said, AND THIS IS IMPORTANT because I do not want you to take my functions literally and mess your script because of me: I think the GetSelf function has a different name in Skyrim lenguage, and I do not know if the other functions I passed to you are perfect, even when I followed the syntax on the web I shared with you, so that's on to you. I have passed to you, so to speak, the plan and diagram of your script; it's up to you to check if the construction materials are in shape and order.

     

    I'm sorry for the limitation of my assistance, but I did try to do my best not knowing much about Skyrim scripting.

    Thank you so much for the help. I'll begin looking into this later

  7. Hi there! Thank you for your help if you can

    So I'm a bit new to scripting and after i went through the tutorial i decided to start on my own but i seem to have hit a wall, I'm trying to create a script that will read the enemy's health on hit and if their health drops below 50% to cast mage light on them. Does anyone know how i might start this. I've tried using the on hit event but it tells me the parent script isn't an object reference

×
×
  • Create New...