Forum

> > CS2D > Scripts > Trigger Delay Milliseconds Instead of Seconds
Forums overviewCS2D overview Scripts overviewLog in to reply

English Trigger Delay Milliseconds Instead of Seconds

9 replies
To the start Previous 1 Next To the start

old Trigger Delay Milliseconds Instead of Seconds

Apache uwu
User Off Offline

Quote
I've been messing around with the map editor and I noticed that trigger_delay can only accept seconds and no floats.

Well here it is.

Thanks to user Iamle0 for adding that the timers need to be freed after a round.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
addhook("triggerentity","_triggerentity")

function _triggerentity(x,y)
	if entity(x,y,"typename")=="Trigger_Delay" then
		timer(entity(x,y,"int0"),"parse","trigger \""..entity(x,y,"trigger").."\"")
		return 1
	end
end

addhook("endround","_endround")

function _endround()
	freetimer()
end

Adding this means trigger_delay will now be triggered in milliseconds.

1
2
3
4
5
6
7
10000 = 10 seconds
5000 = 5 seconds
1000 = 1 second
500 = half a second
100 = 1/10 of a second
10 = 1/100 of a second
1 = 1/1000 of a second

Should be interesting what people make since now delays are more rapid.

The reason I posted this was because I had wondered if this were possible and I checked to see if this was already brought up.

Good Luck with mapping.
edited 6×, last 07.08.13 07:40:46 pm

old Re: Trigger Delay Milliseconds Instead of Seconds

EngiN33R
Moderator Off Offline

Quote
Hold on, it's either your typo or my mistake - 1 second is 1000 milliseconds, and the timer function uses exactly them, so why is 1 one hundredth of a second when it's in fact one thousandth? Otherwise this is useful indeed.

old I like it

Iamle0
User Off Offline

Quote
Very cool! But please tell me how can i add array of names?
Iam a noob.. I need more then advice, I need a code, pls
upd: whoops. Sorry. This is for every delays. Sorry Anyway very usefull
edited 1×, last 29.01.12 12:52:42 pm

old Re: Trigger Delay Milliseconds Instead of Seconds

Iamle0
User Off Offline

Quote
I think here is some kind of bug.. Delays won't stop after round restart. Can you fix it? Pleaase :3

upd: i've fixed it
1
2
3
4
5
6
7
8
9
10
11
12
13
addhook("triggerentity","_triggerentity")

function _triggerentity(x,y)
     if entity(x,y,"typename")=="Trigger_Delay" then
          timer(entity(x,y,"int0"),"parse","trigger "..entity(x,y,"trigger"))
          return 1
     end
end

addhook("endround","_endround")
function _endround()
	freetimer()
end
edited 1×, last 29.01.12 03:04:01 pm

old Re: Trigger Delay Milliseconds Instead of Seconds

Egoist
User Off Offline

Quote
I solved my problem about delays with making lot of them connected to each other,i think when you type a float number in a trigger_delay,it automatically makes it 0.1 seconds,so i needed 0.4,i put 4 delays for per delay i wanted,it was easy but long.Anyway this is awesome.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview