Shockwave [LUA] 1.0.2
4,045
47
4,045
47
Shockwave [LUA]
What's new in 1.0.2:
Keep function call parameter type up to date.
Feature:
Push nearby objects away with shockwaves.
Install:
Dependency:
Script Hook
https://www.gta5-mods.com/tools/script-hook-v
and LUA Plugin for Script Hook
https://www.gta5-mods.com/tools/lua-plugin-for-script-hook-v
Put the shockwave.lua in your Grand Theft Auto V\scripts\addins folder.
Usage:
Press "+" key in number area on your keyboard to release shockwave, press multiple time to make it more powerful.
What's new in 1.0.2:
Keep function call parameter type up to date.
Feature:
Push nearby objects away with shockwaves.
Install:
Dependency:
Script Hook
https://www.gta5-mods.com/tools/script-hook-v
and LUA Plugin for Script Hook
https://www.gta5-mods.com/tools/lua-plugin-for-script-hook-v
Put the shockwave.lua in your Grand Theft Auto V\scripts\addins folder.
Usage:
Press "+" key in number area on your keyboard to release shockwave, press multiple time to make it more powerful.
First Uploaded: May 20, 2015
Last Updated: August 02, 2015
Last Downloaded: 3 days ago
54 Comments
Shockwave [LUA]
What's new in 1.0.2:
Keep function call parameter type up to date.
Feature:
Push nearby objects away with shockwaves.
Install:
Dependency:
Script Hook
https://www.gta5-mods.com/tools/script-hook-v
and LUA Plugin for Script Hook
https://www.gta5-mods.com/tools/lua-plugin-for-script-hook-v
Put the shockwave.lua in your Grand Theft Auto V\scripts\addins folder.
Usage:
Press "+" key in number area on your keyboard to release shockwave, press multiple time to make it more powerful.
What's new in 1.0.2:
Keep function call parameter type up to date.
Feature:
Push nearby objects away with shockwaves.
Install:
Dependency:
Script Hook
https://www.gta5-mods.com/tools/script-hook-v
and LUA Plugin for Script Hook
https://www.gta5-mods.com/tools/lua-plugin-for-script-hook-v
Put the shockwave.lua in your Grand Theft Auto V\scripts\addins folder.
Usage:
Press "+" key in number area on your keyboard to release shockwave, press multiple time to make it more powerful.
First Uploaded: May 20, 2015
Last Updated: August 02, 2015
Last Downloaded: 3 days ago
This doesn't work, can you please update it?
Just updated to the latest version of the LUA plugin and had to change line 20 from a "1" back to "true". Obviously the developer who create the LUA plugin defined that function incorrectly in the previous version, so if you update to the latest one you'll need to change it back!
@Pinback Was that meant to be to me?
On line 20 i have "function shockwave.tick()"
@lolrazz No, my comment was for anyone who had followed my previous comments about changing that line.
@Pinback Okey then!
You seem to know Lua tho, it broke for me when i updated to the last Lua, you know why? None of the two works.
@lolrazz Mine broke also! Use a text editor of your choice to load the "Shockwave.lua" file and look for the following line:
ENTITY.APPLY_FORCE_TO_ENTITY(entity, 1, distanceRate*dx,distanceRate*dy,distanceRate*dz, math.random()*math.random(-1,1),math.random()*math.random(-1,1),math.random()*math.random(-1,1), true, false, true, true, true, true)
This is the *CORRECTED* line directly from my file. Either manually compare this to your file very carefully and make any corrections, or just cut and paste this line over the matching line in your file. That should fix it!
Good luck!
@Pinback I did copy the whole line, didnt work for me :( Tryd both of them using notepad++.
You minde upload yours?
@Pinback NVM! Reinstalld the mod and only chanched "ENTITY.APPLY_FORCE_TO_ENTITY(entity, 1,"
The original hase true not 1.
Also, if you have the knowledge, can you make some other button ragdoll and only force peds?
@lolrazz I'm just glad you got it working!
And as far as peds go, I removed that code from my "runs continuously" version because I only wanted vehicles pushed. But in the original version the vehicle and peds code are both there. You can easily tell both sections of code because they both begin with "Table,Count =". The top section is vehicles, and the one beneath it is peds. So if you want to force just peds, you can comment out or delete the vehicle section of code above. If you want to get a bit more sophisticated, you can also create a second "if" statement that checks for a different key and move the peds code there. That would let you have one key for forcing vehicles and another for forcing peds... all in the same program.
@Pinback Wow, that was to deep for me haha, just want the original "+" to force both peds and cars and the "enter" underneath + to force only peds.
Also, force peds are abit bugged, they dont ragdoll unless there is a object nerby?
@lolrazz The code below should do mostly what you want. You might have to adjust the "ENTITY.APPLY_FORCE_TO_ENTITY" line again... that is what works for the version of lua that I have, but your mileage may vary. For unknown reasons I also couldn't get the "Enter" key on the keypad to work, so I'm using the "-" (minus) key above the "+" key instead. "+" key forces vehicles and peds, "-" key forces peds only. You'll see the word "Subtract" in the code so you can make it anything you want. I played around, but couldn't find any better way to ragdoll the peds than what the original author did (they ragdoll on collision with anything). Hope this helps!
local shockwave = {}
local keyPressed1 = false
local keyPressed2 = false
local force = 60
function applyForce(playerCoord, entity)
local coord=ENTITY.GET_ENTITY_COORDS(entity,true)
local dx=coord.x - playerCoord.x
local dy=coord.y - playerCoord.y
local dz=coord.z - playerCoord.z
local distance=math.sqrt(dx*dx+dy*dy+dz*dz)
local distanceRate=(force/distance)*math.pow(1.04,1-distance)
ENTITY.APPLY_FORCE_TO_ENTITY(entity, 1, distanceRate*dx,distanceRate*dy,distanceRate*dz, math.random()*math.random(-1,1),math.random()*math.random(-1,1),math.random()*math.random(-1,1), true, false, true, true, true, true)
end
function shockwave.tick()
if (get_key_pressed(Keys.Add)) then
keyPressed1 = true
elseif keyPressed1 then
keyPressed1 = false
local player = PLAYER.PLAYER_PED_ID()
local playerCoord=ENTITY.GET_ENTITY_COORDS(player,true)
local Table,Count = PED.GET_PED_NEARBY_VEHICLES(player, 1)
local playerVehicle = PLAYER.GET_PLAYERS_LAST_VEHICLE()
local inVehicle=PED.IS_PED_IN_VEHICLE(player,playerVehicle,true)
for k,v in ipairs(Table) do
if(not inVehicle or playerVehicle ~= v) then
-- ENTITY.SET_ENTITY_CAN_BE_DAMAGED(v,true)
-- VEHICLE.DISABLE_VEHICLE_IMPACT_EXPLOSION_ACTIVATION(v,true)
applyForce(playerCoord, v)
end
end
Table,Count = PED.GET_PED_NEARBY_PEDS(player, 1,1)
for k,v in ipairs(Table) do
PED.SET_PED_RAGDOLL_ON_COLLISION(v,true)
PED.SET_PED_RAGDOLL_FORCE_FALL(v)
applyForce(playerCoord, v)
end
end
if (get_key_pressed(Keys.Subtract)) then
keyPressed2 = true
elseif keyPressed2 then
keyPressed2 = false
local player = PLAYER.PLAYER_PED_ID()
local playerCoord=ENTITY.GET_ENTITY_COORDS(player,true)
Table,Count = PED.GET_PED_NEARBY_PEDS(player, 1,1)
for k,v in ipairs(Table) do
PED.SET_PED_RAGDOLL_ON_COLLISION(v,true)
PED.SET_PED_RAGDOLL_FORCE_FALL(v)
applyForce(playerCoord, v)
end
end
end
return shockwave
@Pinback
Holy shit! You are awsome! Thnx <3
@Pinback
Thanks for the info. It works. :)
uploading video for the mods
hey,nice mod i really like it but it's really annoying the fact that i need alwasy to press "+" i mean when im shooting to cops i can't just take away my hand from the mouse just to press +,can you make a config file to change the key?
@Pinback
Good day bro. I`ve found this mod wonderful and i completely agree with u. I think it would be better if the mod had the shockwave being continously activated
I`ve tried all of your instruction and also copy-pasting the script u`ve shared but sadly it wont work. Maybe an alignment problem? i dont know, Im not a tech guy
I humbly request that u can share the working code via pastebin. so i can understand completely about the script
sorry for my bad english
@Pinback
Hey, I`ve carefully followed your guide and eventually it works, thanks a lot
I have another question tough. I want to reduce the area radius (probably 5 meters before the impact kicks in), and also the force power (i prefer a little push rather than throw the entities so hrad that they blows up)
I tried to change the valeu of -local force- -local distance- and -local distanceRate-
but it doesnt work and made the force power even more powerful
could you help me to reduce the range and force power please
<3 Nice mod!
I like it same as the game NFS Rivals in vehicle
@Pinback Hey man you can change it to Subtract which is pedestrian + which is car and you can separate them