Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
Forums overviewCS2D overview Scripts overviewLog in to reply

English Lua Scripts/Questions/Help

6,770 replies
Page
To the start Previous 1 2121 122 123338 339 Next To the start

old Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Quote
Sup guys I'm back for another question


Why does my script not work?

Spoiler >


It's a Achievements script

all those is actually
" : | "

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
I don't know why it doesn't work.
I don't even know what is the problem, maybe you could tell us so we don't have to read a 170-lined script.

Edit:
I spotted 2 (not important) quick errors:
1-You wrote "Dieing" it's "Dying"
2-Your saving and loading system is really messed up, you use the io.lines() function to read from files with one single line and you concatenate when you are writing to file.
edited 1×, last 21.12.09 02:15:20 am

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
-WiLSoN- has written
tile(x,y,"value") function is now working, right ?
so... how can i make a random spawning with this function?


Basic Example:
for tiles y
     for tiles x
          if tile is not a wall
               setpos tiles x * 32 and tiles y * 32
          end
     end
end

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
-WiLSoN- has written
what do u mean with "for tiles x" and "for tiles y" ?

1
2
3
for x = 0, map("xsize") do
	<Other Script>
end

Sorry for short explanations, I'm very busy current days.

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
What the hell, is the tile() function working?
You will need some pathfinding algorithms anyways or you might spawn players in weird places-
Edit:
ZOMG NEW VERSION, I didn't notice that!

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
-WiLSoN- has written
the new version fixed tile() function...
my problem is strange... i'm just spawning on tile 1,1 or 0,0 :S


Becouse you need to increase tile into pixel format (X * 32)

Setpos uses pixel positions.

I said before:

Blazzingxx has written
setpos tiles <id> < [ tilex * 32 ] < [tiley * 32]

old Re: Lua Scripts/Questions/Help

NozliW
User Off Offline

Quote
@Blazzingxx
thanks but now i just respawn on 1 position,and that position is "imposible" (i mean it's not possible to get there without spawnplayer or setpos or etc lol)

old Re: Lua Scripts/Questions/Help

Heartless Soldier
User Off Offline

Quote
Is it possible to make an "animation" with timer and image functions? i mean use a time that calls a function with an image and a timer, this timer call other function with other image and one more timer, to simulate an animation, i tried to do this but i don't understand by all the timer function.

I did this (i know it sucks but... xD):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
addhook("use","startani")
function startani(id,event,data,x,y)

if (x==10 and y==5) then

timer(50,"gif1","1",1)

end

end


function gif1(id)

freetimer("startani","4")
id1=image("gfx/r1.bmp",7,4,0)
timer(50,"gif2","3",1)

end

function gif2(id)

freetimer("gif1","4")
id1=image("gfx/r2.bmp",7,4,0)

timer(50,"gif3","3",1)

end

function gif3(id)

freetimer("gif2","5")
id1=image("gfx/r3.bmp",7,4,0)

end

Good luck and wait answers :).
Bye!

old Re: Lua Scripts/Questions/Help

Lee
Moderator Off Offline

Quote
-WiLSoN- has written
@Blazzingxx
thanks but now i just respawn on 1 position,and that position is "imposible" (i mean it's not possible to get there without spawnplayer or setpos or etc lol)


Such as http://mapcs2d.codepad.org/5SxuaZM1 ? (/ are spawnable, white are not, # are obstacles/walls)

There are a few ways to circumvent this problem, below is a proof of concept implementation. the approach pulls a sequential expansion tree to fill all of the possible regions that is accessible by a starting point

Requires map.lua
http://mapcs2d.codepad.org/eFvYfSYI
(this is a slightly updated version, get the rest of the libraries at http://failboat.me/wp-content/map.zip)

Sectorization code
http://mapcs2d.codepad.org/TQZkB9zG
To the start Previous 1 2121 122 123338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview