Bully-Board

Bully Modding Section => Modding Questions/Help => Modding Questions/Help Archives => Topic started by: DreamEvo on June 08, 2013, 08:22:35 PM

Title: Spwaning Peds.
Post by: DreamEvo on June 08, 2013, 08:22:35 PM
If i were to spawn a few greasers in the preps side of town where the basketball courts are, I know i have to get the coorandents of it but how would i spawn them there?
Title: Re: Spwaning Peds.
Post by: Mick3Mouse on June 09, 2013, 08:11:24 AM
You will get the cordinates and then you will type in

Ped1 = PedCreateXYZ(23, l_1_0 + 2, l_1_1 + 2, l_1_2 + 2)

This code will spawn Johhny.

:)
Title: Re: Spwaning Peds.
Post by: DreamEvo on June 10, 2013, 04:49:03 PM
Thanks, is that the location of the place?
Title: Re: Spwaning Peds.
Post by: Mick3Mouse on June 12, 2013, 07:24:19 AM
No

This picture shows you were you put the cordinates.

(http://i44.tinypic.com/2zix4s9.jpg)

Tell me if you want more help
Title: Re: Spwaning Peds.
Post by: SWEGTA on June 12, 2013, 07:46:18 AM
^False.
You don't need coordinates in order to spawn something.

You can simply just type in the coordinates in

Ped1 = PedCreateXYZ(23, x, y, z)
Replace x, y and z where your coords are.
Title: Re: Spwaning Peds.
Post by: Mick3Mouse on June 12, 2013, 09:27:53 AM
i didnt know that. Thanks!   :)
Title: Re: Spwaning Peds.
Post by: Mick3Mouse on June 12, 2013, 09:28:18 AM
But you can type up there also
Title: Re: Spwaning Peds.
Post by: deadpoolXYZ on June 12, 2013, 02:56:27 PM
^False.
You don't need coordinates in order to spawn something.

You can simply just type in the coordinates in

Ped1 = PedCreateXYZ(23, x, y, z)
Replace x, y and z where your coords are.

Both codes are correct but using locals is cleaner.
Title: Re: Spwaning Peds.
Post by: DreamEvo on June 12, 2013, 05:40:21 PM
I keep on messing up on the code. Can someone help me with it? Its the basketball courts on the rich side of town.
Title: Re: Spwaning Peds.
Post by: Phap on June 12, 2013, 09:06:02 PM
Which greasers you want to spawn there?
Title: Re: Spawning Peds.
Post by: Phap on June 12, 2013, 09:24:27 PM
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 
Title: Re: Spwaning Peds.
Post by: DreamEvo on June 13, 2013, 01:05:48 AM
Thanks man and thats weird.
Title: Re: Spwaning Peds.
Post by: DreamEvo on June 13, 2013, 05:06:45 AM
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.
Title: Re: Spwaning Peds.
Post by: Mick3Mouse on June 13, 2013, 05:57:32 AM
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.

PedRecriutAlly(gplayer, Ped1)
Will make ped1 to your bodygaurd.

for example


Title: Re: Spwaning Peds.
Post by: Red Blaster on June 13, 2013, 06:58:54 AM
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)
Title: Re: Spwaning Peds.
Post by: Mick3Mouse on June 13, 2013, 09:58:50 AM
All codes works.   
Title: Re: Spwaning Peds.
Post by: Red Blaster on June 13, 2013, 03:21:13 PM
The spawning code example I wrote is the safest example.

But the PedAttack code, you wrote it wrong. You set for Jimmy, not the other ped.
Title: Re: Spwaning Peds.
Post by: Mick3Mouse on June 13, 2013, 04:53:19 PM
Yes but i think he understands that he shall have the peds name there.

But you dont need to type 0-3)  you can just type in  PedAttack(Ped, Ped)

Both one works  :)
Title: Re: Spwaning Peds.
Post by: Red Blaster on June 13, 2013, 06:30:33 PM
I know what you mean, but let me explain.

If you define the local name as nil in MissionSetup, you can then define it differently in separate functions without worrying about potential conflicts or glitches. It's the cleanest way.

As for PedAttack, I was just saying that 0-3 has an effect on their fight behavior (keep attacking until the ped is knocked out, or whether they can be distracted by another ped, etc.).
Title: Re: Spwaning Peds.
Post by: Phap on June 13, 2013, 07:41:42 PM
Is there a code to have the spawned ped do normal actions like walk around or talk with other clique members?
Title: Re: Spwaning Peds.
Post by: Phap on June 13, 2013, 08:18:49 PM
Look my Greasers vs Preppies video:
Bully Scholarship Edition Greasers vs Preppies - Final Showdown At The Basketball Court (http://www.youtube.com/watch?v=_y2yiSJUl-w#)
Title: Re: Spwaning Peds.
Post by: Red Blaster on June 13, 2013, 09:09:49 PM
Is there a code to have the spawned ped do normal actions like walk around or talk with other clique members?

Yes. IIRC, PedWander makes them move around.

There is another code like PedisWantingToSocialize or something like that, which makes two peds talk to each other.

A group conversation though can only be done either through a combo of lua and trigger (easier way), or through a complex table (hard way).