Help with Variables.

Post » Wed Dec 18, 2013 2:32 pm

Hi I am new to this modding business and I am attempting to have a variable created and can be used else where.

In a quest, once you have created a dialogue, I have this in one of the

End : Papyrus Fragment

Objectreference A1= Game.GetPlayer().PlaceAtMe(Game.GetForm(0x0106eaf))
Game.GetPlayer().RemoveItem(Game.GetForm(0x000000f),1)

My problem was, I wish to used the variable A1 in another dialogue I have created elsewhere, is there a method I can "store" the object I have created, and use it on another dialogue?

For example in another dialogue I can

Objectreference Tempref = A1

Tempref.RemoveItem(Game.GetForm(0x000000f),1)

User avatar
Toby Green
 
Posts: 3365
Joined: Sun May 27, 2007 5:27 pm

Post » Wed Dec 18, 2013 7:45 am

Another more simple way to do it is just use the object ID and set a property to that object instead of the GetForm. (That is if I understand what you're trying to do.) Perhaps a more detailed explanation would be helpful.

User avatar
Donatus Uwasomba
 
Posts: 3361
Joined: Sun May 27, 2007 7:22 pm

Post » Wed Dec 18, 2013 8:18 am

A quest alias might work for you. You could set up an optional reference alias, MyThing.

Then, after creating the reference with placeatme(), for the MyThing alias to point to that reference.

Alias_MyThing.ForceRefTo(A1)

Now, you can use that alias in other places. Alias_MyThing.GetReference() will return A1.
User avatar
ashleigh bryden
 
Posts: 3446
Joined: Thu Jun 29, 2006 5:43 am

Post » Wed Dec 18, 2013 3:32 pm

Hi this is What I am trying to do.

Firstly I speak to an NPC, I want to hire an archer. So it cost me 1 gold.

Game.GetPlayer().RemoveItem(Game.GetForm(0x000000f),1) ;This remove 1 gold

Game.GetPlayer().placeActorAtMe(0Archer,1) ; This place an Archer next to me. Please note this is incorrect, I want to spawn this actor

on the Papyrus fragment in the Dialogue of a quest. PLEASE HELP ME on what is the correct

coding to use

0Archer is an NPC I have created.

Once the Archer is created, I wish to give this archer an item. Now I have a problem, if I need to give him an item I need a variable which had stored his information to call on.

To store the information of an object into a variable, I think you do this.

Objectreference A1= Game.GetPlayer().PlaceAtMe(Game.GetForm(0x0106eaf))

A1 is the variable, and the object,0106eaf, the formlist of my archer is stored in A1

Now, if I want to used this A1 variable on another quest, dialogue and papyrus fragment, how can this information be tranfer across, so for example I can go to a different quest, create this dialogue I can talk to the Archer, and give him a bow.

So if Objectreference A1= Game.GetPlayer().PlaceAtMe(Game.GetForm(0x0106eaf))

is created in a different quest, and papyrus fragment, how can this object information, stored in a variable can be transfer across.

One way is to use a Global Variable, but I don't know how to do it.

User avatar
Liv Staff
 
Posts: 3473
Joined: Wed Oct 25, 2006 10:51 pm


Return to V - Skyrim