Punkland
English
English
  • PUNKLAND
    • Introduction to Punkland
    • 🔔Update History
      • Studio
      • APP
      • Server
  • Punkland Studio
    • 📖Getting Started
      • How to Download Punkland Studio
      • Checking Version and Updates
      • New Project
      • Map Making
        • Add Map
        • Sub Map Creation
        • Edit Map
      • Studio Interface
        • [File] Tab
        • [Edit] Tab
        • [View] Tab
        • [Game] Tab
        • [Tool] Tab
      • Test Play
      • Publish Game
    • 💻Basic Guide
      • Database
      • MP3 to OGG Converter
      • Translation Export
        • Translation Import
      • Script
      • Resource Market
      • Data Export
        • Data Import
      • Help
      • Project Management
      • Text Commands
      • GM Commands
      • Stats
      • Damage Formula
      • Item Formula
      • QnA
    • 👑Advanced Guide
      • Resource Manager
      • Sprite Manager
      • Layout Manager
      • Top Menu Manager
      • Event page Manager
      • Spine
    • Script Tutorial
      • Use Script
      • Script Docs
      • Server Script
        • ScriptClan
        • ScriptColor
      • Client Script
      • Sample Script
        • UI
        • Monster AI
        • Pet AI
        • Particle
    • Web3 Tutorial
      • Minting and Connection NFT
      • Connectiong ERC-20 Token
    • Effective Punkland
      • Communicating with the Server
      • RunLater
      • HTTP Requests
  • Official Link
    • Punkland Studio Download
    • Website
    • Discord
    • Korea community
Powered by GitBook
On this page
  • Variable
  • Function
  1. Punkland Studio
  2. Basic Guide

Damage Formula

When selecting a potion item type or skill, you can input a damage formula. However, you can also use this field to execute other actions (e.g., awarding items, skills, or gold). Here's an explanation of how this works:


  1. a (attacker): Represents the entity initiating the action (e.g., player, NPC).

  2. b (defender): Represents the entity receiving the action (e.g., player, enemy).

  3. Both a and b are ScriptUnit objects.

  4. For items, b does not exist, and you can use level to get the item's level.

  5. For states, only a and b exist.

  6. For skills, level refers to the skill's level.


Variable

Variable
Description

a.id

a playerID

a.type

a Type (0=player, 1=event, 2=monster)

a.name

a Name

a.x

a position X

a.y

a position Y

a.atk

a Attack

a.def

a Defense

a.magicAtk

a MagicAttack

a.magicDef

a MagicDefense

a.agi

A gility

a.luk

a Lucky

a.maxHP

a maxHP

a.maxMP

a maxMP

a.hp

a currentHP

a.mp

a currentMP

Function

함수
설명

a.SpawnAt(x, y)

Move a to the coordinates x, y.

a.SpawnAtField(mapID, x, y)

Move a to the coordinates x, y on the map with ID mapID.

a.RespawnAt(x, y)

Teleport a to the coordinates x, y.

a.SetVar(id, value)

Change the variable with ID id of a to value.

a.GetVar(id)

Retrieve the variable with ID id from a.

a.AddSkill(id, level)

Add a skill with ID id and level level to a.

a.AddItem(id, count)

Add count items with ID id to a.

a.AddGameMoney(amount)

Add gold to a.

b.RemoveSkill(id)

Remove a skill with ID id from b.

b.RemoveItem(id, count)

Consume count items with ID id from b.

b.UseGameMoney(amount)

Deduct amount gold from b.

b.StartGlobalEvent(id)

Call the global event with ID id.

b.AddBuff(id)

Applies the state with the specified ID to b.

b.RemoveBuff(id)

Removes the state with the specified ID from b.

Practical Examples

Damage Calculation Examples:

  1. Basic Damage Formula: Damage = Attacker's attack - Defender's defense

    a.atk - b.def
  2. Random Damage: Generates random damage between 10 and 50

    rand(10, 50)

Custom Actions:

  1. Steal Gold from Defender:

    b.UseGameMoney(10)
  2. Remove Items or Gold from Attacker:

    a.RemoveItem(1, 10) or a.UseGameMoney(10)

Conditional Formulas:

  1. Critical Damage Calculation: Apply (a.atk * 2) for critical hits; otherwise, (a.atk)

    critical and (a.atk * 2) or (a.atk)

Skill-Specific Damage:

  1. Damage Based on Skill Level: Damage = a.magicAtk - b.magicDef + level + 1

    a.magicAtk - b.magicDef + level + 1

Item-Specific Actions:

  1. Grant a Skill with an Item: When using an item, grant Skill ID 0 at Level 1 to a

    a.AddSkill(0, 1)

State Effects:

  1. Continuous Damage from States: Apply 10 damage over time (minimum of 2 seconds)

    10
PreviousStatsNextItem Formula

Last updated 5 months ago

💻