Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Forum Support

    3. Suggestions

[V|REL|HOOK] LUA Plugin for Script Hook V


headscript
 Share

Recommended Posts

Nearby peds doesn't work yet

dammit thanks. Still trying to make a simple zombie mod. First thing i have to do is set all the peds models to the zombie one, so i was going to try with nearby peds and maybe change the model?

 

I don't know anything wheres you can find all peds on the map

Edited by xsploit
Link to comment
Share on other sites

 

Nearby peds doesn't work yet

dammit thanks. Still trying to make a simple zombie mod. First thing i have to do is set all the peds models to the zombie one, so i was going to try with nearby peds and maybe change the model?

 

I don't know anything wheres you can find all peds on the map

 

im not sure if u can yet but im going to fix it soon

Link to comment
Share on other sites

Can someone tell me why this doesn't work?

local water = {}function water.unload()endfunction water.init()endfunction water.tick()	if(get_key_pressed(96)) then		WATER.MODIFY_WATER(0,0,0,0)	endendreturn water

No matter what the value is set to it does nothing.

Link to comment
Share on other sites

MadmanKThree

How do i use

 

GET_PLAYER_TARGET_ENTITY(Player player, Entity *entity)

 

I understand the player part and i know the entity* is a pointer,but lua doesn't have pointers

Link to comment
Share on other sites

How do i use

 

GET_PLAYER_TARGET_ENTITY(Player player, Entity *entity)

 

I understand the player part and i know the entity* is a pointer,but lua doesn't have pointers

That only works when you aim with right click, doesn't work with guns, only fist

Link to comment
Share on other sites

MadmanKThree

How do i use

 

GET_PLAYER_TARGET_ENTITY(Player player, Entity *entity)

 

I understand the player part and i know the entity* is a pointer,but lua doesn't have pointers

That only works when you aim with right click, doesn't work with guns, only fist

 

 

i know,but what do i use for the second argument,lua doesnt have pointers

Edited by MadmanKThree
Link to comment
Share on other sites

i know,but what do i use for the second argument,lua doesnt have pointers

nil you get the entity as result back :)

Link to comment
Share on other sites

MadmanKThree

i know,but what do i use for the second argument,lua doesnt have pointers

nil you get the entity as result back :)

i tried using nil but all i get is an error saying number expected

Link to comment
Share on other sites

I'm new to Lua scripting and I know jack about coding in any language, so obviously it was a great idea to try to come up with my own script. Like everyone and his dog, I'm trying to crank out a simple zombie mod. I've run into two issues.

First, no matter how many NPCs I spawn, only *three* will have an active AI. The rest will stand around blinking until I move out of range of one of the others or I kill one of the active AIs. I don't even know where to begin with that one.

 

Second, I've discovered a curious thing: different NPC hashes have different behaviors. If I spawn some marines with the code below, they will proceed to immediately beat me to death. If I spawn "zombies" (which are just the civilian in costume), they will (a) try to fight me if I have my fists out or (b) run away if I have a gun equipped. Marine behavior ignores my equipped weapon. Zombie behavior changes depending on my equipped weapon. There's a native SET_PED_FLEE_ATTRIBUTES, but I can't figure out how, or even if, it works.

local zeds = {}zombie_toggle_key_code = 73function zeds.tick()	local playerPed = PLAYER.PLAYER_PED_ID()	local player = PLAYER.GET_PLAYER_PED(playerPed)	local playerExists = ENTITY.DOES_ENTITY_EXIST(playerPed)	if not playerExists then		return	end		if(get_key_pressed(zombie_toggle_key_code)) then						local zedskinID = GAMEPLAY.GET_HASH_KEY("u_m_y_zombie_01")				local coords = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0, 5.0, 0.0)				STREAMING.REQUEST_MODEL(zedskinID)				local zed = PED.CREATE_PED(26, zedskinID, coords.x, coords.y, coords.z, 0, false, true)								PED.SET_PED_AS_ENEMY(zed, true)				AI.TASK_COMBAT_PED(zed, playerPed, 0, 0)							--[[ 	unsure if these actually work				AI.SET_PED_PATH_CAN_USE_CLIMBOVERS(zed, true) 				AI.SET_PED_PATH_CAN_USE_LADDERS(zed, true) 				AI.SET_PED_PATH_CAN_DROP_FROM_HEIGHT(zed, true)				PED.ADD_ARMOUR_TO_PED(zed, 200)				PED.SET_PED_MAX_HEALTH(zed, 250)				PED.SET_PED_DIES_WHEN_INJURED(zed, false)				PED.SET_PED_SUFFERS_CRITICAL_HITS(zed, false)			]]--								ENTITY.SET_PED_AS_NO_LONGER_NEEDED(zed)					endendreturn zeds
Link to comment
Share on other sites

 

 

Nearby peds doesn't work yet

dammit thanks. Still trying to make a simple zombie mod. First thing i have to do is set all the peds models to the zombie one, so i was going to try with nearby peds and maybe change the model?

 

I don't know anything wheres you can find all peds on the map

 

im not sure if u can yet but im going to fix it soon

 

well someone in .net just figured out how to get all peds and vehicles in game and it's exactly what i need

https://github.com/crosire/scripthookvdotnet/commit/f9b663750e8436ee41d04016210fcfd22c587abf

Link to comment
Share on other sites

headscript

Im Currently making this to work(hopefully already in next version)

 

local Table,Count = PED.GET_PED_NEARBY_PEDS(PLAYER.PLAYER_PED_ID(), 0, -1)

for k,v in ipairs(Table) do
print("PED ID"..v)
end
Link to comment
Share on other sites

@headscript:

 

Thanks for all the hard work here.

 

Will AI.TASK_PLAY_ANIM and any related animation functions be fixed in the next release?

Link to comment
Share on other sites

headscript

@headscript:

 

Thanks for all the hard work here.

 

Will AI.TASK_PLAY_ANIM and any related animation functions be fixed in the next release?

tell me all the functions you want to have fixed ^^ (please not more than 10 )

and before i release the next version ^^

Edited by headscript
Link to comment
Share on other sites

AI.TASK_PLAY_ANIM

PED.PLAY_FACIAL_ANIM

GAMEPLAY.DISPLAY_ONSCREEN_KEYBOARD

 

On another note, AI.TASK_VEHICLE_ESCORT only makes the driver turn its wheel but does not drive forward. I wonder what is needed to trigger driving.

Link to comment
Share on other sites

headscript

AI.TASK_PLAY_ANIM

PED.PLAY_FACIAL_ANIM

GAMEPLAY.DISPLAY_ONSCREEN_KEYBOARD

 

On another note, AI.TASK_VEHICLE_ESCORT only makes the driver turn its wheel but does not drive forward. I wonder what is needed to trigger driving.

And you took to long :/ AI.TASK_PLAY_ANIM is fixed in the current version the others are marked for future change thanks :*

 

New Version out 9.0:

Changelog

Edited by headscript
Link to comment
Share on other sites

No hard feelings - at least I can play with the animations :)

 

I can wait. Thanks!

Edited by ffzero58
Link to comment
Share on other sites

 

AI.TASK_PLAY_ANIM

PED.PLAY_FACIAL_ANIM

GAMEPLAY.DISPLAY_ONSCREEN_KEYBOARD

 

On another note, AI.TASK_VEHICLE_ESCORT only makes the driver turn its wheel but does not drive forward. I wonder what is needed to trigger driving.

And you took to long :/ AI.TASK_PLAY_ANIM is fixed in the current version the others are marked for future change thanks :*

 

New Version out 9.0:

Changelog

 

I used the patch and it's been crashing wheni use that code

Edited by xsploit
Link to comment
Share on other sites

Great update!

Finally we have animations. Is there any list with the available animation names?

I need a sample on how to use this. AI.TASK_PLAY_ANIM

Thank you.

Link to comment
Share on other sites

Chumillas

The link is dead. Anyone have another link?

edit: already fixed

Edited by Chumillas
Link to comment
Share on other sites

I need a sample on how to use this. AI.TASK_PLAY_ANIM

Also why I can't see the console on this version?

Link to comment
Share on other sites

 

I need a sample on how to use this. AI.TASK_PLAY_ANIM

Also why I can't see the console on this version?

use the sdk version

AI::TASK_PLAY_ANIM(pedid, "[email protected][email protected]@[email protected]@base", "base" ....

 

 

Thank you I will try it.

Also Ctrl+R is not working at all so I can't reload the scripts. And how can I make the console to show up?

Link to comment
Share on other sites

headscript

 

 

I need a sample on how to use this. AI.TASK_PLAY_ANIM

Also why I can't see the console on this version?

use the sdk version

AI::TASK_PLAY_ANIM(pedid, "[email protected][email protected]@[email protected]@base", "base" ....

 

 

Thank you I will try it.

Also Ctrl+R is not working at all so I can't reload the scripts. And how can I make the console to show up?

 

download the SDK version

Link to comment
Share on other sites

Foul_Play

I don't know if it is my script or it is the Lua SDK because I'm getting this error: "unload: attempt to call a nil value"

 

Even without the code it still has that error. This only happened since I've updated the Lua SDK.

 

Please help.

 

Thanks.

 

With Code:

 

 

function bodyguardScript.unload()  for k, guard in pairs(guards) do    if (guard ~= nil) then      PED.DELETE_PED(guard)      guards[k] = nil      bodyguardCount = 0    end  endend

 

 

 

Without code still causes that error:

 

 

function bodyguardScript.unload()end

 

 

Edited by Foul_Play
Link to comment
Share on other sites

headscript

I don't know if it is my script or it is the Lua SDK because I'm getting this error: "unload: attempt to call a nil value"

 

Even without the code it still has that error. This only happened since I've updated the Lua SDK.

 

Please help.

 

Thanks.

 

With Code:

 

 

function bodyguardScript.unload()  for k, guard in pairs(guards) do    if (guard ~= nil) then      PED.DELETE_PED(guard)      guards[k] = nil      bodyguardCount = 0    end  endend

 

 

 

Without code still causes that error:

 

 

function bodyguardScript.unload()end

 

 

and you Sir just found a bug :) (no actually i forogt to update the main.lua in the zip sorry)

 

headscript does this work with the new ScripthookV?

yes apart from the bug mentioned above which i will fix instantly

 

-Fixed just redownload it -

Edited by headscript
Link to comment
Share on other sites

Foul_Play

Thanks Headscript!

 

PS: Not to offend but it'll be nice if you can make your code readable.

 

Edit:

 

I can help you with that if you want help if you're going to make it readable.

 

 

 

 

I don't know if it is my script or it is the Lua SDK because I'm getting this error: "unload: attempt to call a nil value"

 

Even without the code it still has that error. This only happened since I've updated the Lua SDK.

 

Please help.

 

Thanks.

 

With Code:

 

 

function bodyguardScript.unload()  for k, guard in pairs(guards) do    if (guard ~= nil) then      PED.DELETE_PED(guard)      guards[k] = nil      bodyguardCount = 0    end  endend

 

 

 

Without code still causes that error:

 

 

function bodyguardScript.unload()end

 

 

and you Sir just found a bug :) (no actually i forogt to update the main.lua in the zip sorry)

 

headscript does this work with the new ScripthookV?

yes apart from the bug mentioned above which i will fix instantly

 

-Fixed just redownload it -

 

 

 

Edited by Foul_Play
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.