Jump to content

I need your help for my script.


Nikitaa

Recommended Posts

Hi, I need your help to create a script; I have no knowledges about papyrys or program

 

To be simple I will use "BlackKey" (object) and Athos (NPC)

 

I want when the player get a blackkey in the inventory, Athos appears next to the player

 

May we must use "GetItemCount" and "Placeatme" function.

 

Please help me

 

Thank you in advance <3

Edited by Nikitaa
Link to comment
Share on other sites

Ok, not the greatest at scripts but I think I can handle this one...

 

What I would do is this:

 

Use quest stages to control this..

 

On the key, place a defaultsetstageonplayeraquireitem, get it to set the required stage in the property window.

 

Then on the stage set (on the quest)

 

Create a property for the actor or a reference alias and use the moveto rather than placeatme. For example YourActor.Moveto (Game.GetPlayer()) or YourActor.GetRef() .MoveTo(Game.Getplayer()) However, this may cause collision problems, so your might need to do a little more reading

 

http://forums.nexusmods.com/index.php?/topic/1172539-trying-to-teleport-an-npc-to-the-player-with-a-script/

And

http://forums.nexusmods.com/index.php?/topic/1045155-scripting-help-moving-npc-to-player-after-sleep/

 

Hope this helps

Link to comment
Share on other sites

Thank you for the answer but you speak as Chinese for me :smile:

 

indeed the actor as no reference ( he is not in the game, not the map)

 

And what kind of Event I have to use ? (the script is not a spell)

 

 

 

Scriptname Test extends Quest
* what line to use for a NPC ?* auto
MiscObject Property BlackKey auto
Event oninit() *problem here, what to use, not a spell*
if (Game.GetPlayer().GetItemCount(BlackKey) >= 1)
*what I should add to teleport the npc to the player ?*
endif
EndEvent
Edited by Nikitaa
Link to comment
Share on other sites

Ah, okay.

 

The example I gave is not for a standalone script, but rather for a script generated via the

quest stage section of the quest.

 

I just wanted you to read the other posts to gain a wider understanding.

 

I thoroughly recommend watching all of these tutorials: http://m.youtube.com/watch?v=Qfcet5hf5bs

 

I could give you a step by step account of how to do what you need, but the video series explains it so much better.

 

Once you understand the concept, all you need to do is use script to move an xmarker to you and then spawn (enable) your npc. Trust me, watch the video series, it will begin to make sense.

Link to comment
Share on other sites

Create a script on your BlackKey. You can do this by opening BlackKey object in the CK, pressing Add in the far right corner, pressing [New Script] and giving a name.

 

In the below script, replace the word AFTER scriptname with the name you just gave in the window that popped up after [New Script]. But basically, open the script and paste in this (changing the scriptname to fit yours):

 

Scriptname SpawnAthosAtPlayer Extends ObjectReference

Actor Property Athos Auto

Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)

     If akNewContainer == Game.GetPlayer()

          Game.GetPlayer().PlaceAtMe(Athos)

    EndIf

EndEvent
Now compile the script (Ctrl + S on Windows, within the CK editor). Then, press the Properties button, underneath the Add button you used to create the script. Select the Athos property, and from the dropdown on the right hand side, choose your Athos. You may need to select what cell he is in - if you have to, find the cell Athos (the actor) is in, in the CK, and then select Athos from the bottom dropdown. If you can't find him anywhere, try the (any) cell and search for him.

 

Once you've selected that press OK.

 

No quests or anything required.

Link to comment
Share on other sites

Create a script on your BlackKey. You can do this by opening BlackKey object in the CK, pressing Add in the far right corner, pressing [New Script] and giving a name.

 

In the below script, replace the word AFTER scriptname with the name you just gave in the window that popped up after [New Script]. But basically, open the script and paste in this (changing the scriptname to fit yours):

 

Scriptname SpawnAthosAtPlayer Extends ObjectReference

Actor Property Athos Auto

Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)

     If akNewContainer == Game.GetPlayer()

          Game.GetPlayer().PlaceAtMe(Athos)

    EndIf

EndEvent
Now compile the script (Ctrl + S on Windows, within the CK editor). Then, press the Properties button, underneath the Add button you used to create the script. Select the Athos property, and from the dropdown on the right hand side, choose your Athos. You may need to select what cell he is in - if you have to, find the cell Athos (the actor) is in, in the CK, and then select Athos from the bottom dropdown. If you can't find him anywhere, try the (any) cell and search for him.

 

Once you've selected that press OK.

 

No quests or anything required.

 

Yes, what he said :blush:

 

Although, if the npc isn't in the game world, then you can simple move an Xmarker to you and enable the npc's reference alias.

Link to comment
Share on other sites

Thank you but the key is not in the world to, it has to be craft and when the key is crafted Athos appears near to the player. That's the idea.

 

"Although, if the npc isn't in the game world, then you can simple move an Xmarker to you and enable the npc's reference alias."

 

How should I do ?

Edited by Nikitaa
Link to comment
Share on other sites

  • Recently Browsing   0 members

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