News: Welcome back to Bullworth! If you haven't already, you will need to reset your password..


Author Topic: How to spawn a weapon to the freeroam ped?  (Read 7453 times)

0 Members and 2 Guests are viewing this topic.

Offline Rambo7

  • "Awesomely Kick-Ass Troll"
  • Full Member
  • ***
  • Posts: 404
  • Gender: Male
  • #ZAMBess
    • View Profile
    • My ModDB Page
How to spawn a weapon to the freeroam ped?
« on: May 02, 2015, 01:55:30 PM »
I had a question and here it is:
How do we spawn a weapon to the freeroam ped?
Well, actually I want to do this for my GTA Character Skin Mod, specificaly the GTA Wars, I want to equip the ped with spudgun or rocket launcher

I had already try using the classic method of pedstats.dat modding,
Changing the probability to 100 and set all the weapon slot to spudgun and rocket launcher
This method works well for Jimmy, but somehow it is not working for the freeroam ped, and the funny thing is when I go to the shop, the ped inside the shop is actually equip with the specific weapon that I had assign before.

Here is the tutorial about pedstats.dat
http://www.bully-board.com/index.php?topic=14626.30
The user, name Redblast posting in that thread actually had the same problem with me
So do you guys have a solution to this problem? Maybe from Lua?

Offline Rambo7

  • "Awesomely Kick-Ass Troll"
  • Full Member
  • ***
  • Posts: 404
  • Gender: Male
  • #ZAMBess
    • View Profile
    • My ModDB Page
Re: How to spawn a weapon to the freeroam ped?
« Reply #1 on: May 23, 2015, 11:26:18 PM »
Sorry for the bumps (cause I don't want to make another thead, asking the same question)
So does anyone know about this problem?

deadpoolXYZ

  • Guest
Re: How to spawn a weapon to the freeroam ped?
« Reply #2 on: May 23, 2015, 11:36:26 PM »
As far as I know the pedstats method only works for scripted events spawned peds. For example if you set 100% chance of spawning with the sledgehammer to Algie and you find him in freeroam, he won't have it. But, let's say you find him during a scripted event like vomiting in the fountain... then he will have it.
I'm not 100% sure about this since there are peds like the bullies and greasers who spawn with slingshots without any problem. Maybe they can only spawn with inventory weapons in pedstats.

Offline Rambo7

  • "Awesomely Kick-Ass Troll"
  • Full Member
  • ***
  • Posts: 404
  • Gender: Male
  • #ZAMBess
    • View Profile
    • My ModDB Page
Re: How to spawn a weapon to the freeroam ped?
« Reply #3 on: May 23, 2015, 11:52:10 PM »
Yeah, I notice that one too, funny it can only work for events ped
and btw I set the pedstat for the "nightweapon" into sledgehammer,
Play my game and wait till night but there is no single person holding any sledgehammer
Btw the "nightweapon" is used for spawning flashlight for the authority, but funny it is not working for any other weapons

Offline GaryHarrington

  • A Guy Who Likes Open World and FPS Games
  • Sr. Member
  • ***
  • Posts: 515
  • Gender: Male
  • Just Love Bully and GTA ...Nothing Interested
    • View Profile
Re: How to spawn a weapon to the freeroam ped?
« Reply #4 on: May 24, 2015, 10:01:08 PM »
On my PC,Change the propability can crash my game ._. why this happen?

well i already made a mod like that...ped with non-clique students won't spawn the weapon...but the prefects always spawned with spudgun anyway ._.

deadpoolXYZ

  • Guest
Re: How to spawn a weapon to the freeroam ped?
« Reply #5 on: May 24, 2015, 10:16:29 PM »
On my PC,Change the propability can crash my game ._. why this happen?

well i already made a mod like that...ped with non-clique students won't spawn the weapon...but the prefects always spawned with spudgun anyway ._.

That's because prefects only spawn through scripted spawn points and follow scripted paths. That's why you always see them spawning in the same specific spots and walking to the same places through the same paths.

Offline GaryHarrington

  • A Guy Who Likes Open World and FPS Games
  • Sr. Member
  • ***
  • Posts: 515
  • Gender: Male
  • Just Love Bully and GTA ...Nothing Interested
    • View Profile
Re: How to spawn a weapon to the freeroam ped?
« Reply #6 on: May 25, 2015, 02:06:06 AM »
On my PC,Change the propability can crash my game ._. why this happen?

well i already made a mod like that...ped with non-clique students won't spawn the weapon...but the prefects always spawned with spudgun anyway ._.

That's because prefects only spawn through scripted spawn points and follow scripted paths. That's why you always see them spawning in the same specific spots and walking to the same places through the same paths.

i said the weapons sir, not the spawn point and path ._. -_-

deadpoolXYZ

  • Guest
Re: How to spawn a weapon to the freeroam ped?
« Reply #7 on: May 25, 2015, 11:25:07 AM »
i said the weapons sir, not the spawn point and path ._. -_-

Read again dude.

I said that only scripted peds can spawn with weapons if you set them via pedstats.
Setting weapons to a prefect via pedstats always works because they only spawn through spawnpoints.

Offline AlphaTech

  • LostInSpace
  • Sr. Member
  • ***
  • Posts: 758
  • Gender: Male
  • The name's AlphaTECH, whatca need help with?! :)
    • View Profile
Re: How to spawn a weapon to the freeroam ped?
« Reply #8 on: May 26, 2015, 03:31:07 PM »
It's pretty simple to set a ped with a firearm. I used this method with my Zombie Mod Beta allowing Bucky to use the Spudgun all the time by doing this.

Code: [Select]
F_SpudGunFire2 = function()
  local x,y = -772,-123
  local r1 = x + 3.5
  local r2 = y + 3.5
  local r3 = x - 3.5
  local r4 = y - 3.5
  repeat
    Wait(0)
  until PedInRectangle(gPlayer,r1,r2,r3,r4)
 
  PedDismissAlly(gplayer, Troy)
  PedDismissAlly(Troy, Wade)
  PedDismissAlly(Wade, Tom)
 
  PedGuardPed(gplayer, Troy)
  PedGuardPed(gplayer, Tom)
  PedGuardPed(gplayer, Wade)
 
  PedAttackPlayer(Infected06, gPlayer,2)
 
  BlipRemove(Blip600)
 
  PedMoveToXYZ(gBucky, 3,  -772.3766, -123.5870, 7.3712)

  PedSetPedToTypeAttitude(gMelvin, 13, 0)
 
  PedAttackPlayer(gMelvin, gPlayer,2)
 
  PedSetWeapon(gMelvin, 305, 10000)
 
  PedSetPedToTypeAttitude(gBucky, 13, 0)
 
  PedAttackPlayer(gBucky, gPlayer,2)
 
  PedSetWeapon(gBucky, 305, 10000)
 
  PedSetWeaponNow(gBucky, 305, 20)
 
  SoundPlayStream("MS_TenementsHigh.rsm", 0.69999998807907)
 
  PedSetActionNode(gBucky, "/Global/N_Earnest/Offense/FireSpudGun", "Act/Anim/N_Earnest.act")

repeat
Wait(0)
if PedHasWeapon(gBucky, 305) and PedIsPlaying(gBucky, "/Global/N_Earnest/Offense/FireSpudGun", "Act/Anim/N_Earnest.act") then
Wait(8000)
PedSetActionNode(gBucky, "/Global/N_Earnest/Offense/FireSpudGun", "Act/Anim/N_Earnest.act")
end
Wait(400)
until not PedIsValid(gBucky) or PedIsDead(gBucky) or PedGetHealth(gBucky) < 1
end
PedHasWeapon and set a l_3_0 = false

Just remove the animation for the ped and set the PedHasWeapon and set a l_3_0 = false to true.
Code: [Select]
if PedHasWeapon and l_3_0 == false then
PedSetWeapon(WID)
end

Use this code to test setting weapons to peds. I also use these functions to open and close doors you can test this also.
« Last Edit: May 26, 2015, 03:37:16 PM by LostInSpace »

Offline ShadowRageEX

  • AKA ShadowCorn
  • Jr. Member
  • **
  • Posts: 85
  • Gender: Male
    • View Profile
Re: How to spawn a weapon to the freeroam ped?
« Reply #9 on: June 01, 2015, 06:16:40 AM »
Dream is right! I got the same question month's but then I find out that they will only use on scripted event's well I give Constantinos Brakus a shield and he was not wielding it but then someday's ago I was just wandering in bullworth academy then I saw a huge crowd cheering a fight and when I got there some bullies were fighting constantinos and he was wielding a shield! Same happened with norton he was using his Sledgehammer only on fight's

Offline Rambo7

  • "Awesomely Kick-Ass Troll"
  • Full Member
  • ***
  • Posts: 404
  • Gender: Male
  • #ZAMBess
    • View Profile
    • My ModDB Page
Re: How to spawn a weapon to the freeroam ped?
« Reply #10 on: June 03, 2015, 11:52:57 AM »
It's pretty simple to set a ped with a firearm. I used this method with my Zombie Mod Beta allowing Bucky to use the Spudgun all the time by doing this.

Code: [Select]
F_SpudGunFire2 = function()
  local x,y = -772,-123
  local r1 = x + 3.5
  local r2 = y + 3.5
  local r3 = x - 3.5
  local r4 = y - 3.5
  repeat
    Wait(0)
  until PedInRectangle(gPlayer,r1,r2,r3,r4)
 
  PedDismissAlly(gplayer, Troy)
  PedDismissAlly(Troy, Wade)
  PedDismissAlly(Wade, Tom)
 
  PedGuardPed(gplayer, Troy)
  PedGuardPed(gplayer, Tom)
  PedGuardPed(gplayer, Wade)
 
  PedAttackPlayer(Infected06, gPlayer,2)
 
  BlipRemove(Blip600)
 
  PedMoveToXYZ(gBucky, 3,  -772.3766, -123.5870, 7.3712)

  PedSetPedToTypeAttitude(gMelvin, 13, 0)
 
  PedAttackPlayer(gMelvin, gPlayer,2)
 
  PedSetWeapon(gMelvin, 305, 10000)
 
  PedSetPedToTypeAttitude(gBucky, 13, 0)
 
  PedAttackPlayer(gBucky, gPlayer,2)
 
  PedSetWeapon(gBucky, 305, 10000)
 
  PedSetWeaponNow(gBucky, 305, 20)
 
  SoundPlayStream("MS_TenementsHigh.rsm", 0.69999998807907)
 
  PedSetActionNode(gBucky, "/Global/N_Earnest/Offense/FireSpudGun", "Act/Anim/N_Earnest.act")

repeat
Wait(0)
if PedHasWeapon(gBucky, 305) and PedIsPlaying(gBucky, "/Global/N_Earnest/Offense/FireSpudGun", "Act/Anim/N_Earnest.act") then
Wait(8000)
PedSetActionNode(gBucky, "/Global/N_Earnest/Offense/FireSpudGun", "Act/Anim/N_Earnest.act")
end
Wait(400)
until not PedIsValid(gBucky) or PedIsDead(gBucky) or PedGetHealth(gBucky) < 1
end
PedHasWeapon and set a l_3_0 = false

Just remove the animation for the ped and set the PedHasWeapon and set a l_3_0 = false to true.
Code: [Select]
if PedHasWeapon and l_3_0 == false then
PedSetWeapon(WID)
end

Use this code to test setting weapons to peds. I also use these functions to open and close doors you can test this also.
I tried your code already, but it's not working well
I mean, I want to spawn a weapon to the freeroam peds (the peds that the game automaticly spawn),
not to a ped that I spawn manually (like using the pedcreate function)
You can easily spawn a weapon to a ped that spawn using pedcreate, but I have still no idea how to spawn to the freeroam peds

And I realise that some of the freeroam student ped in the school, spawn with books as their weapon

Offline AlphaTech

  • LostInSpace
  • Sr. Member
  • ***
  • Posts: 758
  • Gender: Male
  • The name's AlphaTECH, whatca need help with?! :)
    • View Profile
Re: How to spawn a weapon to the freeroam ped?
« Reply #11 on: July 14, 2015, 11:47:13 AM »
You would have to chane the probability in ped stats.
http://www.bully-board.com/index.php?topic=14626.0
Here is a link to how it works and (BUMP!) (CONFIRMED!)   ;D  :rolleyes:  8)

Offline Rambo7

  • "Awesomely Kick-Ass Troll"
  • Full Member
  • ***
  • Posts: 404
  • Gender: Male
  • #ZAMBess
    • View Profile
    • My ModDB Page
Re: How to spawn a weapon to the freeroam ped?
« Reply #12 on: July 14, 2015, 01:08:53 PM »
^ yeah, I know
I actually stated it before and changing the probability didn't work for me
I had already try using the classic method of pedstats.dat modding,
Changing the probability to 100 and set all the weapon slot to spudgun and rocket launcher
This method works well for Jimmy, but somehow it is not working for the freeroam ped, and the funny thing is when I go to the shop, the ped inside the shop is actually equip with the specific weapon that I had assign before.

Here is the tutorial about pedstats.dat
http://www.bully-board.com/index.php?topic=14626.30
The user, name Redblast posting in that thread actually had the same problem with me
So do you guys have a solution to this problem? Maybe from Lua?
Have you try this before? or maybe you got another method that work?

Offline AlphaTech

  • LostInSpace
  • Sr. Member
  • ***
  • Posts: 758
  • Gender: Male
  • The name's AlphaTECH, whatca need help with?! :)
    • View Profile
Re: How to spawn a weapon to the freeroam ped?
« Reply #13 on: July 14, 2015, 05:01:58 PM »
Who typed that into your quote box? Interesting enough I thought it would work. I guess weirdos with no lives lurk around trying to hack into bully-board also.

Offline Rambo7

  • "Awesomely Kick-Ass Troll"
  • Full Member
  • ***
  • Posts: 404
  • Gender: Male
  • #ZAMBess
    • View Profile
    • My ModDB Page
Re: How to spawn a weapon to the freeroam ped?
« Reply #14 on: July 15, 2015, 08:05:43 AM »
^ It is already been there,
I am the one that wrote all of that in the first place and I never edited my first post
I think you just missed it
and BTW back to topic, so does anyone here know any solution to this problem about spawning weapon?
« Last Edit: July 15, 2015, 03:35:08 PM by Rambo7 »