YesNoOk
avatar

Improve "Danger" code (Read 9562 times)

Started by Charles_2011, May 24, 2023, 03:48:50 pm
Share this topic:
Improve "Danger" code
#1  May 24, 2023, 03:48:50 pm
  • ***
    • Peru
Hello.

I´m testing a danger code, during battle works fine:



But there is an issue that I want to fix: If you win using an special that finish your oponent in one blow before the activation of the danger code the effect happens later, here:





Could you help me, please?

Here you have the code:

;===============================================;
; DANGER - FIRST CODE
;===============================================;

[Statedef 1]
anim=9999

[State -2, DANGER sound]
type = PlaySnd
trigger1 = time = 0
value = F7880,1

[State -2]
type = Explod
trigger1 = teamside = 1
anim = F88111
Postype = left
pos = 0,0
bindtime = -1
scale=1.0,1.0
removetime = 51
persistent=0
sprpriority = -9999999999
ownpal = 1

[State -2]
type = Explod
trigger1 = teamside =2
anim = F88222
Postype = right
pos = -220,0
bindtime = -1
scale=1.0,1.0
removetime = 51
persistent=0
sprpriority = -9999999999
ownpal = 1

;===============================================;

[Statedef -3]

;===============================================;
; DANGER - SECOND CODE
;===============================================;

[State 0, danger]
type = Helper
triggerall = numhelper(1)=0
trigger1 = life <= 300
helpertype = normal
name ="danger"
ID = 1
stateno = 1
postype = p1

;===============================================;

I hope that you can help me to solve this.
Last Edit: May 29, 2023, 03:33:58 am by Charles_2011
Re: Improve "Danger" code
#2  May 24, 2023, 04:11:51 pm
  • ******
    • Portugal
    • network.mugenguild.com/pots/
You need to check for "alive" when creating the helper. Or use "life = [1, 300]" instead. You might want to check for a percentage of life instead of an absolute value, too, like "life <= 0.3 * lifemax".

Also using a helper for this is a bit wasteful. Unless the danger sign stays on screen the rest of the round.
You can help with Ikemen GO's development by trying out the latest development build and reporting any bugs on GitHub.
My Mugen and Ikemen content can also be found here.
Re: Improve "Danger" code
#3  May 24, 2023, 04:42:50 pm
  • ***
    • Peru
Hello PotS.

First of all, thank you for the answer. I proved your recomendations but It doesn´t work. Could you provide me the entire code or a new one, please? Maybe I´m doing something wrong, I´m still learning on making improvements on characters.
Re: Improve "Danger" code
#4  May 26, 2023, 07:45:53 pm
  • avatar
  • **
    • UK
Hello PotS.

First of all, thank you for the answer. I proved your recomendations but It doesn´t work. Could you provide me the entire code or a new one, please? Maybe I´m doing something wrong, I´m still learning on making improvements on characters.

I feel you need to learn a lot in mugen before starting any big projects. you seem to have a lot of good/interesting ideas, but constantly get stuck and make posts for help.

I look at some off these questions you ask and just think there so much resource out there that you can reference. Download Pots characters and learn from them.
Re: Improve "Danger" code
#5  May 29, 2023, 03:33:33 am
  • ***
    • Peru
Hello POTS.

I´ve been testing the code and I finally made it, indeed, the "Alive" text was necesary, this is the final code:

[State 0, danger]
type = Helper
triggerall = numhelper(1)=0
triggerall = alive
trigger1 = life <= 0.3 * lifemax
name = "danger"
ID = 1
stateno = 1
postype = p1

Thank you so much for your help and the references that you gave me.