Forum

> > CS2D > Scripts > Sprite ask
Forums overviewCS2D overview Scripts overviewLog in to reply

English Sprite ask

11 replies
To the start Previous 1 Next To the start

old Sprite ask

tos12345678
User Off Offline

Quote
Hi, i need lua cmd which will be spawning sprite and make explode effect on the specific place map every restart.
e.g. timer 10000 parse sprite + explode x*2100 y*2600
Thanks for help!

old Re: Sprite ask

GeoB99
Moderator Off Offline

Quote
A straight way to do this is by using cs2d lua hook endround hook and then do a condition check if the mode is 5 (round restart). Then use cs2d lua cmd timer with cs2d lua cmd image with the path location of the sprite and coordination and cs2d lua cmd timer with cs2d cmd explosion with the same coordination like where you place the sprite.

Make sure the damage parameter of cs2d cmd explosion command must be 0 in case you don't want the explosion effect hurting nearby players.

old Re: Sprite ask

Masea
Super User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
duration = 1000

imagePath = "gfx/block.bmp"
x = 320
y = 240

explosionDamage = 0
explosionSize = 24

addhook("startround","_s")
function _s()
	timer(duration, "_explosion")
end

function _explosion()
	image(imagePath, x, y, 0)
	parse("explosion "..x.." "..y.." "..explosionSize.." "..explosionDamage.." 0")
end
@user GeoB99: I don't get why you use cs2d lua hook endround instead of cs2d lua hook startround

old Re: Sprite ask

Avo
User Off Offline

Quote
^ yeah, it's more like CS2D BOFCTG (bunch of functions changing the gameplay).

old Re: Sprite ask

VaiN
User Off Offline

Quote
here ya go: cs2d lua cmd image
Quote
Mode 201-232: draw over this player (id+200)

Example:
1
local img_id = image(imgpath, 1, 0, 200 + id)

old Re: Sprite ask

Masea
Super User Off Offline

Quote
@user tos12345678: Okay? What. The. Fuck. Did you even try?

It should be 1 or 3. Between 201 and 232 are for player images.

old Re: Sprite ask

tos12345678
User Off Offline

Quote
Ye i tried, later i searched that 1,2 for players
And 3,4 for cover pl map
Sorry all working
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview