Jump to content

Photo

Potion1Blue just dissappears when used instead of draining Link's


  • Please log in to reply
3 replies to this topic

#1 LikeLike888

LikeLike888

    Spicy food lover!!

  • Members
  • Real Name:Jason
  • Location:North America

Posted 05 June 2018 - 04:28 PM

Here is my script

import "std.zh"
int BombX = 0; //BombX will be at X position of wherever Link places a Bomb
int BombY = 0; //BombY will be at Y position of wherever Link places a Bomb
item script IfPotion1BlueIsBWeaponItem
{
  void run()
  {
    if (GetEquipmentB() == 29)
    {
      if ( Link->PressB )
      {
        while(Game->Counter[CR_LIFE]!= 0)
        {
          Game->DCounter[CR_LIFE] = Game->Counter[CR_LIFE]-1;
          Waitframe();
        }
      }
    }
  }
}


#2 NoeL

NoeL

    Legend

  • Members
  • Real Name:Jerram

Posted 05 June 2018 - 05:30 PM

I don't really know zscript, but in the first part of this line you have "DCounter" while it appears it should just be "Counter":

Game->DCounter[CR_LIFE] = Game->Counter[CR_LIFE]-1

If the item is disappearing after use then the item is probably set as a consumable in the item editor.

#3 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 05 June 2018 - 06:17 PM

DCounter is fine, it means drain counter. But 1 is just 1/16 of a heart. Try 16.



#4 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 06 June 2018 - 12:46 AM

 

Here is my script

import "std.zh"
int BombX = 0; //BombX will be at X position of wherever Link places a Bomb
int BombY = 0; //BombY will be at Y position of wherever Link places a Bomb
item script IfPotion1BlueIsBWeaponItem
{
  void run()
  {
    if (GetEquipmentB() == 29)
    {
      if ( Link->PressB )
      {
        while(Game->Counter[CR_LIFE]!= 0)
        {
          Game->DCounter[CR_LIFE] = Game->Counter[CR_LIFE]-1;
          Waitframe();
        }
      }
    }
  }
}

 

 

 

Here is my script

import "std.zh"
int BombX = 0; //BombX will be at X position of wherever Link places a Bomb
int BombY = 0; //BombY will be at Y position of wherever Link places a Bomb
item script IfPotion1BlueIsBWeaponItem
{
  void run()
  {
    if (GetEquipmentB() == 29)
    {
      if ( Link->PressB )
      {
        while(Game->Counter[CR_LIFE]!= 0)
        {
          Game->DCounter[CR_LIFE] = Game->Counter[CR_LIFE]-1;
          Waitframe();
        }
      }
    }
  }
}

 

 

DCounter is fine, it means drain counter. But 1 is just 1/16 of a heart. Try 16.

 

 

The problem is that this is an item script. It can only run for one frame, so, as soon as it encounters the Waitframe() instruction, it exits. 

 

It's only filling a small amount of HP, then exiting, and, if it is attached to a potion class item, it's being removed on use; unless you adjust the defaults. 

 

 

I don't really know zscript, but in the first part of this line you have "DCounter" while it appears it should just be "Counter":

Game->DCounter[CR_LIFE] = Game->Counter[CR_LIFE]-1

If the item is disappearing after use then the item is probably set as a consumable in the item editor.

 

 

It looks to me as the OP wants a refill rate that increases in speed as it refills? (Else, I'm not sure on the point of this)

 

In theory, that's what'd happen here, if the script could run for multiple frames. An ffc, or a global script, is what you need for this type of event.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users