Jump to content

I need a simple script.


Force70

Recommended Posts

Hi, I'm trying to add new coins to the game (silver and copper). But I ran into a snag. When ever my character picks up the new coins they go into my inventory instead of adding to my total gold count.

 

I was able to make them act like the coin purses that you find, but since they are classified as flora I was unable to put them in containers. So I was hoping that someone could make me a script.

 

I would do it my self but I don't know anything about scripting. Basically what I want is that when ever you pick up one of the coins it will add a set amount of copper coins (copper is replacing gold since it's more common and I won't have to change any of the quest rewards.) and then deletes the coin that you picked up. Kind of like the coin purse. I can't imagine that this would be a very hard or long script. I just don't know how to do it.

Link to comment
Share on other sites

Not too sure what you are trying to do exactly... but lets see if I understand correctly...

 

You are adding two new coins in addition to gold BUT you are replacing the base gold coin with copper. Thereby making the gold item (ID# 0000000f) copper in appearance. This leaves you with a problem regarding the added silver and now added gold coins. Because they are a different ID# they are not being added into the base copper count.

 

If all that is true then you may want some variation of this

 

Applied to the player alias on a constantly active quest

 

 

 

Scriptname CoinSwap Extends ReferenceAlias
 
Actor Property PlayerRef Auto ;auto-fill
MiscObject Property GoldCoin Auto ;assign your new gold coin
MiscObject Property SilverCoin Auto ;assign your new silver coin
MiscObject Property CopperCoin Auto ;assign the original gold converted into copper coin
Int Property GoldToCopperRatio Auto ;assign the number of copper coins to make one gold coin
Int Property SilverToCopperRatio Auto ;assign the number of silver coins to make one silver coin
 
Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
  If akBaseItem == GoldCoin
    Int Quantity = aiItemCount * GoldToCopperRatio
    PlayerRef.AddItem(CopperCoin,Quantity,true) ;should auto-add the correct coins
    PlayerRef.RemoveItem(GoldCoin,aiItemCount,true) ;does not assign a container to transfer to - this makes the item disappear from game
  ElseIf akBaseItem == SilverCoin
    Int Quantity2 = aiItemCount * SilverToCopperRatio
    PlayerRef.AddItem(CopperCoin,Quantity2,true) ;should auto-add the correct coins
    PlayerRef.RemoveItem(SilverCoin,aiItemCount,true) ;does not assign a container to transfer to - this makes the item disappear from game
  EndIf
EndEvent

 

 

Do note I have not tested compilation or functionality. The theory however is sound.

Link to comment
Share on other sites

You understand correctly. Sorry if my post was hard to understand. Sometimes I have a hard time explaining things.

 

I was originally hoping to find out how the coins were added to the coin count. But That was not successful.

 

I have absolutely no idea what anything in your script means but that's to be expected. I do appreciate you taking the time to help me.

 

I actually just found a way to get my new coins to work, (I was just about to post when I got the update that there was a new post) with out needed to write my own script. I spent a few hours looking through the scripts hoping to find something. I found a script called "coinBagscript" And when I assigned that to my new coins. I was able to make it to where when you pick then up you get a set amount of copper coins. The only thing I don't like is that when the coins are picked up it says (X) copper coins added or something like that, (X stand for the amount of coins).

Link to comment
Share on other sites

Just looked at that script in my own game directory...

 

Since your mod will be modifying the money system anyway.... a small adjustment to the script (which won't hurt the save game at all if uninstalled) should be okay.

 

Load up your mod in the CK, open one of your coin bag objects, right click on the script entry and choose edit.

 

Look for this line:

game.getPlayer().addItem(coinObj, numOfCoins)

 

Change it to:

game.getPlayer().addItem(coinObj, numOfCoins,true)

Then compile & save the script.

 

Adding the word true tells the game to not display the text.

 

FYI - that script does the exact same thing as what I typed up. It's just designed to go on the object itself. Didn't even know it was there. :P Guess I should have looked before typing up a script. Oh well...

Link to comment
Share on other sites

Just looked at that script in my own game directory...

 

Since your mod will be modifying the money system anyway.... a small adjustment to the script (which won't hurt the save game at all if uninstalled) should be okay.

 

Load up your mod in the CK, open one of your coin bag objects, right click on the script entry and choose edit.

 

Look for this line:

game.getPlayer().addItem(coinObj, numOfCoins)

 

Change it to:

game.getPlayer().addItem(coinObj, numOfCoins,true)

Then compile & save the script.

 

Adding the word true tells the game to not display the text.

 

FYI - that script does the exact same thing as what I typed up. It's just designed to go on the object itself. Didn't even know it was there. :tongue: Guess I should have looked before typing up a script. Oh well...

 

Thanks.

Link to comment
Share on other sites

Well. I got it to work. Now all I need to do is figure out what the value of the new coins should be. Any suggestions?

Edited by Force70
Link to comment
Share on other sites

Works for me. Does anyone know how to make the new coins (especially the gold ones) rare? I don't want players to be able to find a dozen gold coins in one place and be rich.

Link to comment
Share on other sites

You could probably use nested leveled lists or something like that. I've not had experience with leveled lists so not sure on exactly how they work.

 

If it is a scripted appearance of coins you can use RandomInt to produce a random number, then depending upon the result provide the appropriate coins. Obviously you want less numbers to reward the gold and more to reward the copper, etc....

Link to comment
Share on other sites

You could probably use nested leveled lists or something like that. I've not had experience with leveled lists so not sure on exactly how they work.

 

If it is a scripted appearance of coins you can use RandomInt to produce a random number, then depending upon the result provide the appropriate coins. Obviously you want less numbers to reward the gold and more to reward the copper, etc....

 

I'm not really worried about it. The main pain is going to be distributing the silver and gold coins in the world (not in containers and level lists) That I'm not looking forward to.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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