Jump to content

Very Small script help (new)


Lazrius

Recommended Posts

what would be the the correct script for something that exchanges items?

 

For example:

Something that changes: -

Gecko hides into Gecko Belts

or

Caps into NCR money

or

Drained Energy cells into charged ones.

 

etc....

 

 

I want to attach a script to a object the converts one object to another object for a maximum amount (back to the examples):

 

i have 10 Gecko Hides so i get 10 gecko belts

or

I have 100 Drained Micro fusion cells so I get 100 Full Micro Fusion Cells.

 

Please inform me of a working script :)

Link to comment
Share on other sites

scn NameOfTheScript

Begin OnAdd PlayerREF

	PlayerREF.AddItem ObjectID 1 1

End

You save that as an object script, then you add it to say, Drained Microfusion cells, and replace ​ObjectID with AmmoMicroFusionCell, and presto.

Edited by claustromaniac
Link to comment
Share on other sites

It depends on how exactly you want to do it. Claustromaniac's example will work if you want the items to be exchanged as soon as they're added to your inventory. I'm not sure that's what you want though, so give some more details if it's not.

 

If you go with the script example from above, don't forget to remove the original item:

scn NameOfTheScript

Begin OnAdd PlayerREF

	PlayerREF.AddItem ObjectID 1 1
	RemoveMe

End
Link to comment
Share on other sites

It depends on how exactly you want to do it. Claustromaniac's example will work if you want the items to be exchanged as soon as they're added to your inventory. I'm not sure that's what you want though, so give some more details if it's not.

 

If you go with the script example from above, don't forget to remove the original item:

scn NameOfTheScript

Begin OnAdd PlayerREF

	PlayerREF.AddItem ObjectID 1 1
	RemoveMe

End

 

True. Kind of funny how I can make very long and complex scripts work in a couple of tries and then I mess up with the simplest ones :laugh:

Edited by claustromaniac
Link to comment
Share on other sites

What I want is for an object to be activated then you select an item if you have any of that item it will convert it into a the corresponding object.

 

I.E. You have 10 drained MFC, so you get 10 Full MFC

Link to comment
Share on other sites

An activation script then:

ScriptName ConvertingSCR
short bMenu
short iButton
short iCount

Begin OnActivate
    If IsActionRef Player
        ShowMessage ConvertingMSG
        Set bMenu to 1
    EndIf
End

Begin GameMode
    If bMenu != 1
        Return
    EndIf
    
    Set iButton to GetButtonPressed
    Set bMenu to 0
    
    If iButton == 0
        Set iCount to Player.GetItemCount GeckoHide
        Player.RemoveItem GeckoHide iCount 1
        Player.AddItem LeatherBelt iCount 1
    ElseIf iButton == 1
        Set iCount to Player.GetItemCount Caps001
        Player.RemoveItem Caps001 iCount 1
        Player.AddItem MoneyNCR100 iCount 1
    ElseIf iButton == 2
        Set iCount to Player.GetItemCount DrainedSmallEnergyCell
        Player.RemoveItem DrainedSmallEnergyCell iCount 1
        Player.AddItem AmmoSmallEnergyCell iCount 1
    EndIf
End

You need to create the ConvertingMSG message object in the GECK and give it menu buttons corresponding to the script. Here's an example for the script above (square brackets indicate buttons):

What do you want?
[Hides to Belts]
[Caps to NCR money]
[Drained cells to charged cells]
[Nothing]

Each button is assigned an index, starting at 0, so pressing [Nothing] makes GetButtonPressed return 3, making it an exit condition without doing anything.

 

It needs some adjustment, one cap doesn't equal 100 NCR dollars after all. But it should get you started.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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