Jump to content


Photo

How to: Learn Skills based on Job and Level requirements ?


  • This topic is locked This topic is locked
16 replies to this topic

#1 Saphirweapon

Saphirweapon

    Member

  • Ace Member
  • 13 posts

Posted 30 October 2012 - 04:03 AM

Well as this is my first post on this forums, a friendly hello to everyone first : )

Now to my question:

Im in the progress of creating a Final Fantasy XI like skill system where charakters (that can have a variety of 8 selectable different jobs) learn new skills through the use of certain scrolls (items). My idea to do this is creating some item that calls a common event. In the common event there have to be 3 things happen: 1. check if the one that is using the item meets the job requirement; 2. check if he meets the level requirement and if the conditions before are complied 3. learn the skill.

If i have only one character this is easy to do and i got it working as intended. If however there are more possible characters i cant imagine how to do this in some elegant way. Is there a way to avoid having to write the common event to check all 8 charakters for there job and there level (what makes 64 possibilities in total) or is it possible to tell the game only to check the users conditions ? If i could do this, i also would not have the problem i got when 2 charakters meet the requirements at the same time (as checking all 8 characters for jobs and levels would learn the skill to both of them).

If there is a script or something that could do this in some more comfortable way, i did not find it through my search or my imagination wasnt good enough what that script can do. So any help with this would be appreciated.

#2 Tsukihime

Tsukihime

    Advanced Member

  • Ace Member
  • 6,377 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 30 October 2012 - 09:35 AM

I would do it like this:

1. add a common event effect using this script: http://www.rpgmakerv...vator-outdated/ (actually I might have to modify this script to better handle common event arguments)
2. Use this script to setup common event arguments: http://www.rpgmakerv...vent-arguments/
3. And then in your common event, you would make conditional checks using the common event arguments.

For example,
In step 1, you would call a specific common event (eg: 4).
In step 2, you would store the user's ID as well as the user's class ID as common event arguments (eg: [user.id, user.class.id]
In step 3, you would use a conditional branch

if $game_temp.cevent_args[1] == 3 # Soldier class ID
  $game_actors[$game_temp.cevent_args[0]].learn_skill( ... )

Of course this is not very nice to type...

Edited by Tsukihime, 30 October 2012 - 09:35 AM.

My Scripts. Go here for Bugs and Requests.
Want to write a tutorial? Submit a community tutorial!

himeworks011.png

Like on Facebook: HimeWorks
Follow me on Twitter for the latest updates! @HimeWorks

#3 Saphirweapon

Saphirweapon

    Member

  • Ace Member
  • 13 posts

Posted 30 October 2012 - 09:47 AM

Well thanks a lot for your reply first. If some experienced coder like you give me such a "still not easy to do" solution (from my beginners point of view), i think the problem cant be handled more easily and comfortable as i had hoped. I will give your hint a try and see if i can get it to work. Thanks again.

#4 Tsukihime

Tsukihime

    Advanced Member

  • Ace Member
  • 6,377 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 30 October 2012 - 10:00 AM

cant be handled more easily and comfortable


Sure there are other ways to do it with some clever event
Suppose you have two actors Eric and Natalie, and three common events.

Common event 1:
set variable 1 = eric's actor ID (1)
set variable 2 = eric's class ID
set variable 3 = skill ID to learn
call common event 3

Common event 2:
set variable 1 = natalie's actor ID (2)
set variable 2 = natalie's class ID
set variable 3 = skill ID to learn
call common event 3

Common event 3:

if variable 2 == ?
   script_call: $game_actors[variable 2].learn_skill(variable 3)

Actually you know what I will write something to make this easier later.

Edited by Tsukihime, 30 October 2012 - 10:03 AM.

My Scripts. Go here for Bugs and Requests.
Want to write a tutorial? Submit a community tutorial!

himeworks011.png

Like on Facebook: HimeWorks
Follow me on Twitter for the latest updates! @HimeWorks

#5 Saphirweapon

Saphirweapon

    Member

  • Ace Member
  • 13 posts

Posted 30 October 2012 - 10:29 AM

Actually you know what I will write something to make this easier later.


That would be nice. Its not that im not willed to work me into something (i havent bothered to modify scripts myself except replacing some translations). But when over hundred skills need to be written any short way to do it is a big help especally when it comes for troubleshooting later on.

#6 Tsukihime

Tsukihime

    Advanced Member

  • Ace Member
  • 6,377 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 30 October 2012 - 10:40 AM

You will probably still have to make 100's of items for each skill though, although they would call the same common event.
My Scripts. Go here for Bugs and Requests.
Want to write a tutorial? Submit a community tutorial!

himeworks011.png

Like on Facebook: HimeWorks
Follow me on Twitter for the latest updates! @HimeWorks

#7 Saphirweapon

Saphirweapon

    Member

  • Ace Member
  • 13 posts

Posted 30 October 2012 - 10:48 AM

You will probably still have to make 100's of items for each skill though, although they would call the same common event.


Creating a few hundred database entries for items, skills and gear is not the problem , even if it is a lot work. And im aware that i still will have to create one item for every skill to learn : )

Edited by Saphirweapon, 30 October 2012 - 10:49 AM.


#8 Tsukihime

Tsukihime

    Advanced Member

  • Ace Member
  • 6,377 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 30 October 2012 - 06:52 PM

Here, try this: http://www.rpgmakerv...2-common-event/
I simply combined everything up there into one script.

This is a special common event call that allows you to store the person that called the event, the target (because you are likely going to use an item on someone), the item that was used, as well as some arguments.

So for example, if you use the a book on someone, your target will be the person that you want to check (if you use it on yourself, then target == user)

In your case, you would pass in the ID of the skill that you want to learn.
So suppose your learning common event was 4, and you wanted to learn skill 9, with a class ID requirement of 2.

You would tag your item with

<eff: common_event 4 9 2>

(order of arguments does not matter as long as you remember which order you put them)

Then in your common event you would use a conditional branch

$game_temp.event_target.class.id == $game_temp.event_args[1]

And then if that is true, you would use a script call

$game_temp.event_target.learn_skill($game_temp.event_args[0])

If you want level requirements you just need to check the level as well.

Edited by Tsukihime, 30 October 2012 - 07:01 PM.

My Scripts. Go here for Bugs and Requests.
Want to write a tutorial? Submit a community tutorial!

himeworks011.png

Like on Facebook: HimeWorks
Follow me on Twitter for the latest updates! @HimeWorks

#9 Saphirweapon

Saphirweapon

    Member

  • Ace Member
  • 13 posts

Posted 31 October 2012 - 04:39 AM

Thanks a lot for your work : )

So i copied the two scripts and taged some item as described. Also copied the two other lines into some Conditional branch. When now using the item i got the following error message: Script "Common Event" Line 98: NoMethodError occured. undefinded method "map" for 0.0 Float

So i guess i missed something ?

#10 Tsukihime

Tsukihime

    Advanced Member

  • Ace Member
  • 6,377 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 31 October 2012 - 05:32 AM

Oops, item_effect_common_event is already reserved for the default method.

I changed the script to use the tag "common_evt" instead of "common_event"
My Scripts. Go here for Bugs and Requests.
Want to write a tutorial? Submit a community tutorial!

himeworks011.png

Like on Facebook: HimeWorks
Follow me on Twitter for the latest updates! @HimeWorks

#11 Saphirweapon

Saphirweapon

    Member

  • Ace Member
  • 13 posts

Posted 31 October 2012 - 05:46 AM

Ok so i updated the script and changed the item tag to common_evt followed by the arguments 1 (common event 1) 4 (skill 4) 2 (class 2). If now using the item it gives me the error: Script "Game_Interpreter" line 1411: ArgumentError occured. wrong Number of arguments (0for1)

#12 Tsukihime

Tsukihime

    Advanced Member

  • Ace Member
  • 6,377 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 31 October 2012 - 05:48 AM

That might be an issue in your common event.
My Scripts. Go here for Bugs and Requests.
Want to write a tutorial? Submit a community tutorial!

himeworks011.png

Like on Facebook: HimeWorks
Follow me on Twitter for the latest updates! @HimeWorks

#13 Saphirweapon

Saphirweapon

    Member

  • Ace Member
  • 13 posts

Posted 31 October 2012 - 05:56 AM

Could you maybe post some picture how the common event is supposed to look like so that i can compare it with mine ? Im sure its some simple mistake from a wrong understanding from me how to use the calls

#14 Tsukihime

Tsukihime

    Advanced Member

  • Ace Member
  • 6,377 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 31 October 2012 - 09:41 AM

I won't have access to RM until 10 hours later.

Just do simple tests by printing out each reference

p $game_temp.event_target
p $game_temp.event_target.class.id
p $game_temp.event_args[1]

...

And you should see in your console the appropriate values.
And if one of them isn't printing out then you know there is an issue there.

Edited by Tsukihime, 31 October 2012 - 09:41 AM.

My Scripts. Go here for Bugs and Requests.
Want to write a tutorial? Submit a community tutorial!

himeworks011.png

Like on Facebook: HimeWorks
Follow me on Twitter for the latest updates! @HimeWorks

#15 Saphirweapon

Saphirweapon

    Member

  • Ace Member
  • 13 posts

Posted 02 November 2012 - 08:53 AM

I won't have access to RM until 10 hours later.

Just do simple tests by printing out each reference

p $game_temp.event_target
p $game_temp.event_target.class.id
p $game_temp.event_args[1]

...

And you should see in your console the appropriate values.
And if one of them isn't printing out then you know there is an issue there.


Well i`m sorry but as a beginner i dont know how to work with a console and i couldnt find something about this the last minutes.

A picture of the common event how it is supposed to look like would be the best help. Thanks in advance for it : )

#16 Tsukihime

Tsukihime

    Advanced Member

  • Ace Member
  • 6,377 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 02 November 2012 - 09:13 AM

You should learn how script calls work.

Posted Image

If you get a new copy of the common event effect plugin you can shorten some of the things to this:

Posted Image

Edited by Tsukihime, 02 November 2012 - 09:38 AM.

My Scripts. Go here for Bugs and Requests.
Want to write a tutorial? Submit a community tutorial!

himeworks011.png

Like on Facebook: HimeWorks
Follow me on Twitter for the latest updates! @HimeWorks

#17 Saphirweapon

Saphirweapon

    Member

  • Ace Member
  • 13 posts

Posted 02 November 2012 - 10:56 AM

Thank you very much, i think watching at this example makes it easier to get into this and to adept if for own things




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users