Forum

> > CS2D > Scripts > Mouse pointer function ?
Forums overviewCS2D overview Scripts overviewLog in to reply

English Mouse pointer function ?

2 replies
To the start Previous 1 Next To the start

old Mouse pointer function ?

KenVo
User Off Offline

Quote
I'm wondering how to make a player teleport to the mouse pointer with a command or make an explosion right where the mouse pointer is at, is it even possible if it is then can you give me some ideas how to do it? Thanks

old Re: Mouse pointer function ?

archmage
User Off Offline

Quote
Once you have the cursor's position (read info.txt and samples/cursors.lua) just parse the cs2d cmd explosion command. You could create an explosion function like this:
1
2
3
function explosion(x, y, range, damage, source)
	parse("explosion "..x.." "..y.." "..range.." "..damage.." "..source);
end

Now just call that function with the cursor position.
1
explosion(cursorx, cursory, 50, 30, player_id);

To teleport do the same except use cs2d cmd setposition instead of explosion.

old Re: Mouse pointer function ?

KenVo
User Off Offline

Quote
Thanks for replying, I made a command, when I use this command the cursor image would appear and when I click the cursor image would disappear but the problem is I don't know how to define x and y after addhook("attack","click")

Spoiler >
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview