Save-Point
Soul Engine Ace – Actor Banned Names Script - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+---- Forum: RPGMaker VX/VXAce (RGSS2/3) Engines (https://www.save-point.org/forum-117.html)
+---- Thread: Soul Engine Ace – Actor Banned Names Script (/thread-5020.html)



Soul Engine Ace – Actor Banned Names Script - Mintyy - 02-27-2014

Soul Engine Ace – Actor Banned Names Script
Author: Soulpour777
Category: Actor / Character Related Script
Type: Snippet


Description:

This script allows you to create a list of Banned Names or Words that allows you to create different effects when a banned word is being entered by the player.

Examples:
1. Scene Name
Say for example you are to let the player rename your character and the name being entered is banned, you can have this script check that so you can then have the player re-enter another name that is not inside the banned names list.

Script Calls:


is_actor_banned?(actor_id)
^ check if the actor’s name is banned. e.g. is_actor_banned?(1)

if you wish to print it out on the console, do a script call: p is_actor_banned?(1)

banned_word?(actor_id, banned_names)
^ use this script call to check if the actor’s name is the specific word.

eg: banned_word?(1, ‘Eric’)

if you wish to print it out on the console, do a script call: p banned_word?(1, ‘Eric’)

Added Script Call for version 2:

$game_system.add_ban_name(name) – if you want to add a banned name in game.

Script:

Code:
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# SEA - Banned Names
# By: Soulpour777
# Version 2.0
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Version 1 - Only allows in script names.
# Version 2 - Allows in game and in script names
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Description: This script allows you to create a list of Banned Names or Words
# that allows you to create different effects when a banned word is being
# entered by the player.
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Examples:
# 1. Scene Name
# Say for example you are to let the player rename your character and the name
# being entered is banned, you can have this script check that so you can then
# have the player re-enter another name that is not inside the banned names
# list.
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is under Actors / Characters Related Script.
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Script Calls:
#
# Adding A Name:
# $game_system.add_ban_name(name)
# E.g. $game_system.add_ban_name("Eric")
#
# Check if Actor's name is banned:
# is_actor_banned?(actor_id)
# ^ check if the actor's name is banned. e.g. is_actor_banned?(1)
# if you wish to print it out on the console, do a script call: p is_actor_banned?(1)
#
# Check if Actor's Name is Banned with Specific Name
# banned_word?(actor_id, banned_names)
# ^ use this script call to check if the actor's name is the specific word.
# eg: banned_word?(1, 'Eric')
# if you wish to print it out on the console, do a script call: p banned_word?(1, 'Eric')
#
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

module BannedNames
  BannedNamesList = ["Eric", "Joan"]
end

class Game_System

    attr_accessor :curr_banned_names
   
    alias gamesystem_init initialize
    def initialize
      gamesystem_init
      assign_names
    end   
   
    def add_ban_name(name)
      @curr_banned_names.push(name)
    end
   
    def assign_names
      @curr_banned_names = BannedNames::BannedNamesList
    end

end

class Game_Interpreter
  def is_actor_banned?(actor_id)
    for banned_names in $game_system.curr_banned_names
      if banned_names.upcase == $game_actors[actor_id].name.upcase
        $game_switches[BannedNames::SwitchForBannedNames] = true
        return true
      else
        return false
      end
    end
  end

  def banned_word?(actor_id, banned_names)
    if banned_names.upcase == $game_actors[actor_id].name.upcase
      $game_switches[BannedNames::SwitchForBannedNames] = true
      return true
    end
    return false
  end

end