Customizable script request: alliances amongst factions

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
For a non-script method, you can always set up a "counter" where the player can go there for informations.

So an event that shows some windows with informations can be easily done using eventing only.

Depends on how you want to show the informations, have a few variables ready to hold informations just for the windows can be done.

eg,

$game_variables[1] = A[0]

$game_variables[2] = A[1]

and in the window text, simply use \\v[1], \\v[2] to show the variables in text.
 

chungsie

Veteran
Veteran
Joined
Sep 9, 2015
Messages
656
Reaction score
857
First Language
English
Primarily Uses
N/A
thank you for the information you provided. I noticed in the link you provide it offers a method for if a button is pressed, but gives no code example. how would one script for keyboard input? maybe it would be easier to not have it in the menu. but a key input structure to display the information.

Also, what if the information displayed is outside the window? WIll it allow scrolling automatically?

 
 
Last edited by a moderator:

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
No code's needed. It's fully eventing for the button pressed.

edit: you can check which button is pressed in conditional branch of an event

And no, it will not scroll automatically unless you do the script call with a refresh mode(update) + scroll math,

If your information is clipped by the window border, just make a bigger window or display the informations in a new line. Creativity is your limit there.
 
Last edited by a moderator:

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,492
Reaction score
408
First Language
German
Primarily Uses
RMMV
Cant help with Solution, but maybe this Helps to Organize a little. But i believe iam missing some Points.

Feel free to Edit or Change OP.

1. Extra Point in Menu that Links to a new Custom Menu Page.

- No further explanation needed i believe.

2. You need a Custom Menu Page that is also Scrollable and shows symbols and names of all 53 Factions and if you hover over em you see description somewhere with information texts, for which the scripter need detailed examples. Changing or adding stuff later on can be a pain in the "after" and are the reason why scripter mostly only help if help wanter provides this stuff. Say thanks to masses of Internet Trolls :) .

-You need to describe what exactly will be shown on that Menupage? Best would be a placeholder drawing that contains all Menu Information how it would apear for Player.

3. You are naming the Variables for the Factions in some logical way, would recoment to build the war peace mechanic in smal with 3 to maximum 5 factions, and as soon you tweeked it so far that its fun or like you want it, only than rebuild it for 53 Factions.

4. You need to know when the variables for peace and stuff will get changed. Scripter will need all Ways how that could be possible.

Like Player makes his turn than he presses next Day button or goes to Inn , and than i want that and that stuff to happen mister scripter. not how it should happen in Code you tell, you tell whats the player does and what he than sees..

-I believe you mentioned something like that in your first Post, have to reread it, but i believe some was missing even there.

5. Than the Scripter maybe would need to know if this is Simulation Game with just Values or if it is simple RPG but with fasncy mechanic we dont understand at the moment and therefor overcomplicating stuff? or if it goes with many figures on a map which could need extra Battle KI to move troops tacticaly around, or if just some self switches just change the flag above a citie and when player enters it it will be a different map depending who is controlling that city and if its war or peace. Detailed Information needed in this hard case. :)

6. ???
 
Last edited by a moderator:

chungsie

Veteran
Veteran
Joined
Sep 9, 2015
Messages
656
Reaction score
857
First Language
English
Primarily Uses
N/A
Thanks Bex.

So from the menu, you select Diplomacy. If a faction has been discovered, meaning one or more cities have been visited, then information on that faction can be shown. So it shows a list of Discovered Factions on the left side of the menu display. Selecting that faction brings to the right side of the menu display, information on who the parent(selected) faction is at war with (child). It doesn't need to say who the agressor is, or anything about the child faction. If the child faction is not discovered, then no information is displayed. Information displayed about the child factiopn should be either peace, or war, where neutral has no display of information.

If the player has a Position of Power, they can advise the chief/king/emporer/sultan as to what to do diplomatically, before then, diplomacy should be random, and dependent on a variable called vulnerability. The player should only be able to set one diplomacy at a time per parent faction.

I am using a variable calender, and every week should trigger the ability for a parent faction to declare peace, war and neutrality.

The game is an RPG with a goal to have simple world simulation features. such as dipomacy, and trading, housing and populations, tax pools and such.the rpg aspect has quest, leveling, parties (squads). I guess like an open world. Where the player can do pretty much whatever they want.

Edit: The player will be able to choose a side, by going to the capital of either the parent or child faction, and speaking with the General of Forces for that Faction. The player has five days to be apart of the war, where one minute in game is a real world second. I think maybe a separate script for the simulation of the forces fighting before they player arrives, unless it can be merged into one script. The player will be informed where to go, based on the event that is activated for that time frame, where they can go and join up with forces and fight the enemy. The defender has a chance to stop an invasion. The aggressor has a chance to invade a city and claim it. All this takes place in five day cycle after the diplomacy random event, or player interaction causing diplomacy changes. At end of five days, diplomacy is reset to neutral for both sides, and wait until two more days before diplomacy random event.
 
Last edited by a moderator:

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
Umm.. thought this is solved, sorry.

What you have in mind can be done with eventing only (except the menu part).

You can store ALL the informations in ONE game variable. And then later abstract the needed informations into a few game variables to show informations in windows and such.

eg

$game_variables[1] = [["Faction A", true, true, false, true, 500],["Faction B", false, true, false, true, 1200],["Faction C", false, true, false, false, 4800]]

So to call Faction C's data into game variable 2, do this:

$game_variables[2] = $game_variables[1][2]

this will result in

$game_variables[2] = ["Faction C", false, true, false, false, 4800]

so 

$game_variables[2][0] = "Faction C"

$game_variables[2][1] = false

$game_variables[2][2] = true

$game_variables[2][3] = false

$game_variables[2][4] = false

$game_variables[2][5] = 4800

Remember, the "slots" starts at 0

This is all that you needed for the data management part

So you can store 50+ factions with all their branches in one single variable.

As you can see from the above example, you can have variables as switches(true/false boolean).

So simply add a true/false check in there to show if the player has visited a town or not.

And later call it into smaller variables when you need to show them in windows. 

Since your "requirement" is way too complex to be understood by anyone else but you, this is the best method imo...

---------------------------

For the conditional branches to decide whether or not to show the info...

Really can't help you with all those complex thoughts you have there, but this is how you can do a condition check:

in a conditional branch script box, add this

$game_variables[1][2][3] == trueTo check the 3rd slot information of game variable 1, then further breaking down to check the 4th slot information in that slot.

Reference to the above example, and you should be getting a result "false"

So the conditional branch checking for a true can proceed to process the "else" part. In your case, not showing information for X Town of Faction C.
 
Last edited by a moderator:
  • Like
Reactions: Bex

chungsie

Veteran
Veteran
Joined
Sep 9, 2015
Messages
656
Reaction score
857
First Language
English
Primarily Uses
N/A
I looked at some tutorials for scripting, and it seemed that handling all the information could best be done with classes. I know I said it would probably be easier to use arrays, but it really keeps things easier for me to recall for later use. I have not made a completed script, mostly finished the intializations of all factions, which took two days. also, sorry, I don't know how to do a spoiler button code thingy.


#Time Check
class Time_Check1
  if $DAYA == 1
      Dipolomacy_Eventer
  end
end
#Establishes the settings for Factions
class Faction
  def initialize
    @status = "neutral"
    @enemy = "none"
    @taxes = 0
    @diplomacy = 100
  end
  def status
    @status
  end
  def status=(val)
    @status = val
  end
  def enemy
    @enemy
  end
  def enemy=(val)
    @enemy = val
  end
  def ally
    @ally
  end
  def ally=(val)
    @ally = val
  end
 
  def taxes
    @income
  end
  def taxes=(val)
    @taxes = val
  end
  def vulnerability
    @vulnerability
  end
  def vulnerability=(val)
    @vulnerability = val
  end
  def diplomacy
    @diplomacy
  end
  def diplomacy=(val)
    @diplomacy = val
  end
end




#Initialize Rome
SenateOfRome = Faction.new
SenateOfRome.taxes = 1000
SenateOfRome.vulnerability = 50
SenateOfRome.status = "War"
SenateOfRome.enemy = ["Dacia", "Thracia", "Cappodcia", "Pontus Kingdom"]
SenateOfRome.ally = ["Mauretania", "Egypt", "Osroene", "Mascat", "Galatian Confederacy", "Jerusalem", "Bosporan Kingdom"]
#Initialize Dacia
Dacia = Faction.new
Dacia.taxes = 50
Dacia.vulnerability = 20
Dacia.status = "War"
Dacia.enemy = ["Senate Of Rome"]
Dacia.ally = ["None"]
#Initialize Xiongnu
Xiongnu = Faction.new
Xiongnu.taxes = 700
Xiongnu.vulnerability = 35
Xiongnu.status = "War"
Xiongnu.enemy = ["Han Empire"]
Xiongnu.ally = ["Goguryeo", "Okjeo", "Buyeo", "Dongye"]
#Initialize Han Empire
Han_Empire = Faction.new
Han_Empire.taxes = 1200
Han_Empire.vulnerability = 70
Han_Empire.status = "War"
Han_Empire.enemy = ["Xiongnu", "Goguryeo", "Okjeo", "Doongye", "Byeonhan", "Mahan", "Jinhan", "Japan", "Yuezhi"]
Han_Empire.ally = ["None"]
#Initialize Buyeo
Buyeo = Faction.new
Buyeo.taxes = 200
Buyeo.vulnerability = 40
Buyeo.status = "War"
Buyeo.enemy = ["Han Empire", "Goguryeo", "Okjeo", "Dongye"]
Buyeo.ally = ["Xiongnu"]
#Initialize Goguryeo
Goguryeo = Faction.new
Goguryeo.taxes = 120
Goguryeo.vulnerability = 30
Goguryeo.status = "War"
Goguryeo.enemy = ["Han Empire", "Buyeo", "Okjeo", "Dongyeo"]
Goguryeo.ally = ["Xiongnu"]
#Initialize Okjeo
Okjeo = Faction.new
Okjeo.taxes = 150
Okjeo.vulnerability = 15
Okjeo.status = "War"
Okjeo.enemy = ["Han Empire", "Goguryeo", "Buyeo", "Dongye"]
Okjeo.ally = ["Xiongnu"]
#Initialize Yuezhi
Yuezhi = Faction.new
Yuezhi.taxes = 71
Yuezhi.vulnerability = 40
Yuezhi.status = "War"
Yuezhi.enemy = ["Han Empire"]
Yuezhi.ally = ["None"]
#Initialize Dongye
Dongye = Faction.new
Dongye.taxes = 600
Dongye.vulnerability = 34
Dongye.status = "War"
Dongye.enemy = ["Han Empire", "Goguryeo", "Buyeo", "Okjeo"]
Dongye.ally = ["Xiongnu"]
#Initialize Byeonhan
Byeonhan = Faction.new
Byeonhan.taxes = 150
Byeonhan.vulnerability = 45
Byeonhan.status = "War"
Byeonhan.enemy = ["Han Empire", "Mahan", "Jinhan", "Japan"]
Byeonhan.ally = ["None"]
#Initialize Mahan
Mahan = Faction.new
Mahan.taxes = 75
Mahan.vulnerability = 67
Mahan.status = "War"
Mahan.enemy = ["Byeonhan", "Han Empire", "Jinhan", "Japan"]
Mahan.ally = ["None"]
#Initialize Jinhan
Jinhan = Faction.new
Jinhan.taxes = 271
Jinhan.vulnerability = 12
Jinhan.status = "War"
Jinhan.enemy = ["Byeonhan", "Han Empire", "Mahan", "Japan"]
Jinhan.ally = ["None"]
#Initialize Japan
Japan = Faction.new
Japan.taxes = 126
Japan.vulnerability = 23
Japan.status = "War"
Japan.enemy = ["Byeonhan", "Han Empire", "Jinhan", "Mahan"]
Japan.ally = ["None"]
#Initialize Parthian Empire
Parthian = Faction.new
Parthian.taxes = 780
Parthian.vulnerability = 40
Parthian.status = "War"
Parthian.enemy = ["Media", "Armenia", "Osorene", "Yadavas Kingdom"]
Parthian.ally = ["None"]
#Initialize Yadavas Kingdom
Yadavas = Faction.new
Yadavas.taxes = 340
Yadavas.vulnerability = 34
Yadavas.status = "War"
Yadavas.enemy = ["Parthian Empire", "Indo Scythian Confederacy", "Magadha dynasty"]
Yadavas.ally = ["None"]
#Initialize Indo Scythian COnfederacy
Scythia = Faction.new
Scythia.taxes = 300
Scythia.vulnerability = 24
Scythia.status = "War"
Scythia.enemy = ["Yadavas Kingdom"]
Scythia.ally = ["Magadha Dynasty", "Satavahana"]
#Initialize Magadha Dynasty
Magadha = Faction.new
Magadha.taxes = 450
Magadha.vulnerability = 45
Magadha.status = "War"
Magadha.enemy = ["Yadavas Kingdom"]
Magadha.ally = ["Indo Scythian Confederacy"]
#Initialize Satavahana
Satavahana = Faction.new
Satavahana.taxes = 350
Satavahana.vulnerability = 24
Satavahana.status = "War"
Satavahana.enemy = ["Pandyas"]
Satavahana.ally = ["Kalinga Dynasty", "Chutus", "Cholas", "Ceras"]
#Initialize Kalinga Dynasty
Kalinga = Faction.new
Kalinga.taxes = 120
Kalinga.vulnerability = 39
Kalinga.status = "War"
Kalinga.enemy = ["Pandyas"]
Kalinga.ally = ["Satavahana", "Chutus", "Cholas", "Ceras"]
#Initialize Chutus
Chutus = Faction.new
Chutus.taxes = 241
Chutus.vulnerability = 34
Chutus.status = "War"
Chutus.enemy = ["Pandyas"]
Chutus.ally = ["Satavahana", "Kalinga Dynasty", "Cholas", "Ceras"]
#Initialize Cholas
Cholas = Faction.new
Cholas.taxes = 145
Cholas.vulnerability = 45
Cholas.status = "Peace"
Cholas.enemy = ["None"]
Cholas.ally = ["Satavahana", "Chutus", "Kalinga Dynasty", "Pandyas", "Ceras"]
#Initialize Pandyas
Pandyas = Faction.new
Pandyas.taxes = 134
Pandyas.vulnerability = 34
Pandyas.status = "War"
Pandyas.enemy = ["Satavahana", "Chutus", "Kalinga Dynasty"]
Pandyas.ally = ["Cholas", "Ceras"]
#Initizlize Ceras
Ceras = Faction.new
Ceras.taxes = 124
Ceras.vulnerability = 24
Ceras.status = "War"
Ceras.enemy = ["Pandyas"]
Ceras.ally = ["Satavahana", "Chutus", "Cholas", "Kalnga Dynasty"]
#Initialize Pyu
Pyu = Faction.new
Pyu.taxes = 34
Pyu.vulnerability = 20
Pyu.status = "Peace"
Pyu.enemy = ["None"]
Pyu.ally = ["Monn Cities", "Funan"]
#Initialize Monn Cities
Monn = Faction.new
Monn.taxes = 51
Monn.vulnerability = 30
Monn.status = "Peace"
Monn.enemy = ["None"]
Monn.ally = ["Pyu Cities", "Funan"]
#Initialize Funan
Funan = Faction.new
Funan.taxes = 32
Funan.vulnerability = 34
Funan.status = "Peace"
Funan.enemy = ["None"]
Funan.ally = ["Pyu Cities", "Monn Cities"]
#Initialize Mauretania
Mauretania = Faction.new
Mauretania.taxes = 43
Mauretania.vulnerability = 32
Mauretania.status = "Peace"
Mauretania.enemy = ["None"]
Mauretania.ally = ["Senate of Rome"]
#Initialize Thracia
Thracia = Faction.new
Thracia.taxes = 32
Thracia.vulnerability = 21
Thracia.status = "War"
Thracia.enemy = ["Senate Of Rome"]
Thracia.ally = ["None"]
#Initialize Sarmatian Confederacy
Sarmatia = Faction.new
Sarmatia.taxes = 100
Sarmatia.vulnerability = 32
Sarmatia.status = "Peace"
Sarmatia.enemy = ["None"]
Sarmatia.ally = ["Bosporan Kingdom"]
#Initialize Galatian Confederacy
Galatia = Faction.new
Galatia.taxes = 53
Galatia.vulnerability = 21
Galatia.status = "Peace"
Galatia.enemy = ["None"]
Galatia.ally = ["Senate Of Rome"]
#Initialize Pontus Kingdom
Pontus = Faction.new
Pontus.taxes = 121
Pontus.vulnerability = 32
Pontus.status ="War"
Pontus.enemy = ["Senate Of Rome", "Cappadocia", "Armenia"]
Pontus.ally = ["Colchis", "Iberia"]
#Initialize Cappadocia
Cappadocia = Faction.new
Cappadocia.taxes = 34
Cappadocia.vulnerability = 23
Cappadocia.status = "War"
Cappadocia.enemy = ["Senate Of Rome", "Pontus Kingdom", "Armenia", "Osroene"]
Cappadocia.ally = ["None"]
#Initialize Bosporan Kingdom
Bospora = Faction.new
Bospora.taxes = 56
Bospora.vulnerability = 34
Bospora.status = "Peace"
Bospora.enemy = ["None"]
Bospora.ally = ["Sarmatian Confederacy"]
#Initialize Colchis
Colchis = Faction.new
Colchis.taxes = 32
Colchis.vulnerability = 25
Colchis.status = "War"
Colchis.enemy = ["Iberia"]
Colchis.ally = ["Pontus Kingdom"]
#Initialize Iberia
Iberia = Faction.new
Iberia.taxes = 24
Iberia.vulnerability = 34
Iberia.status = "War"
Iberia.enemy = ["Colchis", "Armenia", "Albania"]
Iberia.ally = ["Pontus Kingdom"]
#Initialize Armenia
Armenia = Faction.new
Armenia.taxes = 54
Armenia.vulnerability = 24
Armenia.status = "War"
Armenia.enemy = ["Pontus Kingdom", "Cappadocia", "Iberia", "Albania", "Media"]
Armenia.ally = ["None"]
#Initialize Albania
Albania = Faction.new
Albania.taxes = 24
Albania.vulnerability = 34
Albania.status = "War"
Albania.enemy = ["Iberia", "Armenia", "MEdia", "Parthian Empire"]
Albania.ally = ["None"]
#Initialize Media
Media = Faction.new
Media.taxes = 134
Media.vulnerability = 24
Media.status = "War"
Media.enemy = ["Parthian Empire", "Armenia", "Albania"]
Media.ally = ["None"]
#Initialize Osroene
Osroene = Faction.new
Osroene.taxes = 99
Osroene.vulnerability = 29
Osroene.status = "War"
Osroene.enemy = ["Parthian Empire"]
Osroene.ally = ["Senate Of Rome", "Mascat"]
#Initialze Mascat
Mascat = Faction.new
Mascat.taxes = 101
Mascat.vulnerability = 30
Mascat.status = "Peace"
Mascat.enemy = ["None"]
Mascat.ally = ["Senate Of Rome", "Osroene"]
#Initialize Jerusalem
Jerusalem = Faction.new
Jerusalem.taxes = 204
Jerusalem.vulnerability = 49
Jerusalem.status = "War"
Jerusalem.enemy = ["Nabatene"]
Jerusalem.ally = ["Senate Of Rome"]
#Initialize Nabatane
Nabatane = Faction.new
Nabatane.taxes = 124
Nabatane.vulnerability = 21
Nabatane.status = "War"
Nabatane.enemy = ["Jerusalem", "Egypt"]
Nabatane.ally = ["None"]
#Initialize Egypt
Egypt = Faction.new
Egypt.taxes = 1354
Egypt.vulnerability = 32
Egypt.status = "War"
Egypt.enemy = ["Mascat", "Kush Kingdom"]
Egypt.ally = ["Senate Of Rome"]
#Initialize Kush Kingdom
Kush = Faction.new
Kush.taxes = 345
Kush.vulnerability = 24
Kush.status = "War"
Kush.enemy = ["Egypt", "Aksum Kingdom"]
Kush.ally = ["None"]
#Initialize Aksum Kingdom
Aksum = Faction.new
Aksum.taxes = 124
Aksum.vulnerability = 29
Aksum.status = "War"
Aksum.enemy = ["Egypt", "Kush Kingdom", "Himyarites"]
Aksum.ally = ["None"]
#Initialize Himyarites
Himyarites = Faction.new
Himyarites.taxes = 98
Himyarites.vulnerability = 32
Himyarites.status = "War"
Himyarites.enemy = ["Aksum Kingdom"]
Himyarites.ally = ["None"]
#Initialize Garamentes
Garamentes = Faction.new
Garamentes.taxes = 34
Garamentes.vulnerability = 25
Garamentes.status = "War"
Garamentes.enemy = ["Senate Of Rome"]
Garamentes.ally = ["None"]
#Initialize Teotihuacan
Teotihuacan = Faction.new
Teotihuacan.taxes = 34
Teotihuacan.vulnerability = 19
Teotihuacan.status = "War"
Teotihuacan.enemy = ["Totonac", "Maya"]
Teotihuacan.ally = ["Tarascan", "Mixtec", "Zapotec"]
#Initialize Tarascan
Tarascan = Faction.new
Tarascan.taxes = 120
Tarascan.vulnerability = 20
Tarascan.status = "War"
Tarascan.enemy = ["Totonac", "Maya"]
Tarascan.ally = ["Teotihuacan", "Mixtec", "Zapotec"]
#Initialize Totonac
Totonac = Faction.new
Totonac.taxes = 90
Totonac.vulnerability = 30
Totonac.status = "War"
Totonac.enemy = ["Tarascan", "Teotihuacan", "Maya", "Mixtec", "Zapotec"]
Totonac.ally = ["None"]
#Initialize Maya
Maya = Faction.new
Maya.taxes = 121
Maya.vulnerability = 20
Maya.status = "War"
Maya.enemy = ["Tarascan", "Teotihuacan", "Totonac", "Mixtec", "Zapotec"]
Maya.ally = ["None"]
#Initialize Mixtec
Mixtec = Faction.new
Mixtec.taxes = 57
Mixtec.vulnerability = 30
Mixtec.status = "War"
Mixtec.enemy = ["Maya", "Totonac", "Zapotec"]
Mixtec.ally = ["Tarascan", "Teotihuacan"]
#Initialize Zapotec
Zapotec = Faction.new
Zapotec.taxes = 103
Zapotec.vulnerability = 27
Zapotec.status = "War"
Zapotec.enemy = ["Maya", "Totonac", "Mixtec"]
Zapotec.ally = ["Tarascan", "Teotihuacan"]

#Initialize

event = nil

if Input.press?:)C) == true
  Time_Check1
end
#Diplomacy Eventer
#Set Cycle for Event to every 7 days
def Diplomacy_Eventer
if Input.press?:)C) == true or event == nil
  event = true
end
if event == true
  SenateOfRome.diplomacy = rand(SenateOfRome.vulnerability - 100)
  Dacia.diplomacy = rand(Dacia.vulnerability - 100)
end
p SenateOfRome
p Dacia

end

#Diplomacy for Senate of Rome
if event == true
  if SenateOfRome.diplomacy >> 10
    if Dacia.diplomacy <= 10
      SenateOfRome.enemy = "Dacia"
      Dacia.enemy = "Dacia"
      SenateOfRome.status = "War"
      Dacia.status = "War"
    else
      SenateOfRome.enemy = "None"
      SenateOfRome.status = "Neutral"
    end
  end
event = nil
end
p SenateOfRome
 
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
If you go as far as creating classes for that, then yes, at least it will be easier to read. :)

a structure like 

class Faction # your super class that handles the Faction IDs and all the math you have in mind to control the neutrality/hostility of each faction.

then

class Town < Faction # to handle your town and their math of neutrality/etc/etc.

And a final class/module to manage all the informations in real time

module FactionManager

or simply do that last part in Scene_Map/Game_Map

and while you are at it, add a few window classes and a new scene class to show those informations will be easier than trying to add more windows into the current packed menu scene.

Then add a new handler to Scene_Menu.. umm.. i think it's done in the window side, can't remember the name.. Windows_MenuCommand or something like that. Add a new handler there and you should be able to get a new choice to your menu to show your new scene with all the faction informations.
 
Last edited by a moderator:

chungsie

Veteran
Veteran
Joined
Sep 9, 2015
Messages
656
Reaction score
857
First Language
English
Primarily Uses
N/A
the tutorials I watched and read on modules said that information passed to the module, gets destroyed at the end of the module. so it wouldn't effect outside the module. a person that made a lot of tutorials is helping me come up with script for the window display and such.

the information you provided on structure is helpful, but I have issues with the scripting of things. when I make class Faction_Init or even Init_Faction, and declare the settings for each faction as a Faction.new and later pass the information to another part of the script, it says uninitialized object.

I attached a flow chart based on what you said.

I have no idea how to make a time section of the script. I want diplomacy to happen every 7 days in game time. and I don't know much about that, I figure that's where some eventing could help. but I also don't know how to call the script. I imagine the varibale init wold need to be a global vairable, but not sure how to assign in script or manipulate outside the script.

but I think I'm off to a good start.

And again, thank you so much for being of help. I've really only programmed in QBasic, and its sorta similar, but different in what it can do.

Flow-Chart-Diplomacy.png
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
Nope, when it comes to class, don't try to think everything as one. Separate them up in stand alone parts that works on their own.

And i am not sure what you are trying to do with all those .new when you don't even have the class to call readied. 

To init your faction class, do something like this:

class Factiondef initialize your codes hereendendthen when you need to include the class into a variable (eg. in a module)

use something like:

@faction = Faction.newAnd if you want those informations to be saved in a save file.

You need to add your super class into DataManager both for saving/loading.

And it might just be easier if you declare class Faction as a global variable there.

eg

$Faction = Faction.new

So next time when you need to call for something in class Faction, use $Faction.XXXXX will do.

and to be able to read/write into the variables in that class, you will need to include the variables you need to use inside class Faction to the attr headers inside that class.

And when it comes to Towns inside the factions.. or you prefer to call it habitants.. 

class Habitants < Factionyour code hereendThis will make class Habitants the child class of class Faction, so what class Faction has, class Habitants can get an access to those infos/methods without the need to include class Faction in a new variable.

Then come your final class that updates with the game

class FactionManage  def initialize    your code here  end  def math_for_hostilities    your math here  end  def condition?    your condition here  end  def update    put all the methods you want to update here  endendConsider the windows and the new scene as a SEPARATE PROJECT. Those have nothing to do with these 3 classes except asking for informations to show.
 

chungsie

Veteran
Veteran
Joined
Sep 9, 2015
Messages
656
Reaction score
857
First Language
English
Primarily Uses
N/A
so for

class Faction
def Initialize
SenateOfRome
end
end
would that allow the creation of SenateOfRome=Faction.new?

the way I have it now, I use

class Faction

some code

end

then I do

SenateOfRome = Faction.new

and assign the values of Rome underneathe.

It works so far in testing.


having habitants as a seprate class would allow for more details later on I think. such as the owner of the town/city/village, population happiness, and such.

I think there should be another class child of Faction, that is for trade. or should I do that on another script at a later time?
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
both faction and habitants should only contains the methods/variables needed to process the game later.

so

class Faction attr_accessor :Rome attr_accessor :Maya  def initialize    @Rome = []    @Maya = []  endendand when you need to change/read/add the data from.. say.. Rome:

Faction.Rome will call up that variable.

-------

Trade is more to the shop script so it really has nothing to do with how the faction functions. consider that a new project.

but if you have things like.. lumber/ore etc, resources that the player can trade in each village/town..

Those should be listed down in the habitant class i think, depends on how you want them to be accessed.

Managing the resources (eg plus minus as time goes) will be done in the manage class.

Umm...i am assuming you try to do something like Travian with that suggestion. :p

Sleepy head here so might not be thinking straight :$
 

chungsie

Veteran
Veteran
Joined
Sep 9, 2015
Messages
656
Reaction score
857
First Language
English
Primarily Uses
N/A
Your method for handling factions seems like it would get messy.

I've had all of about 5 cups of coffee so far. BD

also, I confused method with module.

how would I make a module for faction management?
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
eg:

module FactionManger ROME = "example" ROME1 = "example2" ROME2 = "example3"  def self.init    your code here  endendto get the data out side of the module, use:

eg:

Code:
FactionManger::ROME2
 

chungsie

Veteran
Veteran
Joined
Sep 9, 2015
Messages
656
Reaction score
857
First Language
English
Primarily Uses
N/A
how would that help with the script?
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
Well, i am not sure how you want your script to be done.

As far as i can tell, most script writers use module to mange the data needed for the process (not the calculation).

eg, Set up a few important variables that might need to be changed in the future. Link a script variable with a game variable so the users can change them as they like. etc etc. Data management.

And i am not sure what you meant about messy too, it's up to you to make the methods for faction management, i am only showing you how to manage the class and data. You need to get those variables saved or you will end up with a reset every time your user loads a save file.
 

chungsie

Veteran
Veteran
Joined
Sep 9, 2015
Messages
656
Reaction score
857
First Language
English
Primarily Uses
N/A
if I am correct, by adding $ to the begining of the variables, like $SenateOfRome; I made them global. so they should save.

the tutorial I read on classes said you declare the values of the class, then do something like SenateOfRome = Faction.new and if you need a child class, you do something like Habitation < Faction.

so did I correctly do what I needed to as far as creating a means for handling faction information? so far?
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
$ only set it up as a global variable that can be called anywhere using $NAME.

And depending on where you set it, a global variable won't be reset from using the game built-in reset [F12] key or even "return to title" call. That means, the variable stay up whether or not the user save/load and only disappear when the game is closed.

And no, it won't be saved in a save files unless you include it in the DataManager save/load method. Unless you save it as a global save file yourself then that's a different story.
 

chungsie

Veteran
Veteran
Joined
Sep 9, 2015
Messages
656
Reaction score
857
First Language
English
Primarily Uses
N/A
well I have been told all kinds of ways that I need to do something to save the variables. how do I do that?
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
184
First Language
Meowish
Primarily Uses
include it in the DataManager save/load method
Edit:

Or you can include them in one of those classes that get saved. eg. Game_Party

OR you can make your own new save file to save it separately, depending on how you want your save/load to work.
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,049
Messages
1,018,547
Members
137,835
Latest member
yetisteven
Top