English Throw at mouse position

5 replies
Goto Page
To the start Previous 1 Next To the start
06.06.18 03:30:27 pm
Up
Jenko63
User
Offline Off
Code:
1
parse("spawnprojectile "..id.." 72 "..player(id,"x").." "..player(id,"y").." 500 "..player(id,"rot").."")


How to make the gas grenade throw at mouse position instead of the "500 number"
JENKO
06.06.18 04:23:11 pm
Up
Rainoth
Moderator
Offline Off
math.sqrt((player(id,"mousex")-player(id,"x"))^2 + (player(id,"mousey")-player(id,"y"))^2)


Might have messed up brackets. Basically the difference between coordinates in x in power of 2 and added to the difference between coordinates in y in power of 2 and then the result is in power of 1/2 (root).
MAL • DeviantArt • For Wallpaper Engine users • Check YT for playlists... •
06.06.18 09:42:06 pm
Up
Jenko63
User
Offline Off
@user Rainoth:

I need to know how to do it
give me the full line not just this
JENKO
06.06.18 09:46:25 pm
Up
Bowlinghead
User
Offline Off
Code:
1
2
local WhatIsBrain= math.sqrt((player(id,"mousex")-player(id,"x"))^2 + (player(id,"mousey")-player(id,"y"))^2)
parse("spawnprojectile "..id.." 72 "..player(id,"x").." "..player(id,"y").." "..WhatIsBrain.." "..player(id,"rot").."")

a² + b² = c²..
Share time limited free games here
06.06.18 09:57:59 pm
Up
Jenko63
User
Offline Off
@user Bowlinghead:

Didn't work
JENKO
06.06.18 10:38:17 pm
Up
Rainoth
Moderator
Offline Off
Apologies, forgot that "mousex" and "mousey" are for screen positions. Change them into "mousemapx" and "mousemapy".

Looking at 'player' lua command description, I actually found that blazzingxx implemented that as a player variable. Just use this instead:
parse("spawnprojectile "..id.." 72 "..player(id,"x").." "..player(id,"y").." "..player(id,"mousedist").." "..player(id,"rot"))
MAL • DeviantArt • For Wallpaper Engine users • Check YT for playlists... •
To the start Previous 1 Next To the start