playMaker

Author Topic: [SOLVED]health to reset based on a #C script value  (Read 1950 times)

daidokoro

  • Playmaker Newbie
  • *
  • Posts: 17
    • View Profile
[SOLVED]health to reset based on a #C script value
« on: October 05, 2015, 11:01:58 AM »
Hi
I have a fsm for my boss health and everything is working fine. When trigger is hit then health is lossing health until dead. But when the player is dead and respawned (3 lifes) then the boss gui and health value are not resetting. So i have tried to use a get property to access the m_health of the player script and compare int. If int is 0 or less then i will go back and restart the fsm or i'm missing something. Thanks for the help...
« Last Edit: October 10, 2015, 07:36:42 AM by daidokoro »

daidokoro

  • Playmaker Newbie
  • *
  • Posts: 17
    • View Profile
Re: health to reset based on a #C script value
« Reply #1 on: October 06, 2015, 10:45:36 AM »
Ok my system is working now with the first spawn (life1) of my player but no with second and Third life...i can't find what i'm doing wrong.

Basically i'm checking health variable on player and if 0 then sending event to Boss to reset Int to 10

If someone can help as i'm loosing my mind...


djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 3916
    • View Profile
    • jinxtergames
Re: health to reset based on a #C script value
« Reply #2 on: October 06, 2015, 11:12:10 AM »
Hi,
In the 1st post i can see that the int compare should be above the trigger

In the 2nd post in your check health fsm,
when you have reached 0 it goes to "state 2" and send event but after that it stay on "state 2" so it is not checking anymore

daidokoro

  • Playmaker Newbie
  • *
  • Posts: 17
    • View Profile
Re: health to reset based on a #C script value
« Reply #3 on: October 06, 2015, 12:05:41 PM »
Hi
Thanks i'm using the second method. Yes the state 2 is the end at the moment as every time i'm doing a transition to come back to state 1 i have an error message like :
Third Person Character : check health : Loop count exceeded maximum: 1000 Default is 1000. Override in Fsm Inspector.
UnityEngine.Debug:LogError(Object)
HutongGames.PlayMaker.FsmLog:AddEntry(FsmLogEntry)
HutongGames.PlayMaker.FsmLog:Log(FsmLogType, String)
HutongGames.PlayMaker.FsmLog:LogError(String)
HutongGames.PlayMaker.Fsm:EnterState(FsmState)
HutongGames.PlayMaker.Fsm:SwitchState(FsmState)
HutongGames.PlayMaker.Fsm:UpdateStateChanges()
HutongGames.PlayMaker.Fsm:UpdateState(FsmState)
HutongGames.PlayMaker.Fsm:Update()
PlayMakerFSM:Update()

daidokoro

  • Playmaker Newbie
  • *
  • Posts: 17
    • View Profile
Re: health to reset based on a #C script value
« Reply #4 on: October 06, 2015, 12:21:03 PM »
ok solve the issue of the infinite loop by adding a Next Frame Event action but still can't get the reset for player spawn 2 and 3... any idea?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 3916
    • View Profile
    • jinxtergames
Re: health to reset based on a #C script value
« Reply #5 on: October 07, 2015, 10:02:49 AM »
Hi,
i don't think you should loop this, but use a Global transition on the 1st state
and then send a event to it after players health is reset

daidokoro

  • Playmaker Newbie
  • *
  • Posts: 17
    • View Profile
Re: health to reset based on a #C script value
« Reply #6 on: October 08, 2015, 01:54:57 AM »
Do you mean on the player or on the health boss ? I'm confuse...sorry

I have a global transition sent from the player when health is 0 to the boss but it is looking only working for the second player (after death of first one) then it is not working anymore...

daidokoro

  • Playmaker Newbie
  • *
  • Posts: 17
    • View Profile
Re: health to reset based on a #C script value
« Reply #7 on: October 08, 2015, 02:08:17 AM »
Also now the Health of Boss is updating to original value when player is dead but my trigger is not working anymore...
Attached are my latest FSM

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 3916
    • View Profile
    • jinxtergames
Re: health to reset based on a #C script value
« Reply #8 on: October 08, 2015, 11:08:20 AM »
Hi,
I mean do not loop the check health fsm, but add a global transition on the first state (start state)
then you need to send an event to it after the player health is reset.

Or you can add a 3th state to check if player health is not 0 anymore
(same way as on the 1st state but then only "greater than")
and then loop back to the 1st state

daidokoro

  • Playmaker Newbie
  • *
  • Posts: 17
    • View Profile
Re: health to reset based on a #C script value
« Reply #9 on: October 09, 2015, 12:06:33 PM »
wonderful  :D
Thanks a lot it is working with this method. Tomorrow i will post the final FSM so people can see what i have done