Hi!
I run into a problem recently.
What I want to do:
A party learns some skills.
Now they run into an event that gives them some kind of amnesia and they forget 2 random skill.
So basically I want the script to check if they have 2 skills (else something different happens)
If they have 2 or more skills (condition) I want the script to forget 2 random skills they possess
I have done something similar with items where random items get stolen. But I cant wrap my head around skills.
That is because skills aren't learned by a party, they're learned by actors. And each actor can have a different list of skills or the same.
You have to check for each actor in the party independently, then it works similiar.
Hmm...
then the problem has just become a bit bigger as I have 4 different actors (you choose 1 at the start of the game) but only one of them is in the party for the whole game (and it stays a party of 1)
So I cant use the actor ID because if you play with actor 2 and I use the ID 1 to check for skills it would still check actor ID1 and not the actor that is actually played (2).
Also I have only found scripts that check for items, and no script that checks for skills.
For most of the time using the call script funktion, google was my best friend. But here he fails me 🙁
Ok.
My actors learn skills randomly as part of events.
Basically it looks like this:
$game_actors[4].learn_skill($game_variables[93])
variable 93 gives me a random number that translates in a random skill id
I dont care if the actor gets a skill double (so he gets nothing) as this is part of the game.
However if he loses a skill he should lose a skill he actually has.
I can't just do the same as I do not want him to roll a skill to forget the actor doesnt posess.
So I dont only need to check how many skills the actor has, but also which skill IDs he has learned and randomize only between these IDs
I can do that with items just fine
(random item in your inventory gets stolen)
$game_party.lose_item($game_party.items.sample, 1)
but I cant get it to work with skills.
Well that is a bit more difficult then I imagined, lol. I'm just spitballing here (so sorry if it seems like I'm rambling) since I haven't had a lot of experience with this sort of thing , but could you use a variable or switch of some sort that is basically a pointer for the skill? For example, when you apply "random skill", you are using 94 skills [0-93], correct? So somehow the game picks skill [27] and knows that [27] is skill "Double Attack" (for example). Could you make it so when a skill is activated, it checks which skill it just activated and turns on a corresponding switch/variable? Then, when you go to lose a skill, have it check which variables/switches are ON, and turn off 2 of them?
This may be exactly what you are asking (I noticed after re-reading your original post, I thought you were looking for ideas on how to do it in a script). Man, I don't know how to do it unless you want a LOT of conditional branches. I mean, if you don't want it to randomly turn off 2 skills, it's easy, but then you run the risk that they may not have learned those 2 specific skills. I'm afraid in the long run I haven't helped. 🙁
I think this is beyond my capabilities, so good luck with this. Hope you can figure out or find what you need! Sorry I couldn't help.
No Problem...
I got a lot of work to do before it really needs to be adressed but I like to act in time so I can go on without sitting for weeks without a solution.
is there no command like
$game_party.items.sample
that adresses skills instead of items?
so, wait you want it to delete a random skill from a random actor in the party? not just a single actor, correct?
ok, heres a few more suggestions, not sure entirely how you want to calculate who to remove skills from. but heres a few ways to do it.
first, removing a skill from the actor your currently playing as.
#find this line in the script Game_Party
attr_reader :last_item # for cursor memorization: item
directly below it place this.
attr_reader :actors # for party members
#this will let you read actors in your current party.
now that that's done, you can use in a script call in conditional branch to check if this actors skill size is bigger than 2.
#this will ensure that it reads the first actor in the party aka the player.
$game_actors[$game_party.actors[0]].skills.size >= 2
or you can use the following to return a random actor in the party(use same method above to check if skill size is bigger than 2).
providing you added actors as readable in your Game_Party script, this will return a random actor currently in your party.
randomId = rand($game_party.actors.size)
$game_actors[randomId]
also just tested my first post doesn't work, but this does.
#depending on which method above you use actorId will vary.
actorId = $game_party.actors[0]
#once we have the actor id we get a random skill from this actor.
skill = $game_actors[actorId].skills[rand($game_actors[actorId].skills.size)].id
#then we forget it! 😀
$game_actors[actorId].forget_skill(skill)
hope this helps ^_^
<3
Thank you, you people are awesome!