void Tick() and void DoEffect()

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
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.

void Tick() and void DoEffect()

Postby Apeirogon » Sat Dec 16, 2017 10:47 am

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 allExpand view
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 allExpand view
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();}
Apeirogon
I have a strange sense of humour
 
Joined: 12 Jun 2017

Return to Scripting

Who is online

Users browsing this forum: No registered users and 3 guests