Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[XP Script] KSickItem XP
Author Message
kyonides Offline
Darth Scriptus
*****
Registered

Posts: 2,630
Joined: Dec 2009 {mydownloads_submissions}
#1
KSickItem XP

KSickItem XP
v0.3.3

by Kyonides Arkanthes

Introduction

This is a simple scriptlet that will allow you to set as many poisonous items as you wish. Winking
You got to gain or lose an item in order to notice any difference on any of your heroes' states.
Happy with a sweat Yeah, I know that you might have found scripts that let you curse weapons or armors and the like but this one is specific for items! Grinning

It is NOT a Plug & Play script, guys! Indifferent

The Scriptlet

Code:
# * KSickItem XP
#   Scripter : Kyonides Arkanthes
#   2021-08-13 - v0.3.3

# Have you ever thought about including poisonous items in your game project?
# Now you can for sure!

# There are two ways to cure this new kind of poison:
# 1. Get rid of the item!
# 2. Use a specific curative item!

# This is NOT a Plug & Play Script at all!!

# Interpreter#command_126 method has been overwritten.

# * Script Calls * #

# * Actors Poisoned by Item ID
# $game_party.sick_actors(ItemID)

# * First Select an Actor at Position
# actor = $game_party.actors[Position]

# * Is this Item ID poisonous for this Actor?
# actor.sick_item?(ItemID)

# * Retrieve all of the poisonous items for this Actor
# actor.sick_items

# * Add a New Poisonous Item to an Actor
# - It will fail quietly if the item is not listed in ITEM_IDS
# actor.add_sick_item(ItemID)

module KSick
# Poisonous Items
# { ItemID => StateID, etc. }
  ITEM_IDS = { 5 => 10, 6 => 11 }
# Curative Items
# { ItemID => StateID, etc. }
  CURE_ITEM_IDS = { 12 => 10, 13 => 11 }
  RANDOM_CURE_ITEM_SUCCESS_RATE = 50
  RANDOM_CURE_ITEM_ID = 11
  CURE_ITEM_SUCCESS_RATE = 75
  ACTORS = {} # Target Actors - Better leave it alone
  ACTORS.default = [] # Better leave it alone
  # [ActorID] = [List of Item IDs]
  ACTORS[1] = [5,6]
end

class Game_Actor
  alias :kyon_sick_gm_actor_init :initialize
  def initialize(actor_id)
    kyon_sick_gm_actor_init(actor_id)
    @sick_items = KSick::ACTORS[actor_id].dup
  end

  def add_sick_item(sid)
    return unless KSick::ITEM_IDS[sid]
    @sick_items << sid
    @sick_items = @sick_items.uniq
  end

  def use_cure_item(cid)
    iid = 0
    if KSick::RANDOM_CURE_ITEM_ID == cid
      success = rand(100) < KSick::RANDOM_CURE_ITEM_SUCCESS_RATE
      iid = @sick_items[rand(@sick_items.size)] if success
    else
      success = rand(100) < KSick::CURE_ITEM_SUCCESS_RATE
      iid = @sick_items[KSick::CURE_ITEM_IDS[cid]] if success
    end
    return false unless success
    @sick_items.delete(iid)
    remove_state(KSick::CURE_ITEM_IDS[sid])
    true
  end

  def sick_item?(item_id) @sick_items.include?(item_id) end

  def add_sick_item_state(item_id)
    add_state(KSick::ITEM_IDS[item_id]) if sick_item?(item_id)
  end

  def remove_sick_item_state(item_id)
    remove_state(KSick::ITEM_IDS[item_id]) if sick_item?(item_id)
  end
  attr_reader :sick_items
end

class Game_Party
  alias :kyon_sick_gm_pty_git :gain_item
  alias :kyon_sick_gm_pty_lit :lose_item
  def sick_actors(item_id) @actors.select{|a| a.sick_item?(item_id) } end
  def gain_item(item_id, n)
    kyon_sick_gm_pty_git(item_id, n)
    return if @items[item_id] == 0
    sick_actors(item_id).each{|a| a.add_sick_item_state(item_id) }
  end

  def lose_item(item_id, n)
    kyon_sick_gm_pty_lit(item_id, n)
    return if @items[item_id] > 0
    sick_actors(item_id).each{|a| a.remove_sick_item_state(item_id) }
  end
end

class Interpreter
  def command_126
    value = operate_value(@parameters[1], @parameters[2], @parameters[3])
    if value > 0
      $game_party.gain_item(@parameters[0], value)
    elsif value < 0
      # Need to activate the sick state removal process
      $game_party.lose_item(@parameters[0], -value)
    end
    return true
  end
end


Terms & Conditions

Include me in your game credits!
Free for use anywhere unless you are are against the open source movement. Tongue sticking out

"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 2 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX
(This post was last modified: 08-24-2021, 05:31 AM by kyonides.)
08-12-2021, 03:52 PM
Find Reply
kyonides Offline
Darth Scriptus
*****
Registered

Posts: 2,630
Joined: Dec 2009 {mydownloads_submissions}
#2
RE: KSickItem XP

Update

I forgot to mention this before, but the script has been updated a couple of times in the last few hours. Happy with a sweat
Just saying in case you had copied and pasted it on an empty text file... Laughing

"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 2 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX
(This post was last modified: 08-13-2021, 11:04 PM by kyonides.)
08-13-2021, 11:04 PM
Find Reply




Users browsing this thread: