Author Topic: Conditional Troop Groups on Map Script [XP]  (Read 1023 times)

Offline ArcaneAlchemy

  • Awakened Visionist
  • **
  • Posts: 97
  • LV: 6
  • Gender: Male
    • View Profile
Conditional Troop Groups on Map Script [XP]
« on: June 26, 2014, 07:26:17 AM »
Conditional Troop Encounters
Authors: ArcaneAlchemy
Version: 1
Key Term: Player / Party / Troop Add-on

Introduction

This little script is helpful if you want to easily add, remove, clear, or change a group of troops on
and given map. Maybe monsters get stronger at night, they are there until a mission is done, ect.
Pretty basic, but helpful for random battle maps.

Features

  • Change the Troops on a map based on conditions
  • Use and access pre-defined troop groups easily
  • Add, Remove, or Clear troops on the fly

No Screenshots Available


No Demo


Script
(click to show/hide)

Really doesn't change much so it should be compatible with anything.


Thanks to Chaos Project for all of the great scripts I use. Just trying to give back a little.



"Wait? Do I look like a waiter?" -Kefka

Offline KK20

  • Master Scripter Fixer
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3200
  • LV: 385
  • Gender: Male
  • Choco Octo <3
    • View Profile
Re: Conditional Troop Groups on Map Script [XP]
« Reply #1 on: June 27, 2014, 02:54:04 AM »
Can't be databased in its current state.

You don't have to always do if-else. This
Code: [Select]
    if $game_map.encounter_list.include? troop_id
    else
      $game_map.encounter_list.push troop_id
      $game_map.encounter_list.compact!
    end
can look like this
Code: [Select]
    if !$game_map.encounter_list.include? troop_id
      $game_map.encounter_list.push troop_id
      $game_map.encounter_list.compact!
    end
Also, there really is no need to check if an element exists in the array since you're not doing anything extra:
Code: [Select]
  def del_troop(troop_id)
    $game_map.encounter_list.delete(troop_id)
  end
Interesting idea (and pretty common in some games). I take it you have to have like an autorun event on each map to make these script calls when a switch is on or something?



Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!


Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Offline ArcaneAlchemy

  • Awakened Visionist
  • **
  • Posts: 97
  • LV: 6
  • Gender: Male
    • View Profile
Re: Conditional Troop Groups on Map Script [XP]
« Reply #2 on: June 27, 2014, 03:31:37 AM »
Yeah, I mean you can set it by switches and what not as well. I COULD set them by map id and bypass the db but this was like a 20 minute idea for my little nephew.

As far as the "else" statements, I was using them for print() messages to see if I got the undesired result. Also, as for the include? thing, I'm not sure if it would throw an error if the id didn't exist. Maybe not. Anyway, I'll likely add to this at some point when I'm done organizing my socks lol.
"Wait? Do I look like a waiter?" -Kefka