Chaos Project

RPG Maker => RPG Maker Scripts => RMXP Script Database => Topic started by: G_G on August 30, 2009, 02:00:17 am

Title: [XP] Average Actor Level
Post by: G_G on August 30, 2009, 02:00:17 am
Average Actor Level
Authors: game_guy
Version: 1.0
Type: Level Add-On
Key Term: Actor Add-on



Introduction

What this script does is when you add an actor to the party instead of the actors level being 1 this will average the total level amount of the party and make it so the actor will have the same level area of the party.


Features




Screenshots

N/A


Demo

Demo (http://www.sendspace.com/file/uzflq7)


Script

Spoiler: ShowHide

#===============================================================================
# Average Actor Level
# Author game_guy
# Version 1.0
#-------------------------------------------------------------------------------
# Intro:
# What this script does is when you add an actor to the party instead of the
# actors level being 1 this will average the total level amount of the party
# and make it so the actor will have the same level area of the party.
#
# Features:
# Makes new party member have level equal to party's averaged level
# Easy to use
# Makes it so you can still normally add actors without level averaging
#
# Instructions:
# In a script call command just type this in
# a_add_actor(actor_id)
# actor_id = id of the actor in database
# to average the level.
#
# Side Notes:
# This can be easily evented but who cares. I like making things more
# easy.
#
# Credits:
# game_guy ~ for making it
#===============================================================================
class Game_Party
 alias gg_average_levels add_actor
 def add_actor(actor_id, average=false)
   if average
     actor = $game_actors[actor_id]
     level = 0
     for i in 0...$game_party.actors.size
       level += $game_actors[$game_party.actors[i].id].level
     end
     level = level / $game_party.actors.size
     actor.level = level
   end
   gg_average_levels(actor_id)
 end
end
class Game_Actor
 attr_accessor :level
end
class Interpreter
 def a_add_actor(id)
   $game_party.add_actor(id, true)
 end
end



Instructions

In the script.


Compatibility

Should work with everything.
Not tested with SDK


Credits and Thanks




Author's Notes

Give credits and enjoy.

This can be easily evented but who cares this makes it easier.
Title: Re: [XP] Average Actor Level
Post by: Starrodkirby86 on August 30, 2009, 03:11:57 am
Cool script bro, but...can't this be Evented easily?

Set Variable 001 to Actor 01's level
Add Actor 02's level to Variable 001
Add Actor 03's level to Variable 001
Divide Variable 001 by 3
Add New Party Member
Subtract Variable 001 by One (This is because the Party Member will be Level 1)
Set Level of New Party Member by Variable 001

...I guess?

I can see some uses where this script beats eventing though, mainly on parts where Party member count cannot be determined.
Title: Re: [XP] Average Actor Level
Post by: G_G on August 30, 2009, 03:44:28 am
Yea but didnt you see the side notes in the script? Maybe I should add those.
Title: Re: [XP] Average Actor Level
Post by: Blizzard on August 30, 2009, 05:16:59 am
Quote from: game_guy on August 30, 2009, 02:00:17 am
This can be easily evented but who cares this makes it easier.


Lol, beat me to it. I wanted to say that. xD

It does makes things easier if you don't know who's in your party, though.
Title: Re: [XP] Average Actor Level
Post by: Reno-s--Joker on February 08, 2011, 08:28:07 pm
Cool script G_G! Wish I'd found this earlier.
Hope you don't mind if I use this ~ ^_^
Title: Re: [XP] Average Actor Level
Post by: ForeverZer0 on February 08, 2011, 09:31:04 pm
Necropost achieved!
Title: Re: [XP] Average Actor Level
Post by: Reno-s--Joker on February 10, 2011, 07:35:57 pm
Oh god you're right.