Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
Vinderex

Two script requests, or maybe just one larger one.

Recommended Posts

First request: I have an old script I had requested a couple years or so ago that I'd like some modifications made to. It's a sort of "buddy system" that allows you to define partners for each actor with whom they can swap places with by using a specific skill.

As it is now, as far as I know, it only allows one skill to be defined as the swapping skill. I'd like to be able to define several skills. They'd all still do the same thing, but would just have different names. Also if possible, instead of the swap occuring immediately when the skill's used, I'd like to be able to specify a frame in the skill's animation at which the swap occurs.

 

Second request: This might possibly be combined with the first, or it could be a new script entirely, it doesn't matter to me. Just whatever works. I'd like for certain characters to share stats with each other. Specifically I'd like for "partners" to always gain experience together, and always be of the same level, and always have the same percentages of HP and SP. For example, if one character has a max HP of 1000 and 750 HP remaining, then if the "partner" has a maximum HP of 1200, they should then have 900 remaining. Same thing goes for SP. Other stats should remain independant from each other.

 

My intended use for this is things like transformations, form shifting, stance changing, etc. There'll be several different types of changes really, but the main idea in all of them is that all of the "tag team buddies" will always actually be the same person in a different form, so their stats should match.

 

Thanks a lot in advance to whoever can do this for me. smile.png

Oh! I almost forgot the old script I mentioned. Here it is. Credit goes to Exsharaen for it.

 

# SETTINGS BEGIN

# Skill ID to perform swap

TAG_SKILL_ID = 1

# Define buddy for each actor

# in format:

#

# actor_id => buddy_actor_id

#

# You don't need to define for all actors, just those who have one.

# You also don't need to define closed loops as exampled below:

# 1 => 7,

# 7 => 1

# as 1 will exclusively swapped with 7 and vice versa.

#

# MAKE SURE an actor has exclusively only one buddy

# so DON'T do this:

# 1 => 5,

# 2 => 6,

# 7 => 1 --> invalid, 1's buddy is 5

# When 5 and 7 is in party, 7 can swap with 1,

# so 1 can join party along with 5!!!

# Also, 5 can no longer be swapped with 1 if they're in one party.

ACTOR_TAG =

{

1 => 15,

3 => 16,

4 => 17,

6 => 18,

7 => 19,

8 => 20,

9 => 21,

}

# SETTINGS END

 

class Game_Party

attr_accessor :reserved_actors

 

alias tag_initialize initialize

def initialize

tag_initialize

@reserved_actors = []

end

 

def tag_change(actor, skill_cost)

# Buddy will be defined by this point...

buddy = actor.buddy

# Find the position of current actor

for i in 0 ... @actors.size

current_actor = @actors

if current_actor.id == actor.id

actor_index = i

break

end

end

# Now swap actor with buddy

temp_actor = @actors[actor_index]

@actors[actor_index] = buddy

# Delete buddy from reserved actors list

@reserved_actors.delete(buddy)

# Add current actor to reserved actors list

@reserved_actors.push(temp_actor)

# calling from menu?

if $scene.is_a?(Scene_Skill)

$scene = Scene_Menu.new(1)

end

# Refresh player

$game_player.refresh

end

end

 

class Game_Battler

#--------------------------------------------------------------------------

# * Apply Skill Effects

# user : the one using skills (battler)

# skill : skill

#--------------------------------------------------------------------------

def skill_effect(user, skill)

# Clear critical flag

self.critical = false

# If skill scope is for ally with 1 or more HP, and your own HP = 0,

# or skill scope is for ally with 0, and your own HP = 1 or more

if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or

((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)

# End Method

return false

end

# Clear effective flag

effective = false

# Set effective flag if common ID is effective

effective |= skill.common_event_id > 0

# First hit detection

hit = skill.hit

if skill.atk_f > 0

hit *= user.hit / 100

end

hit_result = (rand(100) < hit)

# Set effective flag if skill is uncertain

effective |= hit < 100

# If hit occurs

if hit_result == true

# Calculate power

power = skill.power + user.atk * skill.atk_f / 100

if power > 0

power -= self.pdef * skill.pdef_f / 200

power -= self.mdef * skill.mdef_f / 200

power = [power, 0].max

end

# Calculate rate

rate = 20

rate += (user.str * skill.str_f / 100)

rate += (user.dex * skill.dex_f / 100)

rate += (user.agi * skill.agi_f / 100)

rate += (user.int * skill.int_f / 100)

# Calculate basic damage

self.damage = power * rate / 20

# Element correction

self.damage *= elements_correct(skill.element_set)

self.damage /= 100

# If damage value is strictly positive

if self.damage > 0

# Guard correction

if self.guarding?

self.damage /= 2

end

end

# Dispersion

if skill.variance > 0 and self.damage.abs > 0

amp = [self.damage.abs * skill.variance / 100, 1].max

self.damage += rand(amp+1) + rand(amp+1) - amp

end

# Second hit detection

eva = 8 * self.agi / user.dex + self.eva

hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100

hit = self.cant_evade? ? 100 : hit

hit_result = (rand(100) < hit)

# Set effective flag if skill is uncertain

effective |= hit < 100

end

# If hit occurs

if hit_result == true

# If physical attack has power other than 0

if skill.power != 0 and skill.atk_f > 0

# State Removed by Shock

remove_states_shock

# Set to effective flag

effective = true

end

# Tag skill performed?

if skill.id == TAG_SKILL_ID

self.damage = 0

$game_party.tag_change(user, skill.sp_cost)

else

# Substract damage from HP

last_hp = self.hp

self.hp -= self.damage

end

effective |= self.hp != last_hp

# State change

@state_changed = false

effective |= states_plus(skill.plus_state_set)

effective |= states_minus(skill.minus_state_set)

# If power is 0

if skill.power == 0

# Set damage to an empty string

self.damage = ""

# If state is unchanged

unless @state_changed

# Set damage to "Miss"

self.damage = "Miss"

end

end

# If miss occurs

else

# Set damage to "Miss"

self.damage = "Miss"

end

# If not in battle

unless $game_temp.in_battle

# Set damage to nil

self.damage = nil

end

# End Method

return effective

end

end

 

class Game_Actor < Game_Battler

#--------------------------------------------------------------------------

# * Determine if Skill can be Used

# skill_id : skill ID

#--------------------------------------------------------------------------

def skill_can_use?(skill_id)

if not skill_learn?(skill_id)

return false

elsif skill_id == TAG_SKILL_ID

if buddy == nil

return false

else

# There is any chance that buddy is in party

# Can't use skill if buddy is already in party

for i in 0 ... $game_party.actors.size

if $game_party.actors.id == buddy.id

return false

end

end

# Buddy not found, continue

end

end

return super

end

# Return buddy

def buddy

# Has buddy?

if ACTOR_TAG.include?(id)

buddy_id = ACTOR_TAG[id]

elsif ACTOR_TAG.has_value?(id)

buddy_id = ACTOR_TAG.index(id)

else

return nil

end

# Find buddy position

for i in 0 ... $game_party.reserved_actors.size

if $game_party.reserved_actors.id == buddy_id

return $game_party.reserved_actors

end

end # end for

# Not found, initialize a new one

return Game_Actor.new(buddy_id)

end

end

 

Share this post


Link to post
Share on other sites

Sorry partner, over my head, and workin hard at another project at the moment. If I knew more about how to script, I could probably help out more, but hell, Im still struggling with the basics!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...