Hello guys,
I am trying to get a script to spawn a ped when i enter an interior, but i'm facing some problems.
I tried studying the lua files for bdorm and etc to try to understand how it spawns npcs but for now it's too complicated ... I can't manage to understand how the Spawnlocation and docklocation works.
So I did a simple lua script.
The problem is, If I get the script to run without a loop in the function or above the main loop, the game will only read my script once so If I don't load the game in the interior the ped is gone and it will not spawn again if I exit the interior. And if I put the script in a loop, the game will spawn too many npcs until the game crashes.
I tried to study Altamurenza's public sources and learn a way to do that but those scripts are something else xD I can't make sense of them. He made a mod with a public source exactly with the functionality I am looking for, he spawned preps in the prephouse, i'm trying to make a mod to make the hideouts populated.
How would you guys do it?
Populatedhideout_mod = function()
if AreaGetVisible() == 59 then
local x,y,z = GetPlayerPosXYZ()
local ped = PedCreateXYZ(ID,x,y,z)
PedMakeAmbient(ped)
end
end