void Tick() and void DoEffect()

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

void Tick() and void DoEffect()

Post by Apeirogon »

How use DoEffect function?
I want create inventory medkit that heal 25 health in time of 12.5 seconds. What I should write in funtion body?
Something like

Code: Select all

override void DoEffect() 
{
 int time;
time++;
if(time==2){time=0; owner.giveinventory(health, 1);/*not sure this works in zsript*/}
}
And can I use void tick() to manipulate time, like

Code: Select all

override void Tick() 
{
CVar bullet_time = CVar.GetInt('bullet_time_cvar');
CVar slow_mo = CVar.GetInt('slow_mo_cvar');
if(bullet_time =/=0 ) 
{
if(slow_mo==0) {return super.tick();}
else  {tick*slow_mo}
}
Super.Tick();}

Return to “Scripting”