Jump to content

[LE] Need some help creating a script


jim555511

Recommended Posts

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

Link to comment
Share on other sites

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.

Edited by PkSanTi
Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 4 weeks later...

i don't know if this is the right place to post this, ive been looking for help in creating a script that will allow me to turn an upper shelf into a black book display. ive been looking for how to create this item for ages now, ive spent the past week looking to try and find out how to write a script. every source ive seen has gone over my head. ive tried a few video tutorials, but I just couldn't grasp it. most of the videos worked on other areas. I even tried the creation kit page. but I just cant get my head around it. if someone could help me with this script or point me in the direction of a clear tutorial on the subject of scripting id appreciate it. ive managed to find scripts I need for the claw display and for gravestones with the kind help of other modders. this is my first mod and ive been working on it for about 6-8 weeks.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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