Jump to content

Photo

Sword level up item script request


  • Please log in to reply
6 replies to this topic

#1 Tabletpillow

Tabletpillow

    Hi

  • Members
  • Real Name:Xavier
  • Location:Oregon

Posted 24 April 2017 - 06:24 PM

I want an item script that creates an item, when collected, increases the level of the sword by one (not power, but actual level.) It will cap at level 9. 

 

The flag "collect item twice to increase level" won't work because I want it to be a single item.

 

Thanks in advance.



#2 Gégé

Gégé

    Senior

  • Members
  • Real Name:Gérard
  • Location:France

Posted 25 April 2017 - 02:03 AM

Untested

item script LevelUpItem{
    void run(int IDitem, int max, int power){
        itemdata itm = Game->LoadItemData(IDitem);
        if(itm->Level < max){
            if(Power >0)itm->Power += power;
            itm->Level += 1;
        }
​        else Quit();
    }
}

Create an another item, put LevelUpItem in 'Pickup Script' and set
D0 : Id Sword
D1 : Max Level
D2 : If you want upgrade power, leave 0 ignore power


Edited by Gégé, 25 April 2017 - 05:08 AM.

  • Tabletpillow likes this

#3 Tabletpillow

Tabletpillow

    Hi

  • Members
  • Real Name:Xavier
  • Location:Oregon

Posted 25 April 2017 - 06:33 PM

Is there a way to change the graphics of the item?



#4 Gégé

Gégé

    Senior

  • Members
  • Real Name:Gérard
  • Location:France

Posted 26 April 2017 - 04:27 AM

Try this :
 
item script LevelUpItem{
    void run(int IDitem, int max, int power, int offset){
        itemdata itm = Game->LoadItemData(IDitem);
        int Orig = itm->OriginalTile
        if(itm->Level < max){
            if(Power >0)itm->Power += power;
            itm->OriginalTile = Orig+offset;
            itm->Level += 1;
        }
​        else Quit();
    }
}
Create an another item, put LevelUpItem in 'Pickup Script' and set
D0 : Id Sword
D1 : Max Level
D2 : If you want upgrade power, leave 0 ignore power
D3 : Change Origin Tile item by that.

Edited by Gégé, 26 April 2017 - 08:30 AM.


#5 Binx

Binx

    Formerly Lineas

  • Members
  • Real Name:Brian
  • Location:Lancaster, CA

Posted 26 April 2017 - 11:29 AM

Try this :
 

item script LevelUpItem{
    void run(int IDitem, int max, int power, int offset){
        itemdata itm = Game->LoadItemData(IDitem);
        int Orig = itm->OriginalTile
        if(itm->Level < max){
            if(Power >0)itm->Power += power;
            itm->OriginalTile = Orig+offset;
            itm->Level += 1;
        }
​        else Quit();
    }
}
Create an another item, put LevelUpItem in 'Pickup Script' and set
D0 : Id Sword
D1 : Max Level
D2 : If you want upgrade power, leave 0 ignore power
D3 : Change Origin Tile item by that.

 

Wouldn't that still leave the item in its original form on the subscreen (due to scripts not running while the subscreen is up)? I used a self-upgrading drop with multiple items for the same effect:

Self-upgrading sword, goes inside your main loop

This should allow you to just drop the level 1 sword (or an item bundle containing it, provided it drops an item on Link, rather than just setting the Link->Item[] value to "true") and have it increase in level every time you pick it up, increasing damage is up to you, if you want to increase damage from your sword, you can use a whimsical ring set to 1/1 chance with a damage bonus of whatever you want (note, the damage bonus is in HP, which is half of what the sword's power says, so if you want to double the power of the L1 sword (power: 1), you'd use a damage bonus of 2, doubling the white sword (power: 2) would be a damage bonus of 4, etc.)


Edited by Binx, 26 April 2017 - 11:35 AM.

  • Gégé likes this

#6 Gégé

Gégé

    Senior

  • Members
  • Real Name:Gérard
  • Location:France

Posted 26 April 2017 - 01:24 PM

Wouldn't that still leave the item in its original form on the subscreen (due to scripts not running while the subscreen is up)? I used a self-upgrading drop with multiple items for the same effect:

Self-upgrading sword, goes inside your main loop

This should allow you to just drop the level 1 sword (or an item bundle containing it, provided it drops an item on Link, rather than just setting the Link->Item[] value to "true") and have it increase in level every time you pick it up, increasing damage is up to you, if you want to increase damage from your sword, you can use a whimsical ring set to 1/1 chance with a damage bonus of whatever you want (note, the damage bonus is in HP, which is half of what the sword's power says, so if you want to double the power of the L1 sword (power: 1), you'd use a damage bonus of 2, doubling the white sword (power: 2) would be a damage bonus of 4, etc.)

 

It's true



#7 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 29 April 2017 - 07:15 PM

Changing the itemdata->Level will also go away on quest reload. You will need to set an array index to hold the present level, and match it to the sword's itemdata in your OnContinue script.


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users