Random Factor

Started by Vexus, January 16, 2015, 08:50:35 am

Previous topic - Next topic

Vexus

I don't know if anyone of you plays or know of the game town of salem but this thread has something to do with it.

I'm experimenting on trying something similar but vs AI in rpg maker xp.

So far I created:
- A random event that picks what house you start in AND what character you are.
- Another event that picks what role you are from a selected few.

Spoiler: ShowHide

Spoiler: ShowHide


Now the tedious part:
- I am creating an event so the AI get their roles picked depending on what you get.

Spoiler: ShowHide


There will be 3 modes:

Easy - 4 people.
Normal - 6 people.
Hard - 8 people.

As you can see, the AI part is not complete yet because I haven't figured out yet how to be able to randomise the remainder 3 roles for the 3 other AI. Once I complete that part, I will have an easier way for the other modes that have more people in them.

Any idea on how to make it?

Thanks
Current Project/s:

Zexion

Uh, why can you not just random the AI roles? Will there be a difference in the difficulty of the AI or what?

Vexus

The difficult thing is:

You have 1 random variable that picks a number from 1 to 3.
Then you have another random variable that picks a number from 1 to 3.

The first one picks one of the random roles, the second one picks one of the AI available.

The "problem" is giving the other AI the remaining roles.

The only way I can think is making a HUGE event, consisting with 3-6 variables or instead of being totally random I could make if variable is 1, AI 1 is X, AI 2 is Y and AI 3 is Z.
Current Project/s:

Zexion

I think i understand what you mean, but you can't shortcut this without using the script call alot.

Step 1:
We're going to need a list of the roles available to the AI and Player. For this create an array, I'll use variable ID 1.
$game_variables[1] = [0,1,2,3,4,5]

The array now holds 6 numbers (0-5) that represent the roles available.


Step 2:
Now use a random number generator again, but a scripted one.
size = $game_variables[1].size
role = rand(size)
$game_variables[2] = role
$game_variables[1].delete_at(role)

So, what this will do, is create a random number from 0-5 (in this case) and assign it to variable ID 2. Then it will delete that role from the list.


Step 3:
All that's left to do is assign the role that we got from the code above. Which you can do through a typical event branch.
@> Control Variables : [0003 AI_1 ROLE] = Variable [0002: ROLE ASSIGNMENT]


So to do this for all the computers, you could just copy and paste this exact process and change the assignment at the end or create a page for each one to keep it neat. The easiest way would be to loop it, but you would at least need to tell me your event IDs to do this.

Vexus

January 16, 2015, 12:29:08 pm #4 Last Edit: January 16, 2015, 12:32:46 pm by Vexus
Problem is I'm not good with scripting.

I studied basic java and such and know what an array is but that is far as I go. Ruby is not exactly similar as java that's why I was trying to do it event wise.

By event IDs you mean the events that are going to be the actual people other than you right?

If yes, they are:

Event ID: 003
Event ID: 005
Event ID: 006
Event ID: 007

Have to remember that one of them will be taken by the player.

My fear with events is that something might get skipped if I overdo it. That was a problem I had in somnium. I tried to make a dynamic map with every npc in the map having stuff to do for the whole day (Dialogue with other NPCs, moving and going into other houses, etc) and when it's night time they go all to their respective houses and sleep.

That map was plagued with many problems. Sometimes, it would work flawlessly, other times, some step would get skipped and halts an npc.
Current Project/s:

Zexion

Uhm, you are aware of the script call right? In the events dialogue? Because other than that I literally gave you the exact code to put in there :b You just need to replace variable ID's
And by 'Event IDs' I meant variables and switches being used by the events. Sorry lol, I thought that would be confusing but i was too lazy

Vexus

Yea I am aware of the script call.

Been a while since I used the rpg maker so forgive me :)

Variables are all listed in the 3 pictures in the first post as for switches so far there's from 5 till 20 used (4 for the available roles, 4 for the roles but for the npcs, 4 for the player choice and 4 for all npcs).
Current Project/s:

KK20

https://dl.dropboxusercontent.com/u/58874459/Town%20of%20Salem.zip

Talk to red button to reassign roles.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

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

Join the CP Discord Server!

Vexus

January 16, 2015, 03:10:40 pm #8 Last Edit: January 17, 2015, 07:02:49 am by Vexus
Woah, thanks!

I'll check it out and see how can I make it work so I will know what to change for the player (You) itself.

[Edit]

Since I don't know if double posting is allowed, I'll edit this post instead.

I tried to understand the demo KK20 but there is a fundamental problem with it. With no direct identification between each npc event, I would still require to add switches so that I could keep on adding dialogue etc to each npc depending on what happens during the game.

I opted to do it via an event:

Spoiler: ShowHide


It doesn't work if I put it in parallel process but autorun works fine. This way, via events I also had to put 4 pages for each role the player you control gets while also switching the roles depending on which npcs are free to be used. I also had to add new switches as I couldn't find an easier way to make each npc have their respective event page depending on what role they get.

I added a message just like you did in my project to test each npc and restarting the game numerous times to see any hiccups but since these events are a one time thing at the start, they won't interfere with the next random events I am going to have to add. (To see who the npcs target during the night and what is their dialog)

This is going to be interesting for sure.
Current Project/s: