Jump to content

Photo

Lose items by getting items


  • Please log in to reply
3 replies to this topic

#1 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 28 June 2010 - 06:10 AM

This is the last script i need for my game.
the script can be assigned to an item.
if link get this item he loose every other item he has.
and link dont loose keys, rupees, and heart container /pieces
i need this script because i make a game like four swords, where you can carry only one item.

Edit: sorry, this should be moved to script requests

Edited by Zelda and Link and I, 28 June 2010 - 07:16 AM.


#2 Joe123

Joe123

    Retired

  • Members

Posted 28 June 2010 - 07:26 AM

CODE
item script RemoveOtherItems
{
    void run()
    {
        for(int i = 1; i < 121; i++)
            if(i != this->ID)
                Link->Item[i] = false;
    }
}

Put this as the pickup script for each item.
There'll probably be some items you want to make exceptions for and things, but you'll only really find that out while you use the script. So if you come back with a list of IDs that you don't want to be removed, or non-standard items that you do want removed then I can fix it up.

#3 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 28 June 2010 - 09:11 AM

yes you are right!
this script should ONLY remove these items:
3
5
11
25
91
143
144

i hope i mustnt say wich items dont should be removed.
this would be a long list

#4 Joe123

Joe123

    Retired

  • Members

Posted 28 June 2010 - 09:33 AM

CODE
int ToRemove[] = { 3, 5, 11, 25, 91, 143, 144 };
const int NumToRemove = 7;
item script RemoveOtherItems
{
    void run()
    {
        for(int i = 0; i < NumToRemove; i++)
            Link->Item[ToRemove[i]] = false;
        Link->Item[this->ID] = true;
    }
}


Try that.
If you want to remove more items than those, add them to the list separated with a comma and update the 'numtoremove' constant to reflect the number of items in the list.


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users