playMaker

Author Topic: Skill system question  (Read 4451 times)

tester

  • Playmaker Newbie
  • *
  • Posts: 31
Skill system question
« on: September 02, 2012, 05:14:30 PM »
Hi, I come from a programmer background. I wonder how to implement the following system with playmaker.

Lets say PlayerA has skill1, skil2, skill3.
Skill1 increase health for 1 second.
Skill2 increase attack for 2 second.etc.


All the skill can all be used at once. How should that be implemented with fsm?

Sjones

  • Full Member
  • ***
  • Posts: 203
Re: Skill system question
« Reply #1 on: September 02, 2012, 06:03:28 PM »
im kinda new but my first thought is to have a global event trigger, to trigger skill 1, 2 and 3 seperatly but the firing state will continuously run. allowing for all 3, maybe have a check to make sure it is not already in use etc.

tester

  • Playmaker Newbie
  • *
  • Posts: 31
Re: Skill system question
« Reply #2 on: September 02, 2012, 06:55:46 PM »
hum..
Thanks for you reply. But there is a problem in it.


1) How would you automatically trigger the remove event the SkillA or B  after X second?

I assume you use the "wait" function, which will course a problem.

FSM:
*SkillA--> enabled --> wait 1 second ---> Cancel event -->SkillA --> disabled
                                    |
                                    v
                                  *SkillB --> enabled -->wait 2 second -->Cancel event-->SkillB --> disabled




Uttpd

  • Junior Playmaker
  • **
  • Posts: 70
Re: Skill system question
« Reply #3 on: September 02, 2012, 07:17:37 PM »
ThereĀ“s a lot of unknowns like how do you "use" or how to your health/ attack works.

Assuming health is a global Int variable (being it  numbers  seconds or the X part of a vector3 etc) you can simple increase your health by performing plus or multiply operations from any other game object/ fsm then you can destroy/ deactivate your skill ( the game object that holds it) or set the variable to 0, whatever works best.

tester

  • Playmaker Newbie
  • *
  • Posts: 31
Re: Skill system question
« Reply #4 on: September 02, 2012, 07:24:32 PM »
Thanks for reply Uttpd.

Activating the skill is not a problem, but my main problem is that how you would deactivate your skill.
Which you didnt answer yet.

Sjones

  • Full Member
  • ***
  • Posts: 203
Re: Skill system question
« Reply #5 on: September 02, 2012, 07:33:15 PM »
basicly the way I see it is

Skill A )
Skill B )
Skill C )

this is in one state, coninously running, on button x,y,z press etc

on the button that is asigned to skill (or click or what ever) till then send a global event trigger

in another FSM and in another state have the skill function (update health, extra speed, blow self up etc)

now you can either have a check in the skill activation state that says if time before last activation is less than a second then dont trigger

alternatively have a bool action in the skill state that checks a bool to see if it is active, if so do nothing, if not do actions, at the begining of the script have bool turned on, do script, then wait 1 second then bool of and send event to finish it.

Uttpd

  • Junior Playmaker
  • **
  • Posts: 70
Re: Skill system question
« Reply #6 on: September 02, 2012, 07:42:55 PM »
yep, the key here is to use multiple FSM and not trying to make it all in one.
Following the scheme you post up It would work if the skils are individual FSM so the Skill A FSM can go thru all the states independently from other skills

tester

  • Playmaker Newbie
  • *
  • Posts: 31
Re: Skill system question
« Reply #7 on: September 02, 2012, 08:04:13 PM »
Multiple FSM should work, but like if 1 FSM for each skill that sounds too many.

It is an ios game. Because 1 game character has about ~5 skills, and there would be total of about ~10 characters(including your team members and enemy) within the game.
5 skills *10 characters = 60 FSM ?


That sounds too many FSM just for skills.
And Does anyone know about the overhead problem.

Sjones

  • Full Member
  • ***
  • Posts: 203
Re: Skill system question
« Reply #8 on: September 02, 2012, 08:30:07 PM »
in witch case forget about the wait timer, have a timer compare, there is a function (cant remember what it is called right now or even if it is in playmaker, think I read it on the unity website) that gets the time in seconds from the game started.

Use this to update a int with the current time, on script activation do a check to see if the current time is +1 (for one second) from the last time that script was run, if it has then continue state, otherwise go back to the begining and wait for next input, problem then occures when u got multiple inputs at the exact same time ( I think anyhow)

tester

  • Playmaker Newbie
  • *
  • Posts: 31
Re: Skill system question
« Reply #9 on: September 02, 2012, 08:52:52 PM »
good idea.