Logo

[Question] How to make an effect like self-flashing when Life Meter is Hot or Danger?

Register Log In Back To Forums

Post #1 · Posted at 2019-02-12 06:55:51am 4.2 months ago

Offline zGHRs
zGHRs Avatar Member
36 Posts
China
Reg. 2013-07-01
Log in to send this user a private message

Last updated: 2019-02-12 07:48am
Fot that problem. I have seen the DDR theme for 2nd. MIX or 3rd. MIX, they're both have displayed for its Life Meter in ScreenGameplay, But they have its self-flashing when Life Meter is Hot. That have got self-flashing like Danger in DDR 3rd. MIX. I want to display these effects in a theme. and then written for a code like of this:

Quote

local f = Def.ActorFrame{};

f[#f+1] = Def.ActorFrame
{
Name="LifeMeterBar-1UP";
InitCommand=cmd(y,-2;);
LifeChangedMessageCommand=function(self,param)
if param.PlayerNumber == PLAYER_1 then
if param.LifeMeter:IsHot() then
self:playcommand("Hot");
elseif param.LifeMeter:IsInDanger() then
self:playcommand("Danger");
elseif param.LifeMeter:IsFailing() then
self:playcommand("Failed");
else
self:stopeffect();
end;
end;
end;
LoadActor("LifeFrame")..
{
HotCommand=cmd(glowshift;effectperiod,0.1;effectcolor1,color("1,1,1,0.4");effectcolor2,color("1,1,1,0"););
DangerCommand=cmd(glowshift;effectperiod,0.75;effectcolor1,color("1,0,0,0.8");effectcolor2,color("1,0,0,0"););
FailedCommand=cmd(diffuseshift;diffuse,color("0.26,0.02,0.74,0");stopeffect;);
};
};

f[#f+1] = Def.ActorFrame
{
Name="LifeMeterBar-2UP";
InitCommand=cmd(y,-2);
BeginCommand=function(self,param)
if param.PlayerNumber == PLAYER_2 then
if param.HealthState == "HealthState_Hot" then
self:playcommand("Hot");
elseif param.HealthState == "HealthState_Danger" then
self:playcommand("Danger");
elseif param.HealthState == "HealthState_Dead" then
self:playcommand("Failed");
else
self:stopeffect();
end;
end;
end;
LoadActor("LifeFrame")..
{
HotCommand=cmd(glowshift;effectperiod,0.1;effectcolor1,color("1,1,1,0.4");effectcolor2,color("1,1,1,0"););
DangerCommand=cmd(glowshift;effectperiod,0.75;effectcolor1,color("1,0,0,0.8");effectcolor2,color("1,0,0,0"););
FailedCommand=cmd(diffuseshift;diffuse,color("0.26,0.02,0.74,0");stopeffect;);
};
};

return f;

However, it didn't display the effects in LifeMeter at ScreenGameplay for the code of above. Also that lua file is located in the folder at "Graphics\LifeMeterBar over". I have kept three files for "StreamDisplay danger", "StreamDisplay normal", "StreamDisplay hot" in Graphics folder. But it didn't change the StreamDisplay in Danger.

I want to ask a question. How to change the graphics or set the code for self-flashing at Hot or Danger (Like DDR 2nd. or DDR 3rd.) in "LifeMeterBar over" with the prerequisite of the files in "Graphics" folder? Also I want to display for three effects within the file for "StreamDisplay danger", "StreamDisplay normal", "StreamDisplay hot" in Danger, Normal, or Hot in LifeMeterBar.

Post #2 · Posted at 2019-02-12 09:50:18pm 4.1 months ago

Offline Jose_Varela
Jose_Varela Avatar Member
43 Posts
Mexico
Reg. 2016-10-09
Log in to send this user a private messageTwitter: JoseVarelaP1YouTubeTwitch
Xbox Gamer Tag: El SimpsomaticoSteam: josematico
"Doin' whatever when I can"

Last updated: 2019-02-12 09:55pm
Quote: zGHRs
Fot that problem. I have seen the DDR theme for 2nd. MIX or 3rd. MIX, they're both have displayed for its Life Meter in ScreenGameplay, But they have its self-flashing when Life Meter is Hot. That have got self-flashing like Danger in DDR 3rd. MIX. I want to display these effects in a theme. and then written for a code like of this:

However, it didn't display the effects in LifeMeter at ScreenGameplay for the code of above. Also that lua file is located in the folder at "Graphics\LifeMeterBar over". I have kept three files for "StreamDisplay danger", "StreamDisplay normal", "StreamDisplay hot" in Graphics folder. But it didn't change the StreamDisplay in Danger.

I want to ask a question. How to change the graphics or set the code for self-flashing at Hot or Danger (Like DDR 2nd. or DDR 3rd.) in "LifeMeterBar over" with the prerequisite of the files in "Graphics" folder? Also I want to display for three effects within the file for "StreamDisplay danger", "StreamDisplay normal", "StreamDisplay hot" in Danger, Normal, or Hot in LifeMeterBar.

So, using BeginCommand to detect lifestate, won't work because it only runs once the screen is compiled and starts. What you're looking for is LifeChangedMessageCommand, as it updates whenever the player has changed anything in their lifebar.

What I would also recommend is using HealthState, to detect the current state of the player's life. I do see that you have it running on the -2UP actor, but, again, that is using BeginCommand, which only updates once.

Also the playcommands could work on the way that is written there, but I would probably do them in MessageComands. You can also easily do a loop of this via PlayerNumber.



Quote: Lifebar Loop

local f = Def.ActorFrame{};

for player in ivalues(PlayerNumber) do
f[#f+1] = Def.ActorFrame{
Name="LifeMeterBar-"..player.."UP";
InitCommand=cmd(y,-2);
LifeChangedMessageCommand=function(self,param)
if param.PlayerNumber == player then
if param.HealthState == "HealthState_Hot" then
self:queuemessage("Hot")
elseif param.HealthState == "HealthState_Danger" then
self:queuemessage("Danger")
elseif param.HealthState == "HealthState_Dead" then
self:queuemessage("Failed")
else
self:stopeffect()
end
end
end;
LoadActor("LifeFrame")..{
HotMessageCommand=function(self)
self:glowshift():effectperiod(0.1)
:effectcolor1( color("1,1,1,0.4") ):effectcolor2( color("1,1,1,0") )
end;
DangerMessageCommand=function(self)
self:glowshift():effectperiod(0.75)
:effectcolor1( color("1,0,0,0.8") ):effectcolor2( color("1,0,0,0") )
end;
FailedMessageCommand=function(self)
self:diffuseshift():diffuse( color("0.26,0.02,0.74,0") ):stopeffect()
end;
};
};
end

return f;

You can also just make the elseif's like this:
Quote

if param.PlayerNumber == player then
if param.HealthState then
self:queuemessage( ToEnumShortString(param.HealthState) )
else
self:stopeffect()
end
end

.. On the MessageCommands
HotMessageCommand=function(self)
self:glowshift():effectperiod(0.1)
:effectcolor1( color("1,1,1,0.4") ):effectcolor2( color("1,1,1,0") )
end;
DangerMessageCommand=function(self)
self:glowshift():effectperiod(0.75)
:effectcolor1( color("1,0,0,0.8") ):effectcolor2( color("1,0,0,0") )
end;
DeadMessageCommand=function(self)
self:diffuseshift():diffuse( color("0.26,0.02,0.74,0") ):stopeffect()
end;

Quote: zGHRs
How to change the graphics or set the code for self-flashing at Hot or Danger (Like DDR 2nd. or DDR 3rd.) in "LifeMeterBar over" with the prerequisite of the files in "Graphics" folder?

if the graphics are just images (which is most likely), you can simply do a self:Load() for the new image in question.
Quote: Example with Load() function

if param.HealthState == "HealthState_Hot" then
self:Load("StreamDisplay hot")
elseif param.HealthState == "HealthState_Danger" then
self:Load("StreamDisplay danger")
elseif param.HealthState == "HealthState_Dead" then
self:Load("StreamDisplay normal")
end

I wouldn't recommend this though, because it can make stepmania lag everytime it has to do this process.
https://jose.heysora.net/Files/ZiV%20signature.png
Register Log In Back To Forums

0 User(s) Viewing This Thread (Past 15 Minutes)

©2006-2019 Zenius -I- vanisher.com -5th style- IIPrivacy Policy
Web Server: 2% · Database: 8% · Server Time: 2019-06-18 08:46:13
This page took 0.004 seconds to execute.
Theme: starlight · Language: german
Reset Theme & Language