Page 2 of 2

Re: Trying to create a specific behavior. Can someone help?

Posted: Fri Jul 28, 2017 2:06 am
by creatine
scratch that! thanks Nucular and Agonic! I got everything working perfectly now. I just need to remember if I spam teh words on normal chat ill get temporary block cuz flooding chat, but group chat is totally fine ^^

now the 2nd part I need to do is to add the timer, because, oh boy... it really does flood the chat... how do I add timer?

Re: Trying to create a specific behavior. Can someone help?

Posted: Fri Jul 28, 2017 3:17 am
by creatine
nucular wrote:
Thu Jul 27, 2017 12:01 pm
agonic wrote:
Wed Jul 26, 2017 6:31 pm

Code: Select all

local TargetEntity = EntityList:GetEntity( Entity:GetTargetId() );

if TargetEntity ~= nil then
	local Skill = SkillList:GetSkill( Entity:GetSkillID());
	if Skill ~= nil and string.find( Skill:GetName(), "_SKILL NAME HERE_" ) ~= nil then

	PlayerInput:Console("" .. TargetEntity:GetName() .. " is gonna be hit by " .. Entity:GetName() .. " );
	end

end
so I ended up with this code above as the final results. It works perfectly as how I intended to make them in the first place, but its flooding group chat too fast. how do I fix this to create timer so I wont be spamming it too much?

I tried to combine this with a few lines from agonic's code, like this:

Code: Select all

timer = 0
wait = 1000

local TargetEntity = EntityList:GetEntity( Entity:GetTargetId() );

if TargetEntity ~= nil then
	local Skill = SkillList:GetSkill( Entity:GetSkillID());
	if Skill ~= nil and string.find( Skill:GetName(), "_SKILL NAME HERE_" ) ~= nil then

        if Time() > timer then

	PlayerInput:Console("" .. TargetEntity:GetName() .. " is gonna be hit by " .. Entity:GetName() .. " );
	end

	timer = Time() + wait
	end
end

the result is even worse. nothing happened :x
im at a loss. what part did I do wrong?

thanks again for all of the great helps!

Re: Trying to create a specific behavior. Can someone help?

Posted: Fri Jul 28, 2017 1:01 pm
by agonic
Skill name here?

Re: Trying to create a specific behavior. Can someone help?

Posted: Fri Jul 28, 2017 4:32 pm
by creatine
agonic wrote:
Fri Jul 28, 2017 1:01 pm
Skill name here?
thats just a sample. the skill name here is the part that u change according to skill. like in IS - powerful ide, in IO - Salvo, etc etc...

in any case, theres nothing broken with that part. the only problem now is I dont know how to make a timer thats all...

Re: Trying to create a specific behavior. Can someone help?

Posted: Fri Jul 28, 2017 6:52 pm
by nucular

Code: Select all

local TargetEntity = EntityList:GetEntity( Entity:GetTargetId() );
if TargetEntity ~= nil then
	local Skill = SkillList:GetSkill( Entity:GetSkillID());
	if Skill ~= nil and string.find( Skill:GetName(), "_SKILL NAME HERE_" ) ~= nil then
		if ShoutTimer == nil or ShoutTimer < Time() then
			PlayerInput:Console("" .. TargetEntity:GetName() .. " is gonna be hit by " .. Entity:GetName() .. " );
			ShoutTimer = Time() + 3000; -- shout limit to 3 seconds
		end
	end
end
Should work, i'm kinda sad that no one knows how to do that .... :?

Re: Trying to create a specific behavior. Can someone help?

Posted: Sat Jul 29, 2017 3:27 am
by creatine
nucular wrote:
Fri Jul 28, 2017 6:52 pm

Code: Select all

local TargetEntity = EntityList:GetEntity( Entity:GetTargetId() );
if TargetEntity ~= nil then
	local Skill = SkillList:GetSkill( Entity:GetSkillID());
	if Skill ~= nil and string.find( Skill:GetName(), "_SKILL NAME HERE_" ) ~= nil then
		if ShoutTimer == nil or ShoutTimer < Time() then
			PlayerInput:Console("" .. TargetEntity:GetName() .. " is gonna be hit by " .. Entity:GetName() .. " );
			ShoutTimer = Time() + 3000; -- shout limit to 3 seconds
		end
	end
end
Should work, i'm kinda sad that no one knows how to do that .... :?
this works perfectly as intended now, nucular. thank you very much for this, you have been a super great help! :D
this side project has been a major success!