Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. Gameplay
      2. Missions
      3. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Arena War
      2. After Hours
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA Next

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

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

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

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

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

    2. Forum Support

    3. Site Suggestions

headscript

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

Recommended Posts

xsploit

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

Share this post


Link to post
Share on other sites
headscript

 

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

Share this post


Link to post
Share on other sites
Snuki

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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
Chumillas

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
headscript

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

nil you get the entity as result back :)

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
RevWK

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

Share this post


Link to post
Share on other sites
xsploit

 

 

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
ffzero58

@headscript:

 

Thanks for all the hard work here.

 

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
ffzero58

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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
ffzero58

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

 

I can wait. Thanks!

Edited by ffzero58

Share this post


Link to post
Share on other sites
xsploit

 

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

Share this post


Link to post
Share on other sites
sakis25

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.

Share this post


Link to post
Share on other sites
everesee

The link is dead. Anyone have another link?

Share this post


Link to post
Share on other sites
Chumillas

The link is dead. Anyone have another link?

edit: already fixed

Edited by Chumillas

Share this post


Link to post
Share on other sites
sakis25

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

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

Share this post


Link to post
Share on other sites
sakis25

 

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?

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
Swarm96

headscript does this work with the new ScripthookV?

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 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.