playMaker

Author Topic: Actions [Solved]  (Read 4686 times)

shinodan

  • Full Member
  • ***
  • Posts: 180
    • Shinozone
Actions [Solved]
« on: January 08, 2015, 06:10:12 AM »
Its been a while since ive been active here, been busy with RL, working and raising children lol.

Recently i have made a return to unity and playmaker but since being away ive been making Bots for websites with javascript front end and backend, so i have a little more experience with it now.

Here is a screenshot of my scene, im using a 2D Jump and run framework that handles player health and much more.



What im looking to do is retrive the amount of health the player has and store it in a float, for which i need to write an action so i can store this value globally or in an fsm.

I have looked around the forums for a few days and searched the web for some sort of action scripting tutorial but to no avail, There doesn't seem to be any clear tutorial on how to implement it on the wiki either.

Since i dont have any clue about how an action should be structured i would really appreciate some help or be pointed in the right direction as writing my own actions will seriously open up some major windows for me.

I also have Psai for dynamic soundtracks that id like to write actions for too!

Any help is super appreciated!

Thanks
Daniel
« Last Edit: January 09, 2015, 07:02:19 AM by shinodan »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Actions
« Reply #1 on: January 08, 2015, 07:30:01 AM »
Hi,

 Your best approach is to study existing actions ( official and coming from the community).

 I never write a custom from scratch, I always copy paste an existing action fitting best with my need and then expand, rewrite the bits needed.

My goal for when 1.8 will be out and things ironed out between all the different pending support is to create the ultimate Custom Action Wizard which will let you create custom actions in a very powerful way, and will likely be live, that is the editing will be persistant so that you can edit a custom action your wrote and modify it, it will recompile. That's a bold project, but I think a critical one for the grand vision of the ecosystem where I would like contributors to have a very easy way to share their work.

Back to the your particular case, PlayMaker comes with everything you need, especially the "Get/Set Property", this actions will let aou access ANY public variable from components including this apply_damage script.

 So "health" var is accessible already without you writing any custom actions or code.


Bye,

 Jean


shinodan

  • Full Member
  • ***
  • Posts: 180
    • Shinozone
Re: Actions
« Reply #2 on: January 08, 2015, 08:00:13 AM »
Quick reply jean, As always really helpful and i think i know what to do now.

Glad to see your still active :)

Thanks
Dan

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Actions [Solved]
« Reply #3 on: January 08, 2015, 09:00:24 AM »
eh eh :) more than ever.

 On that note, to all readers, if your request got forgotten even tho I told you I would take a look in few days... and its' been several weeks... please bump, I won't be offended or anything. The forum activity is now overwhelming and so please make yourself heard and bump regularly, in an ideal world, all questions would be answered if we physically could! Practicaly, we are running behind :) that's both great and scary. if you check the stats on this forum over the years, you'll understand :)

 Bye,

 Jean

shinodan

  • Full Member
  • ***
  • Posts: 180
    • Shinozone
Re: Actions [Solved]
« Reply #4 on: January 08, 2015, 09:31:15 AM »
Having a slight problem as i am only getting the option of these properties :/


Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Actions [Solved]
« Reply #5 on: January 08, 2015, 09:35:05 AM »
Are the variables you want set to public?

This video is a bit more explanatory if you are still a bit in the dark with how it works..
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

shinodan

  • Full Member
  • ***
  • Posts: 180
    • Shinozone
Re: Actions [Solved]
« Reply #6 on: January 08, 2015, 10:04:37 AM »
After watching that video i got a better understanding but now i have a ton of properties apart from the one im looking for, it doesn't appear to be private in the script hmm.

I highlighted the property i want in the picture :/

Ps - Yes i have fully scrolled up and down the list lol, current speed is there but not current mode :/
« Last Edit: January 08, 2015, 10:08:51 AM by shinodan »

shinodan

  • Full Member
  • ***
  • Posts: 180
    • Shinozone
Re: Actions [Solved]
« Reply #7 on: January 08, 2015, 11:05:50 AM »
So i added -

var curmode = current_mode.ToString();

To the script and now it is appearing, but in game the state wont change or update from its starting state "idle".

Any ideas?

« Last Edit: January 08, 2015, 12:03:09 PM by shinodan »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Actions [Solved]
« Reply #8 on: January 08, 2015, 11:11:40 AM »
Looks like it isn't recognizing the custom class? Current speed looks like its just a float, so it picks that right up.

Probably need an action to change that one.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

shinodan

  • Full Member
  • ***
  • Posts: 180
    • Shinozone
Re: Actions [Solved]
« Reply #9 on: January 09, 2015, 03:12:37 AM »
Bumping in hopes that ill get reply to read for after work but does anyone know why

var curmode = current_mode.ToString();

this creates the property for me but it stays in idle while current_mode is changing states.



Any ideas anyone?

shinodan

  • Full Member
  • ***
  • Posts: 180
    • Shinozone
Re: Actions [Solved]
« Reply #10 on: January 09, 2015, 07:03:55 AM »
So i solved my problem and i thought id post the solution.

I just created my own Var in the player movement script and added this

// States - Idle , Walking , Running , Stopping , Sliding , Jumping , Falling , Gliding , Boosting , WallSlide, Climbing, Dead, Hit, Attack
if(current_mode==playerStates.Idle)
{
curmode = "Idle";
}
if(current_mode==playerStates.Walking)
{
curmode = "Walking";
}
if(current_mode==playerStates.Running)
{
curmode = "Running";
}
if(current_mode==playerStates.Stopping)
{
curmode = "Stopping";
}
if(current_mode==playerStates.Sliding)
{
curmode = "Sliding";
}
if(current_mode==playerStates.Jumping)
{
curmode = "Jumping";
}
if(current_mode==playerStates.Falling)
{
curmode = "Falling";
}
if(current_mode==playerStates.Gliding)
{
curmode = "Gliding";
}
if(current_mode==playerStates.Boosting)
{
curmode = "Boosting";
}
if(current_mode==playerStates.WallSlide)
{
curmode = "WallSlide";
}
if(current_mode==playerStates.Climbing)
{
curmode = "Climbing";
}
if(current_mode==playerStates.Dead)
{
curmode = "Dead";
}
if(current_mode==playerStates.Hit)
{
curmode = "Hit";
}
if(current_mode==playerStates.Attack)
{
curmode = "Attack";
}

I knew it would be simple >_<