0 files liked
21 comments
3 videos
4 uploads
4 followers
13,067 downloads
@keyofrassilon13
Hey, thanks a lot — glad it's what you're looking for!
Good news: nothing's really missing for that. MP freemode models work like any other model name. One gotcha: freemode
peds spawn with empty components, so call SET_PED_DEFAULT_COMPONENT_VARIATION right after spawning to clothe them. For
companions, set the ped's relationship group to the player's group and add it as a group member — it'll follow and defend
you.
Here's a complete working example — drop it in pyscript/, press F5 in game to spawn a freemode companion:
import gta
from gta import player, world, ui
from gta.natives.ped import (
SET_PED_DEFAULT_COMPONENT_VARIATION,
SET_PED_RELATIONSHIP_GROUP_HASH,
SET_PED_AS_GROUP_MEMBER,
SET_PED_NEVER_LEAVES_GROUP,
SET_PED_COMBAT_ATTRIBUTES,
)
from gta.natives.player import PLAYER_ID, GET_PLAYER_GROUP
from gta.natives.entity import GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS
from gta.natives.misc import GET_HASH_KEY
from gta.natives.weapon import GIVE_WEAPON_TO_PED
_spawn = False
def make_companion():
me = player.current().ped
# spawn just in front of the player
pos = GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(me.handle, 0.0, 2.0, 0.0)
comp = world.create_ped("mp_m_freemode_01", pos, heading=0.0, ped_type=26)
if comp is None:
ui.notify("~r~model failed to load")
return
# freemode peds spawn empty — give them the default outfit
SET_PED_DEFAULT_COMPONENT_VARIATION(comp.handle)
# join the player's group so it follows and fights for you
SET_PED_RELATIONSHIP_GROUP_HASH(comp.handle, GET_HASH_KEY("PLAYER"))
SET_PED_AS_GROUP_MEMBER(comp.handle, GET_PLAYER_GROUP(PLAYER_ID()))
SET_PED_NEVER_LEAVES_GROUP(comp.handle, True)
SET_PED_COMBAT_ATTRIBUTES(comp.handle, 46, True) # can use cover/fight
GIVE_WEAPON_TO_PED(comp.handle, GET_HASH_KEY("WEAPON_CARBINERIFLE"),
999, False, True)
ui.notify("~g~Companion spawned")
def on_key_down(vk, down, shift, ctrl, alt):
global _spawn
if down and vk == 0x74: # F5
_spawn = True
def on_tick():
# heavy work (model streaming) must run here, not in on_key_down
global _spawn
if _spawn:
_spawn = False
make_companion()
The one thing to watch: model streaming needs a script fiber, so spawn from on_tick (or on_start), not directly inside
on_key_down — that's why the example uses a pending flag.
@Jhoson12 hi, For the AI, you can provide it with the syntax_guide.html file so it can understand it. As for the folder, you need to create a folder named "pyscript" in the root directory (where the GTA .exe file is located) and place it there. If you need more details, don't hesitate to ask
0.7 update:
Huge performance and stability boost, with execution speeds averaged at 2.5x and up to 3.3x faster in some cases. Also features the introduction and full update of the brand-new blueprint editor (for devs).
0.6 update:
Complete rewrite of the mod; it no longer requires ScripthookVDotNet to run. Basically, we now have:
- ScripthookV: for C++
-scripthookvdotnet: for C#
-PyloaderV: for Python
This is a test version; it should work fine, but if you encounter any issues, you can revert to version 0.5.1.
@Zazerim55 It's the same as on Enhanced normally.
@mitto_backup Do you have any other mods besides pyloader? If so, which ones? And did you download shvdn from the link?
0.4 update:
You can now control the priority of file generation with __priority__.
Example:
file1.py __priority__ = 2
file2.py __priority__ = 1
In this example, file2.py will be executed before file1.py because its priority is higher (the number is lower).
Cool, it's nice to see people testing pyloader :)
@Aztecz8798 It says “enhanced,” but normally it should be compatible with both versions.
@dimedius Hi, thanks for the feedback. Regarding camShake, you need to add [bool]
Function.Call[bool](Hash.IS_GAMEPLAY_CAM_SHAKING)
instead of:
camShakeTrue = Function.Call(Hash.IS_GAMEPLAY_CAM_SHAKING)
because otherwise Function.Call returns None/Void.
This is due to IronPython, which sometimes has trouble guessing the return value, as Python is a dynamic language and not a static one.
As for VSCode, I'm currently working on making it compatible with autocompletion.