Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: Lanzer on August 27, 2010, 06:48:14 pm

Title: [XP]Request
Post by: Lanzer on August 27, 2010, 06:48:14 pm
"Hello world"
i`m new in this scripting world :3 and well my request is...

I. i`m looking for a script for default battle system ( no addons, third scripts, just a recently instaled rpgxp maker)

- what i want of this script: i want that this script prevents players of spamming skills , kinda "wow skills cooldowns" if "a" skill is used then user forgets "a" and after "X" turns user learns "a".
EX: divine shield - makes user inmune to damage - durations 2 turns - cooldown 11 turns

II. a script for items that have a chance to do "X" basic action or cast no learned skill ( only when the item is equipped , think like "wow`s trinkets")

ex: when user has "X" item equiped it has a chance after attack , defend , skil , etc..... to gain "asd" bonus , status(for "x" turn) or cast a   no learned spell.
EX: Fire sword - has a rand(100) chance to cast fireball+ ,when basic ation result is == 0


that`s all
PD: blizz <3
Title: Re: [XP]Request
Post by: ForeverZer0 on August 30, 2010, 12:25:06 pm
Make a state for the skill. Have it release after 2 turns for example.
Have skill add state to user.
If user has state, cannot use skill.
That should work.

Not sure how well you can script, but that should not be too difficult.
Title: Re: [XP]Request
Post by: Lanzer on August 31, 2010, 08:22:43 pm
ok that should be work, but
my sripting skills are bull-shit like =(
that does´t solve the second problem
BTW nice idea
Title: Re: [XP]Request
Post by: [Luke] on September 02, 2010, 07:58:51 am
Search for "State Requirement Skills" script, it's really very short - and just invert it to make skills not usable if the user has specified state.

Nevermind. It's so easy that even I can make it.
#*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=#
# State Blocking Skills                                                     #
# Author: [Luke] based on [Faint]'s script                                                           #
# Version: 1.0                                                                 #
# Date: 2/09/2010                                                             #
#*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=#
#                                                                              #
#   This Add-on inverts the [Faint]'s State Requirement addon and allows to make some skills      #
#   being locked by some states, for example Poisoned actor cannot perform Spiral Blade skill.                   #
#*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=#
module SRConfigs
 
  def self.block_state(id)
    case id
#*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=#
# Configs                                                                      #
#                                                                              #
#   when SKILL_ID then return BLOCKING_STATE_ID                                #
#   SKILL_ID            - ID of the Skill.                                     #
#   BLOCKING_STATE_ID   - ID of the State that blocks the Skill.           #
#*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=#
      when 1 then return 2
    end
    return
  end

end

#==============================================================================#
# Game_Battler                                                                 #
#==============================================================================#

class Game_Battler
 
  alias state_met? skill_can_use?
  def skill_can_use?(skill_id)
    data = SRConfigs.block_state(skill_id)
    return data != nil && !self.state?(data) ?state_met?(skill_id) : false
  end
 
end


Piece a cake even for such a noob as me. Still, it's kinda lame, because you have to set the state on the actor somehow even if the skill is targeting an enemy (common events, perhaps, if the skill is actor-specific), so that's definitely not a good solution. Search this forum and other ones, probably that script already exists. Try keywords such as "cooldown".

The second script already exists. Search for "Weapon Unleash Skills"... or so. Check the Chaos Project general script database.
Title: Re: [XP]Request
Post by: ForeverZer0 on September 02, 2010, 12:10:26 pm
To add the state when the player uses the skill is simple. Just create an alias method for either the skill_effect method in Game_Battler, or the oneof the Scene_Battle methods (not sure which one off-hand), to add the state if the skill_id == #.
It would be less than 10 lines of code, plus a simple confiq for it.
Title: Re: [XP]Request
Post by: Lanzer on September 02, 2010, 08:34:02 pm
yes like i said before my scripting skills are crap-like =(
anyway thanks for the script just  one more for the "trinkets" script :3

PD: luke <3 hahaha nice script . installing..... wait for feedback
Title: Re: [XP]Request
Post by: ForeverZer0 on September 03, 2010, 12:11:20 pm
Try this. It should work, though I have not tested it.
Just be sure to configure any Cool Down state to only last for the number of turns that you would like, and to release at the end of battle.

But what do I know, [Luke] said it wasn't a good idea, and I know nothing about scripting.

class Game_Battler
 
  # Create states that you want as a 'Cool Down' state. They do not have to actually have any
  # effect. Skills can share different states and vice-versa.
  def cool_down_state(skill_id)
    return case skill_id
    # when SKILL_ID then STATE_ID
    when 57 then 10
    when 58 then 11
    end
  end
 
  alias zer0_cool_down skill_effect
  def skill_effect(user, skill)
    # Checks if the user's skill is a 'cool down' skill. If so, adds the
    # proper state to the user.
    state = cool_down_state(skill.id)
    if state != nil
      user.add_state(state)
    end
    zer0_cool_down(user, skill)
  end
 
  alias zer0_cool_down_can_use? skill_can_use?
  def skill_can_use?(skill_id)
    # Returns false if state is current on battler.
    cool_state = cool_down_state(skill_id)
    if cool_state != nil && state?(cool_state)
      return false
    end
    zer0_cool_down_can_use?(skill_id)
  end
end

Title: Re: [XP]Request
Post by: [Luke] on September 03, 2010, 07:38:08 pm
I said that MY idea to use the reversed "State Requirement Skills" is "kinda lame", because the good and not-lame solution would be... that what you just did ;)
Title: Re: [XP]Request
Post by: Lanzer on September 03, 2010, 08:13:28 pm
yes, i tried Luke´s script and found some problems with it :
I. Only works with "self" skills ( if I use an attack skill it puts the state to the enemy)
II. if the skill and the state aren´t in the DB then the skill becomes unusable.

I was thinking about combine the script with common events so bug "I" won´t ocurr :3 kisses
Title: Re: [XP]Request
Post by: [Luke] on September 04, 2010, 06:26:04 am
Lanzer, just take the ForeverZer0's script and level him up. :)
Title: Re: [XP]Request
Post by: ForeverZer0 on September 07, 2010, 12:09:45 pm
Quote from: [Luke] on September 03, 2010, 07:38:08 pm
I said that MY idea to use the reversed "State Requirement Skills" is "kinda lame", because the good and not-lame solution would be... that what you just did ;)


Sorry, I misread that.  :O.o:
Title: Re: [XP]Request
Post by: Lanzer on September 07, 2010, 08:45:37 pm
Ok zero all tested no bugs :3 thanks *levels up*
btw weapon unleashing skills wasn`t usefull because well
i need that works /w weapons and armors
*weapons X chance when attack use skill
*armor X chance when struck in combat or defend
Title: Re: [XP]Request
Post by: Lanzer on September 11, 2010, 07:00:30 pm
Anyone =(??