Jump to content

Bottle exchange script.


puffdrag0n

Recommended Posts

So this is my first post here, and I was hoping it didn't have to come to this. But I have been trying to get this script working for two days now and I'm getting really frustrated.

 

I'm trying to build a script so that it will exchange items.

 

No problem right? The problem is I can't get the item count working because I'm a nooblet. What exactly am I doing wrong with this script? I mean like, how do I get it to take all my bottles instead of just one?

 

scn SassRefillSCRIPT

begin onActivate player

if player.getItemCount SSBottleEmpty <= 1
player.removeItem SSBottleEmpty 1
player.addItem SSBottleFull 1

endif

end

 

I'm sorry if I seem retarded, I have never coded before and this is my first time modding using geck. If you could help me I'd be extremely grateful and I'll promise to never ask stupid questions again.

Link to comment
Share on other sites

You need to save the item count to a variable and then pass that variable as a paremeter to the RemoveItem function. Like this:

scn SassRefillSCRIPT
int iCount

begin onActivate player
    Set iCount to player.getItemCount SSBottleEmpty
    if iCount <= 1
        player.removeItem SSBottleEmpty iCount
        player.addItem SSBottleFull iCount
    endif
end

If you post code in the future, use code tags around your script and use some indentation like I did to improve readability. :)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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