Add Buff||doc135589

September 20, 2022

Format

Entity:addBuff(fullName,time)
    • The class of the function:Entity

      Description

      Adds a buff to the target entity object.


      Notice

      fullName = "myplugin" + "/" + BuffID

      As shown in the figure, you can get the BuffID by right-clicking the buff and selecting "Copy ID". The BuffID in the picture is "buff001", then fullName="myplugin/buff001".

      • If the time parameter is not passed, the Buff duration is infinite

      Parameters

      Variable name type Description
      buffName string Buff configuration name
      time int Buff duration


      Value Returned

      type Description
      Buff Returns the buff instance for useremoveBuffincoming


      Code Samples

      Add a buff with a duration of 100 frames (5 seconds) to itself in the server script mounted on the entity object.

      this:addBuff("myplugin/buff001",100)