When NPC is spawned (CREATED)... i_ai0 is set to 0...
When someone request a buff a condition check if i_ai0 is 0 -> if (myself.i_ai0 == 0)
If is 0 means no one is using the buffer at this moment, because the first line when i request a buff is -> myself.i_ai0 = 1; now someone is using npc... and i add a timer -> AddTimerEx(1, Delay); ... this timer set i_ai0 to 0 again, now is possible to use buffer again... Delay value is set to 250 (0,25 seconds) is very little delay, maybe need increment this value, but help a lot right now.
I do that because if a lot of people is trying to get buff at the same time... npc only give to a few players, but delete adena of all.
"Adena" variable is amount of adena player need to be buffed.
super; is call_super parameter in AI.obj, i use this because in citizen AI i have more code to use (greetings when talked)
|