iPhone App Directory
RPG Maker VX
 
Gallery Members Search Calendar Help


Welcome Guest ( Log In | Register )

Collapse

>Announcement

Keep an eye out for the upcoming 3rd Quarter Contest!
3 Pages V   1 2 3 >  
Reply to this topicStart new topic
> Conditional Autostates, States that are automatically applied when certain conditions are met.
Mithran
post Jan 19 2009, 02:41 PM
Post #1


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




Conditional Autostates v 1.3b
by Mithran


Introduction
Origionally planned as part of my advanced state probability rewrite, it got just too big so I decided to split it into several smaller scripts. This is the first of those scripts. Simply put, conditional autostates are states that are only active when certain conditions are met.

Features
- Using note tags, set up states to "turn on" when certain conditions are met
- User defined conditions (advanced)

Screenshots
N/a

How to Use
Place it above main in the materials section list. Instructions for use are in the script.

Demo
None at the moment.

Script
» Click to show Spoiler - click again to hide... «


FAQ
q. I get an error message when using a user defined condition, something about there was a problem with my condition?
a. Post or message me with the condition you used, I'll see what I can do.

q. I need help setting up a condtion.
a. Send me a private message and I'll see if I can help.

Credit and Thanks
- Mithran

Author's Notes
Let me know what you think, if there are any bugs, etc. I have done extensive testing on this one before posting it, but it is possible I still might have missed something. Any feedback is appreciated. Please give credit if you plan to use it.

Future Plans
If there are requests for it, I will add more preset conditions.

This post has been edited by Mithran: Mar 1 2009, 01:15 AM


--------------------
Go to the top of the page
 
+Quote Post
   
Mr. Bubble
post Jan 19 2009, 07:59 PM
Post #2



Group Icon


Type: Undisclosed
Alignment: Unaligned




Thank you for this, Mithran. You've been making a lot of unique and useful scripts and I thank you for all of them.

I'll report if there's anything I run into.


--------------------
I no longer support Tankentai.
Go to the top of the page
 
+Quote Post
   
lekter
post May 30 2009, 05:50 PM
Post #3



Group Icon


Type: Undisclosed




Thanks, this is what i was looking for.


(PD: Sorry for my bad english)
Go to the top of the page
 
+Quote Post
   
Shadowsama
post Aug 23 2009, 02:54 AM
Post #4



Group Icon


Type: Designer




For some reason, I get really, really horrendous lag when running this script...

I use the Tentaketai<sp?> Sideview Script and quite a few of Yanfly (and your) scripts, Mithran. Any ideas?

I can post more specific information about my script set-up if its not already a known issue.
Go to the top of the page
 
+Quote Post
   
Mithran
post Aug 23 2009, 03:48 AM
Post #5


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




@shadowsama - Yeah, it performs a calculation for if autostates should be included every time the states array is checked. If you have many scripts that make it check the states array even more, you may notice a drop in framerate. Tanektai performs several checks per frame of animation. It's partially due to the way I designed this script, and partially due to the other scripts performing multiple calls to states. When I tested it with the base battle system and later State Parameters PLUS, it didnt lag at all. Scripts I've noted it lags the most with are tankentai (usually in the high 50s FPS, very slight bit itself because it performs multiple checks per actor per frame), or KGC equiplearn skill + state parameters plus + conditional autostates(significantly increases the lag when changing or looking at skills - I wrote a patch for this one at some time). I could probably clean up the testing algorithm a little, but it would really need a rewrite it to use an observer pattern and faster methods to completely allevaite the problem. How about sending me a demo so I can see if I patch it up a bit?


--------------------
Go to the top of the page
 
+Quote Post
   
EvilEagles
post Aug 23 2009, 09:04 AM
Post #6


Viva La Revolución!
Group Icon


Type: Designer
Alignment: Unaligned




Sorry, my English bad ...
Can you make it more compatible with KGC_SkillCPSystem?. I mean ... urh ... Sorrry. Here's an example : I have a skill named Auto-Regen, which makes the "Regen" state always appears using your script. But the "Regen" state still be there even if I remove Auto-Rogen out of the Skill Slots (KGC_SkillCPSystem).



This post has been edited by EvilEagles: Aug 23 2009, 09:08 AM
Go to the top of the page
 
+Quote Post
   
Mithran
post Aug 23 2009, 10:50 AM
Post #7


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




@EvilEagles - I wrote a patch for this at some point, I'll see if I can dig it up.


--------------------
Go to the top of the page
 
+Quote Post
   
Fridgecrisis
post Aug 23 2009, 12:06 PM
Post #8


We're out of milk?!
Group Icon


Type: Coder
Alignment: Lawful Good




This is working great! I'm anxious to try it out more. smile.gif Thanks for sharing.


--------------------
My project:

Spoiler:
[||||||||--] Story/Characters
[||--------] Sprites/Tiles
[||--------] Other Graphics
[||--------] Music/Sound
[||--------] Maps/Events
[|||||-----] Database
[|||-------] Scripting
[||--------] Overall

My Scripts:
I support:
Go to the top of the page
 
+Quote Post
   
Shadowsama
post Aug 23 2009, 05:01 PM
Post #9



Group Icon


Type: Designer




QUOTE (Shadowsama @ Aug 22 2009, 10:54 PM) *
For some reason, I get really, really horrendous lag when running this script...

I use the Tentaketai<sp?> Sideview Script and quite a few of Yanfly (and your) scripts, Mithran. Any ideas?

I can post more specific information about my script set-up if its not already a known issue.


That would be awesome... let me pretty things up a bit before uploading it somewhere. On a related note, I get a generic 'Syntax Error' when I add a <autost 78 if 2> tag to a skill and select 'New Game' at the title screen. I think it might be conflicting with Yanfly's 'EquipSkillSlots', but since it just troubleshoots me to the top of the script list following the error, its impossible to tell precisely what might be the problem without hand-deleting all my scripts (and it doesn't concern me enough to go through that sort of trouble, lol)

PM'd you the link, Mithran, let me know of any (inevitable) issues.
Go to the top of the page
 
+Quote Post
   
some_person
post Aug 23 2009, 09:05 PM
Post #10


I Have No Mouth And I Must Scream
Group Icon


Type: Coder
Alignment: Neutral Evil




hey Mithran, I was wondering if you could help me out with the "User defined conditions".

Basically, I want to conditions based on the rage system in yanfly's custom skill effects.
http://pockethouse.wordpress.com/vx/custom-skill-effects/

The first one, I'd like the condition to be if rage is between 1 and 30
the second one, I'd like to be if rage is at 0.
if this is something easily doable, could you please help me?

thanks.

also, "- The autostates states will not give any messages when they become active, and they will not give any messages when they wear off."
is there any way for me to change this? I'd like the normal status messages to play, if that's possible.

thanks again, I'd really appreciate any help.


--------------------
meh...
my scripts..
my first 'battle system'
///////////////\\\\\\\\\\\\\\
Spoiler:
Go to the top of the page
 
+Quote Post
   
Mithran
post Aug 23 2009, 10:12 PM
Post #11


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




QUOTE (some_person @ Aug 23 2009, 02:05 PM) *
hey Mithran, I was wondering if you could help me out with the "User defined conditions".

Basically, I want to conditions based on the rage system in yanfly's custom skill effects.
http://pockethouse.wordpress.com/vx/custom-skill-effects/

The first one, I'd like the condition to be if rage is between 1 and 30
the second one, I'd like to be if rage is at 0.
if this is something easily doable, could you please help me?


CODE
108 => "rage == 0", # use this as the condition for rage is zero
109 => "rage > 0 && rage <= 30", # use this as the condition for rage is between 1 and 30 (including 30)

Copy that into the user defined setup section

QUOTE
also, "- The autostates states will not give any messages when they become active, and they will not give any messages when they wear off."
is there any way for me to change this? I'd like the normal status messages to play, if that's possible.

thanks again, I'd really appreciate any help.


Nope, its not desinged like that. If I rewrite it, I'll add that feature.


--------------------
Go to the top of the page
 
+Quote Post
   
some_person
post Aug 23 2009, 10:37 PM
Post #12


I Have No Mouth And I Must Scream
Group Icon


Type: Coder
Alignment: Neutral Evil




thanks, that helps a lot


--------------------
meh...
my scripts..
my first 'battle system'
///////////////\\\\\\\\\\\\\\
Spoiler:
Go to the top of the page
 
+Quote Post
   
flipsomel
post Aug 23 2009, 11:32 PM
Post #13


L. Khaos
Group Icon


Type: Undisclosed





Just posted on your state plus topic the same issue as Shadowsama.

QUOTE
orry, my English bad ...
Can you make it more compatible with KGC_SkillCPSystem?. I mean ... urh ... Sorrry. Here's an example : I have a skill named Auto-Regen, which makes the "Regen" state always appears using your script. But the "Regen" state still be there even if I remove Auto-Rogen out of the Skill Slots (KGC_SkillCPSystem).


I was wondering if you could make the same but for Yanfly equip skill slot. Since Yanfly based his script on the KGC CP system i hope you could kill two birds with the same stone, so to speak^^


Keep doing your best!


--------------------
Go to the top of the page
 
+Quote Post
   
Shadowsama
post Aug 24 2009, 10:53 PM
Post #14



Group Icon


Type: Designer




QUOTE (flipsomel @ Aug 23 2009, 07:32 PM) *
Just posted on your state plus topic the same issue as Shadowsama.



I was wondering if you could make the same but for Yanfly equip skill slot. Since Yanfly based his script on the KGC CP system i hope you could kill two birds with the same stone, so to speak^^


Keep doing your best!


Just PM'd Mith about the same thing, Flip, maybe we'll get lucky and he'll decide to be awesome twice in one week. biggrin.gif
Go to the top of the page
 
+Quote Post
   
Mithran
post Aug 25 2009, 01:09 AM
Post #15


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




You'll have to perform a test if the skill is actually equipped. Add this to the end of any existing condition:
CODE
"&& equipped_skills.include?($data_skills[xx])"

- replace the xx with the id of the skill.

For example, if you wanted a below 25% hp condition that required skill 23 to be equipped, your condition would be (we'll make it condition 110):
CODE
110 => "(hp > 0) && (hppct_float <= 25.0) && equipped_skills.include?($data_skills[23])",


@evileagles - its slightly different for KGC CP System,
CODE
"&& battle_skill_ids.include?(xx)"

Add that to the end, of any condition, replace the xx with the skill id.

In your case, you could just make it a permanent auto state using the KGC PassiveSkill, I believe, but heres a custom condition (say auto regen is skill 24)

CODE
110 => "battle_skill_ids.include?(24)",

Remember to change the id of the skill you want.


--------------------
Go to the top of the page
 
+Quote Post
   
EvilEagles
post Aug 25 2009, 04:32 AM
Post #16


Viva La Revolución!
Group Icon


Type: Designer
Alignment: Unaligned




QUOTE
In your case, you could just make it a permanent auto state using the KGC PassiveSkill

I know I can solve this problem with KGC_PassiveSkill, but I need some more conditions, not just auto states.
QUOTE
but heres a custom condition (say auto regen is skill 24)

Thank you very much.It worked, but not perfectly sad.gif Now I have another problem. In my case, when I remove "Auto Regen" out of the Slots, the actor, of course, isn't be affected by the "Regen" state, but why the "Regen" icon still be there?.

This post has been edited by EvilEagles: Aug 25 2009, 04:52 AM
Go to the top of the page
 
+Quote Post
   
Mithran
post Aug 25 2009, 05:38 AM
Post #17


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




Well, you could try adding this patch below CP system:

Spoiler:
CODE
class Game_Actor
  alias set_battle_skill_caffix set_battle_skill
  def set_battle_skill(index, skill)
    set_battle_skill_caffix(index, skill)
    make_precond_autostate_cache
  end

  alias add_battle_skill_caffix add_battle_skill
  def add_battle_skill(skill)
    add_battle_skill_caffix(skill)
    make_precond_autostate_cache
  end
  
  alias remove_battle_skill_caffix remove_battle_skill
  def remove_battle_skill(index)
    remove_battle_skill_caffix(index)
    make_precond_autostate_cache
  end
  
  alias clear_battle_skill_caffix clear_battle_skill
  def clear_battle_skill
    clear_battle_skill_caffix
    make_precond_autostate_cache
  end
end


It will force a recache of the skills every time a skill is changed through the system.


--------------------
Go to the top of the page
 
+Quote Post
   
Shadowsama
post Aug 25 2009, 01:38 PM
Post #18



Group Icon


Type: Designer




QUOTE (Mithran @ Aug 25 2009, 01:38 AM) *
Well, you could try adding this patch below CP system:

Spoiler:
CODE
class Game_Actor
  alias set_battle_skill_caffix set_battle_skill
  def set_battle_skill(index, skill)
    set_battle_skill_caffix(index, skill)
    make_precond_autostate_cache
  end

  alias add_battle_skill_caffix add_battle_skill
  def add_battle_skill(skill)
    add_battle_skill_caffix(skill)
    make_precond_autostate_cache
  end
  
  alias remove_battle_skill_caffix remove_battle_skill
  def remove_battle_skill(index)
    remove_battle_skill_caffix(index)
    make_precond_autostate_cache
  end
  
  alias clear_battle_skill_caffix clear_battle_skill
  def clear_battle_skill
    clear_battle_skill_caffix
    make_precond_autostate_cache
  end
end


It will force a recache of the skills every time a skill is changed through the system.



Only works with the CP system, I assume?

I'm going to give that other code a shot right after my Genocide Studies class today, I'll let you know how it works, Mithran. Thanks, again~!

EDIT: I gave it a whirl, but with that snippet attached, the condition doesn't appear to be being met, whether I have the Skill equipped or not. Here's the line, per your instructions:

CODE
101 => 'weapons.compact.size == 1 && !weapons[0].two_handed  && equipped_skills.include?($data_skills[152])', #1handed weapon and 1handed Spec skill equipped


This post has been edited by Shadowsama: Aug 25 2009, 03:51 PM
Go to the top of the page
 
+Quote Post
   
Mithran
post Aug 25 2009, 01:45 PM
Post #19


Scripter
Group Icon


Type: Coder
Alignment: True Neutral




Yeah, thats for CP System. But the 'skills' array in Yanfly's remains unmodified while out of battle, so you should not get the error with it not recaching. If you experience the problem, let me know and I'll do a similar patch.


--------------------
Go to the top of the page
 
+Quote Post
   
Shadowsama
post Aug 25 2009, 05:28 PM
Post #20



Group Icon


Type: Designer




QUOTE (Mithran @ Aug 25 2009, 09:45 AM) *
Yeah, thats for CP System. But the 'skills' array in Yanfly's remains unmodified while out of battle, so you should not get the error with it not recaching. If you experience the problem, let me know and I'll do a similar patch.


Got it. It works, I just have to exit and re-enter the menu to get the state to apply. Awesome. Now I really get elbow deep in this shiz. Thanks again, Mith.
Go to the top of the page
 
+Quote Post
   

3 Pages V   1 2 3 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 21st August 2014 - 11:05 PM

RPGMakerVX.net is an Privacy Policy, Legal.