Trying to create a specific behavior. Can someone help?

creatine
Posts: 120
Joined: Wed Jan 18, 2017 4:12 pm
Has thanked: 19 times
Been thanked: 5 times

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

Post by creatine » Fri Jul 28, 2017 2:06 am

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?

creatine
Posts: 120
Joined: Wed Jan 18, 2017 4:12 pm
Has thanked: 19 times
Been thanked: 5 times

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

Post by creatine » Fri Jul 28, 2017 3:17 am

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!

agonic
VIP
Posts: 159
Joined: Tue Jan 10, 2017 6:39 pm
Has thanked: 34 times
Been thanked: 112 times

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

Post by agonic » Fri Jul 28, 2017 1:01 pm

Skill name here?

creatine
Posts: 120
Joined: Wed Jan 18, 2017 4:12 pm
Has thanked: 19 times
Been thanked: 5 times

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

Post by creatine » Fri Jul 28, 2017 4:32 pm

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...

User avatar
nucular
Site Admin
Posts: 260
Joined: Sat Jan 07, 2017 9:08 pm
Has thanked: 27 times
Been thanked: 388 times

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

Post by nucular » 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 .... :?

creatine
Posts: 120
Joined: Wed Jan 18, 2017 4:12 pm
Has thanked: 19 times
Been thanked: 5 times

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

Post by creatine » Sat Jul 29, 2017 3:27 am

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!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest