Quite a bit of mistakes in this section:
You havnt typed in something to do. The peds just stand there bucuse they have no order to do something.
PedAttack(gplayer, Ped1)
Will make Ped1 attack the player.
You wrote the code wrong. It's actually PedAttack(Ped1, gPlayer, 0-3) Now, I know the 0-3 has something to do with aggression, but all I know is that 3 makes it so that the ped in question focuses on the ped they're attacking and ignores any attacks against him or her until they knock out the ped they're set to attack.
Thanks but how come they dont show up anywhere else? Is there a way to make it so they show up every where else just like the other peds? They only stay there and only there. I would like to see them at school and town as the others.
They stand there because they have no lua command to do something.
The thing is, these lua commands are for specific spawns. Not randomized spawning. That's done through Trigger.
This code will spawn 4 greasers there but somehow they don't walk around or do anything, just stand there and stare
GlobalImportScript("SObjTest.lua")
ImportScript("Library/LibTable.lua")
ImportScript("SZone.lua")
l_0_0 = 60
MissionSetup = function()
local l_1_0 = 515
local l_1_1 = 504
local l_1_2 = 19.60971009
AreaTransitionXYZ(0, l_1_0, l_1_1, l_1_2)
Ped1 = PedCreateXYZ(28, 516, 504, 19.60971009)
Ped2 = PedCreateXYZ(26, 517, 504, 19.60971009)
Ped3 = PedCreateXYZ(24, 518, 504, 19.60971009)
Ped4 = PedCreateXYZ(27, 519, 504, 19.60971009)
end
F_MissionSetup = function()
PlayerSetControl(1)
CameraFollowPed(gPlayer)
ClockSet(9, 30)
ClockSetTickRate(0.0060000000521541)
LaunchScript("SObjTest.lua")
end
MissionCleanup = function()
ClearTextQueue()
EnablePOI()
gMissionRunning = false
shared.gMissionEventFunction = nil
WeatherRelease()
PlayerSetControl(1)
PlayerSetPunishmentPoints(0)
end
main = function()
F_MissionSetup()
gMissionRunning = true
while gMissionRunning do
UpdateTextQueue()
Wait(0)
end
end
You forgot one thing:
Ped1 = PedCreateXYZ(28, 516, 504, 19.60971009)
Ped2 = PedCreateXYZ(26, 517, 504, 19.60971009)
Ped3 = PedCreateXYZ(24, 518, 504, 19.60971009)
Ped4 = PedCreateXYZ(27, 519, 504, 19.60971009)
Has to be like this
local Ped1 = PedCreateXYZ(28, 516, 504, 19.60971009)
local Ped2 = PedCreateXYZ(26, 517, 504, 19.60971009)
local Ped3 = PedCreateXYZ(24, 518, 504, 19.60971009)
local Ped4 = PedCreateXYZ(27, 519, 504, 19.60971009)
However, if you're writing a complex script, what you will want to do is first assign the locals in MissionSetup as follows:
local Ped1 = nil
local Ped2 = nil
local Ped3 = nil
local Ped4 = nil
and THEN write the spawn code later as follows:
Ped1 = PedCreateXYZ(28, 516, 504, 19.60971009)
Ped2 = PedCreateXYZ(26, 517, 504, 19.60971009)
Ped3 = PedCreateXYZ(24, 518, 504, 19.60971009)
Ped4 = PedCreateXYZ(27, 519, 504, 19.60971009)