Long story short:
Forum



Flood script required
12 replies



Long story short:




In the mission update (not drawing!) function:
1
2
3
2
3
if (getframe() % (50*5))==0 then
-- insert flooding snippet here
end
The remainder of getframe() / (50*5) is 0 every 5 seconds. That's how it works.
(You could also increase a variable each frame and execute the flooding when it reaches 50*5 but with the modulo solution you don't have to use a variable at all.)
EDIT: I did it, but I need to sort things out. I'll test some more. But you can consider your problem solved!
EDIT the second: I'm sort of done. However, I can't figure out how to implement sounds. But if you give me the map I can compose it to a level.
edited 2×, last 22.09.12 05:31:26 pm

Well, I tried, and managed to make it create an error message every five seconds stating "flood" is a nil value. So I'm on the right track. Hold onto your whatever you use to hold on.
EDIT: I did it, but I need to sort things out. I'll test some more. But you can consider your problem solved!
EDIT the second: I'm sort of done. However, I can't figure out how to implement sounds. But if you give me the map I can compose it to a level.
EDIT: I did it, but I need to sort things out. I'll test some more. But you can consider your problem solved!
EDIT the second: I'm sort of done. However, I can't figure out how to implement sounds. But if you give me the map I can compose it to a level.
The mission will have 20+ maps, so, do you only need one or every one of them?
edited 3×, last 22.09.12 09:45:26 pm
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
node={}
-- light effect around player
function lightfx()
x=getplayerx(0)
y=getplayery(0)
particle(p_muzzle,x,y)
particlesize(0.8,2.0)
particlerotation(0)
particlealpha(1.0)
particlefadealpha(0.04)
particlecolor(255,255,0)
for i=1,10 do
particle(p_flare,x+math.random(-1000,1000)/100,y+math.random(-1000,1000)/100)
size=math.random(200,500)/100
particlesize(size,size)
particlefadealpha(math.random(10,20)/1000)
particlecolor(255,255,0)
particlespeed(0,-math.random(20,150)/100)
end
end
-- start function
function mission_start()
-- save win node position
node.win={}
node.win.x=getnodex("win")
node.win.y=getnodey("win")
if node.win.x==0 then
node.win.x=-100000000
end
-- start fx
lightfx()
playsound(sfx_turn_you)
-- call customt start function
customstart()
end
-- custom start function for additional functionality. overwritten by map scripts 000.lua-XXX.lua
function customstart()
end
-- draw function (just calls custom)
function mission_draw()
-- call custom draw function
customdraw()
end
-- custom draw function for additional functionality. overwritten by map scripts 000.lua-XXX.lua
function customdraw()
end
-- update function
function mission_update()
-- check if player wins (is close to win node)
if (getframe()%5)==0 then
-- win?
x=getplayerx(0)
y=getplayery(0)
if math.abs(x-node.win.x)<20 then
if math.abs(y-node.win.y)<20 then
win()
end
end
end
if (getframe() % (50*5))==0 then
-- insert flooding snippet here
watery(getwatery()-150)
end
-- call custom update function
customupdate()
end
-- custom update function for additional functionality. overwritten by map scripts 000.lua-XXX.lua
function customupdate()
end
edited 2×, last 23.09.12 06:59:20 am

You're welcome. Help you again anytime. You just post that thing soon so I can experiment with it.
Okay. I'll put you in the credits btw, when I upload the mission.

Thanks, I appreciate it. You don't mind if I use the script for myself?
User "Myself" or you? Btw, of course you can, you made the script.



