Quantcast

Jump to content

» «
Photo

Trying to modify a script in Lua

No replies to this topic
Kosdemo
  • Kosdemo

    Player Hater

  • Members
  • Joined: 08 May 2015
  • Canada

#1

Posted 09 May 2015 - 01:03 PM

The following script is for "Inner Force" by Kokolaty on GTA5-mods.

local inner_force = {}

local subtract_pressed=false
local dict = "[email protected]"
local anim = "meditiate_idle"
function inner_force.unload()
end
function inner_force.init()
	STREAMING.REQUEST_ANIM_DICT(dict)
end
function inner_force.tick()
	if(get_key_pressed(Keys.Subtract))then
		subtract_pressed = true
	elseif subtract_pressed then
		subtract_pressed=false
		local player = PLAYER.PLAYER_PED_ID()
		local pos = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(player, 0.0, 0.0, -1)
		
		
		local Table,Count = PED.GET_PED_NEARBY_VEHICLES(player, 1)
		for k,v in ipairs(Table) do
			ENTITY.APPLY_FORCE_TO_ENTITY(v, 1, 0,0,4, 0,0,0, 1, false, true, true, true, true)
				-- param 10 : ignore entity up vector
			AI.TASK_PLAY_ANIM( player, dict, anim, 1, 1, -1, 16, 0, false, 0, false)
			end
		
	end
	
end

return inner_force

Here is what I'm trying to change with this script. The function calling PED.GET_PED_NEARBY_VEHICLES I believe is what tells the script what condition must be met to activate it and I want to replace it with GET_PLAYER_TARGET_ENTITY(Player player, Entity *entity) which if my understanding is proper, means the condition is simply that my character is looking at the target.

 

Basically I want to make the script target individuals instead of everything. It might be best to use free aiming as the means of targetting but I am still learning. Additionally I plan on working toward functionality to make it possible to add additional forces when a player has effected a target with the first force lifting them but based on what key the player hits.

 

Example: Player lifts target, press A and force is applied that throws the target to the left of the player or D for right, W for forward and S for behind but only so long as the activation button is pressed.

 

What are your guys thoughts? Possible?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users