Forum

> > CS2D > Scripts > 'for i = .., .. do blablabla *Solved*
Forums overviewCS2D overview Scripts overviewLog in to reply

English 'for i = .., .. do blablabla *Solved*

7 replies
To the start Previous 1 Next To the start

old 'for i = .., .. do blablabla *Solved*

Alistaire
User Off Offline

Quote
Spoiler >


For future reference;

1
2
3
4
5
6
7
8
9
while q == false do
	if GE_hpval[id] > 0 then
		freeimage(GE_hpimg[victim][GE_hpval[id]])
		GE_hpval[id] = GE_hpval[id] - 1
	end
	if GE_hpval[id] == 0 then
		q = true
	end
end

A while .. do thing works way better imho! No Lua errors and no FPS drops.
edited 3×, last 20.02.12 08:27:59 pm

old Re: 'for i = .., .. do blablabla *Solved*

Alistaire
User Off Offline

Quote
Sorry, it was a kill hook..

----

user Flacko has written
I think the problem is in your loop.


Yes, that was why I posted the script in the first place. The rest was to show you it isn't some random crap, and maybe to help you find any problems.

The problem is in the freeimage(GE_hpimg[victim][i]) part, according to the console.

old Re: 'for i = .., .. do blablabla *Solved*

Alistaire
User Off Offline

Quote
Every time you get hit you get an image on you, and to make them removable I've added a second Id value. (GE_hpimg[id][GE_hpval[id]])

When you get hit GE_hpval[id] = GE_hpval[id] + 1

----

Worst part is that the script works! The script works but it returns loads of errors in the console.
edited 2×, last 20.02.12 08:14:12 pm

old Re: 'for i = .., .. do blablabla *Solved*

Flacko
User Off Offline

Quote
What is this line? It seems to be outside of any function so I think you meant to put it inside GE_kill()?

1
GE_hpimg[id][GE_hpval[id]] = image('gfx/GoreExtension/F'..math.random(1, 4)..'.png', 1, 0, 200 + id)

old Re: 'for i = .., .. do blablabla *Solved*

Alistaire
User Off Offline

Quote
user Flacko has written
What is this line? It seems to be outside of any function so I think you meant to put it inside GE_kill()?

1
GE_hpimg[id][GE_hpval[id]] = image('gfx/GoreExtension/F'..math.random(1, 4)..'.png', 1, 0, 200 + id)


Nope. It was to show you that GE_hpimg[id][GE_hpval[id]] actually was an image which could be freed..
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview