Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

Last help request to complete a mod... PLEASE !


nrv74
 Share

Recommended Posts

Hi, you, who might help me :-)

 

I' m about to place 30 bikes inside the bike shop in Alderney, for it to please me...

Everything should work, but the 8 nrg900 already placed in don' t let some of the bikes I want to place spawn.

So I tryied CLEAR_AREA_OF_CARS, with the good coords (I even made a ragdoll to take Zvalue at the floor^^), but still those 8 nrg900 are there. cryani.gif

So could someone tell me if that command is the one I need or is there another one, did I write it in the wrong place, IS what I wanna do even possible???!!!!

WTF?!?!?!?!

Edited by nrv74
Link to comment
Share on other sites

I don't know whether this would work, but for each of the points where a bike is spawned, you could try using GET_CLOSEST_CAR or GET_RANDOM_CAR_IN_SPHERE with a small radius. Then, if a vehicle is found (i.e. the car handle isn't 0), use DELETE_CAR to remove it.

Link to comment
Share on other sites

Wow, that would be tight, and that would be a really small radius, the 30 bikes are closed to each one.

Just by curiosity, does someone knows what CLEAR_AREA_OF_CARS is made for?

I' d like to try this, Erem, but I think I need an example with that bike i' ve created confused.gif ;

 

-- CarName_14

local hash_18 = GET_HASH_KEY(CarName_14)

REQUEST_MODEL(hash_18)

while HAS_MODEL_LOADED(hash_18) == 0 do Wait(100) end

local CarVar_18 = {}

Wait(500)

CREATE_CAR(hash_18, itof(-1087.05), itof(1461.09), itof(24.31), CarVar_18, true)

SET_CAR_HEADING(CarVar_18.a, 180.01)

MARK_MODEL_AS_NO_LONGER_NEEDED(hash_18)

Wait(100)

Link to comment
Share on other sites

I think you may have misunderstood me. I didn't mean to do it for each of the points where you are spawning bikes but for each of the points where the bikes you want to get rid of are spawned. And do it before you spawn any of your own there.

 

Also, ignore what I said about checking if the car handle is 0 - use DOES_VEHICLE_EXIST instead.

 

You could create a function like this:

function RemoveBike(bx, by, bz) local radius = 1 local bike = {} GET_RANDOM_CAR_IN_SPHERE(itof(bx - radius), itof(by - radius), itof(bz - radius), itof(radius * 2), itof(radius * 2), itof(radius * 2), bike) if (DOES_VEHICLE_EXIST(bike.a) == 1) then DELETE_CAR(bike.a) endend

and call it eight times, with the approximate co-ordinates of each of the unwanted bikes. E.g.

RemoveBike(itof(-1087.05), itof(1461.09), itof(24.31))

(but use the coordinates you've noted down, not those ones).

 

I'm only guessing at the value of radius. If the function doesn't remove any bikes, try increasing it. If it deletes the wrong vehicles (e.g. cars outside), reduce it.

Link to comment
Share on other sites

Wow Erem, you' re very big help... couldn' t hope so much, and so clear.

Now I almost have only to push a few touches. lol.gif

And I can already smell that' s gonna work fine sigh.gif

I' ll let u know.

thanks again icon14.gif

 

Just don' t understand why you have x, y, and Z radius, and then radius 2........

I' ll give a few shots

Edited by nrv74
Link to comment
Share on other sites

Another very boring stuff is each bike is spawned with the tire inside the floor, well, just a small part of the wheel, but I find it too ugly.

Didn' t manage to fix it yet, but I' ll do that.

 

Link to comment
Share on other sites

 

Just don' t understand why you have x, y, and Z radius, and then radius 2........

It's quite possible that I'm not using the function correctly as I'm still learning this stuff myself, but it seems to work for me. I agree it would make more sense if there were just x, y, z and radius.

 

The way it appears to work is that the first three parameters are the western, southern and lower limits of the area you're defining, and the next three are the west-east, south-north and bottom-top lengths. But as that means that the shape defined need not be a sphere or even centred around the co-ordinates you specify, I may be mistaken. Hopefully someone will correct me, if that's the case. GET_RANDOM_CAR_IN_SPHERE may not even be the best native function to use to detect the bikes, but as long as your script does what you want it to do without any nasty side-effects, you can always improve on it later when you've learnt more.

 

If we assume that the function does work the way I think it does then, as we are creating a sphere, the first three parameters are one radius away from bx, by, bz and the next three, which specify the horizontal and vertical diameters, are two radius lengths (the diameter of a circle or sphere being twice its radius).

 

 

Fixing the tyres in the floor is just a matter of increasing the z co-ordinate in CREATE_CAR by a fraction. As you're placing the bikes inside the shop rather than outside on uneven ground, once you've found the correct value for one bike, all the others should be the same.

Link to comment
Share on other sites

Okay, so to delete the bikes, i ' ve tryied that.

My script is not loaded anymore.

I know I did a lot of mistakes

Here is the all script

 

--Essai

 

function RemoveBike(itof(-1086.36), itof(1467.67), itof(24.31))

local radius = 1

local bike = {}

GET_RANDOM_CAR_IN_SPHERE(itof(-1086.36 - 1.01), itof(1467.67 - 1.01), itof(24.31 - 1.01), itof(2.02), itof(2.02), itof(2.02), bike)

if (DOES_VEHICLE_EXIST(bike.a) == 1) then DELETE_CAR(bike.a) end

end

 

function RemoveBike(itof(-1083.31), itof(1470.68), itof(24.31))

local radius = 1

local bike = {}

GET_RANDOM_CAR_IN_SPHERE(itof(-1083.31 - 1.01), itof(1470.68 - 1.01), itof(24.31 - 1.01), itof(2.02), itof(2.02), itof(2.02), bike)

if (DOES_VEHICLE_EXIST(bike.a) == 1) then DELETE_CAR(bike.a) end

end

 

function RemoveBike(itof(-1077.85), itof(1469.43), itof(24.31))

local radius = 1

local bike = {}

GET_RANDOM_CAR_IN_SPHERE(itof(-1077.85 - 1.01), itof(1469.43 - 1.01), itof(24.31 - 1.01), itof(2.02), itof(2.02), itof(2.02), bike)

if (DOES_VEHICLE_EXIST(bike.a) == 1) then DELETE_CAR(bike.a) end

end

 

function RemoveBike(itof(-1069.02), itof(1466.16), itof(24.31))

local radius = 1

local bike = {}

GET_RANDOM_CAR_IN_SPHERE(itof(-1069.02 - 1.01), itof(1466.16 - 1.01), itof(24.31 - 1.01), itof(2.02), itof(2.02), itof(2.02), bike)

if (DOES_VEHICLE_EXIST(bike.a) == 1) then DELETE_CAR(bike.a) end

end

 

function RemoveBike(itof(-1077.85), itof(1462.76), itof(24.31))

local radius = 1

local bike = {}

GET_RANDOM_CAR_IN_SPHERE(itof(-1077.85 - 1.01), itof(1462.76 - 1.01), itof(24.31 - 1.01), itof(2.02), itof(2.02), itof(2.02), bike)

if (DOES_VEHICLE_EXIST(bike.a) == 1) then DELETE_CAR(bike.a) end

end

 

function RemoveBike(itof(-1081.64), itof(1464.78), itof(24.31))

local radius = 1

local bike = {}

GET_RANDOM_CAR_IN_SPHERE(itof(-1081.64 - 1.01), itof(1464.78 - 1.01), itof(24.31 - 1.01), itof(2.02), itof(2.02), itof(2.02), bike)

if (DOES_VEHICLE_EXIST(bike.a) == 1) then DELETE_CAR(bike.a) end

end

 

function RemoveBike(itof(-1086.76), itof(1462.78), itof(24.31))

local radius = 1

local bike = {}

GET_RANDOM_CAR_IN_SPHERE(itof(-1086.76 - 1.01), itof(1462.78 - 1.01), itof(24.31 - 1.01), itof(2.02), itof(2.02), itof(2.02), bike)

if (DOES_VEHICLE_EXIST(bike.a) == 1) then DELETE_CAR(bike.a) end

end

 

function Essai(CarName_01, CarName_02, CarName_03)

-- CarName_01

local hash_01 = GET_HASH_KEY(CarName_01)

REQUEST_MODEL(hash_01)

while HAS_MODEL_LOADED(hash_01) == 0 do Wait(100) end

local CarVar_01 = {}

Wait(500)

CREATE_CAR(hash_01, itof(-474.00), itof(1477.00), itof(20.00), CarVar_01, true)

MARK_MODEL_AS_NO_LONGER_NEEDED(hash_01)

Wait(100)

local hash_02 = GET_HASH_KEY(CarName_01)

REQUEST_MODEL(hash_02)

while HAS_MODEL_LOADED(hash_02) == 0 do Wait(100) end

local CarVar_02 = {}

Wait(500)

CREATE_CAR(hash_02, itof(-477.35), itof(1477.00), itof(20.00), CarVar_02, true)

MARK_MODEL_AS_NO_LONGER_NEEDED(hash_02)

Wait(100)

-- CarName_02

local hash_03 = GET_HASH_KEY(CarName_02)

REQUEST_MODEL(hash_03)

while HAS_MODEL_LOADED(hash_03) == 0 do Wait(100) end

local CarVar_03 = {}

Wait(500)

CREATE_CAR(hash_03, itof(-480.70), itof(1477.00), itof(20.00), CarVar_03, true)

MARK_MODEL_AS_NO_LONGER_NEEDED(hash_03)

Wait(100)

-- CarName_03

local hash_04 = GET_HASH_KEY(CarName_03)

REQUEST_MODEL(hash_04)

while HAS_MODEL_LOADED(hash_04) == 0 do Wait(100) end

local CarVar_04 = {}

Wait(500)

CREATE_CAR(hash_04, itof(-487.20), itof(1477.00), itof(20.00), CarVar_04, true)

MARK_MODEL_AS_NO_LONGER_NEEDED(hash_04)

Wait(100)

end

 

function main()

PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING","f*ckin' 8 bikes",7000,1)

CLEAR_AREA_OF_CARS(itof(-1080.03), itof(1468.08), itof(24.52), itof(15.21))

Wait(500)

RemoveBike(itof(-1086.36), itof(1467.67), itof(24.31))

RemoveBike(itof(-1083.31), itof(1470.68), itof(24.31))

RemoveBike(itof(-1077.85), itof(1469.43), itof(24.31))

RemoveBike(itof(-1069.02), itof(1466.16), itof(24.31))

RemoveBike(itof(-1077.85), itof(1462.76), itof(24.31))

RemoveBike(itof(-1081.64), itof(1464.78), itof(24.31))

RemoveBike(itof(-1086.76), itof(1462.78), itof(24.31))

Essai("YZRM1", "NRG900", "PCJ")

while true do

WaitForPlayerPoolCreation()

WaitForValidPlayer()

Wait(1000)

end

end

 

-- start

main();

 

 

Now you must really see how much ignorant i am lol.gif

Link to comment
Share on other sites

This bit is correct:

RemoveBike(itof(-1086.36), itof(1467.67), itof(24.31))RemoveBike(itof(-1083.31), itof(1470.68), itof(24.31))RemoveBike(itof(-1077.85), itof(1469.43), itof(24.31))RemoveBike(itof(-1069.02), itof(1466.16), itof(24.31))RemoveBike(itof(-1077.85), itof(1462.76), itof(24.31))RemoveBike(itof(-1081.64), itof(1464.78), itof(24.31))RemoveBike(itof(-1086.76), itof(1462.78), itof(24.31))

except that there are only seven of these lines so one of your unwanted bikes will remain.

 

You only need one function definition for RemoveBike, not the seven that you have. Instead of:

function RemoveBike(itof(-1086.36), itof(1467.67), itof(24.31))local radius = 1local bike = {}GET_RANDOM_CAR_IN_SPHERE(itof(-1086.36 - 1.01), itof(1467.67 - 1.01), itof(24.31 - 1.01), itof(2.02), itof(2.02), itof(2.02), bike)if (DOES_VEHICLE_EXIST(bike.a) == 1) then DELETE_CAR(bike.a) endend

and the six similar sections, you just need this:

function RemoveBike(bx, by, bz) local radius = 1 local bike = {} GET_RANDOM_CAR_IN_SPHERE(itof(bx - radius), itof(by - radius), itof(bz - radius), itof(radius * 2), itof(radius * 2), itof(radius * 2), bike) if (DOES_VEHICLE_EXIST(bike.a) == 1) then DELETE_CAR(bike.a) endend

exactly as written, and just the once. Don't replace bx, by, bz and radius with actual values.

 

The first time you call the function with RemoveBike(itof(-1083.31), itof(1470.68), itof(24.31)), bx will take on the value -1083.31, by will become 1470.68, and bz will become 24.31. The second time you call it with RemoveBike(itof(-1077.85), itof(1469.43), itof(24.31)), bx will be -1077.85, by 1469.43, and bz 24.31 etc.

 

The code you are using to create your new bikes can also be reduced substantially by using another function, but I won't confuse you with that until you have this bit working!

 

EDIT:

If what you posted is your entire script, the following two lines won't do anything:

WaitForPlayerPoolCreation()WaitForValidPlayer()

 

As your script currently doesn't do anything with the player character, I think you can safely remove them.

 

A question I should have asked you before now is which versions of the game and Alice are you using? I've just assumed you have patch 1.0.0.4 and Alice version 0.9.0.

Edited by Erem
Link to comment
Share on other sites

ok, so now I understand much more how it works. wink.gif

 

I will do that with the real bikeshop and other stuff script. But if you ' d see how long it is, you would teach me to reduce it lol.gif

I' m wondering if you and other guys who know as much as you learned that with your work or just searching, tying and trying mercie_blink.gif

I do have them wink.gif

Link to comment
Share on other sites

You'll see that I only joined the forum a couple of weeks ago, and I only started modding a couple of weeks before that, so I actually don't know that much at all yet! But there are people on here who've been modding the GTA games for years.

 

I learnt a little by downloading other peoples' scripts and seeing what happened when I changed bits of them. Then when I needed more help and joined this forum, ZAZ answered a lot of my questions and gave me plenty of examples which I'm still trying to digest.

Link to comment
Share on other sites

7 bikes because in fact, only seven are still spawned, one must be located too close to one of mines.

One strange thing is with a simple native trainer, using clear area of cars, my bikes don' t disappear, whereas the seven other do, but are respawned immediately...

So I do have 1.0.0.4 and Alice 0.9.0 .

And what about

 

while true doWait(1000)

 

has it a use for me?

Link to comment
Share on other sites

 

And what about

 

while true doWait(1000)

 

has it a use for me?

It depends what else your script is going to do besides creating the bikes. If that's all, then I don't think there's any need to have it there, but I would put a Wait(1000) immediately following function main() to make sure your game has time to initialise properly.

 

If you do remove those lines, you'll need to remove the next line (end) too.

 

Normally you would have those lines if the script repeats the same actions over and over or if it repeatedly checks for a keypress, for example, but the way your script is written at the moment, it performs a one-off task and then finishes, so there's little point in looping.

 

 

One strange thing is with a simple native trainer, using clear area of cars, my bikes don' t disappear, whereas the seven other do, but are respawned immediately...?

Odd... but I've never used CLEAR_AREA_OF_CARS and don't have a clue how it's supposed to work.

Edited by Erem
Link to comment
Share on other sites

well, i' ve just done what you told me, and my script is loaded now, but that doesn' t remove the bikes. sometimes a value like 90 or maybe 1 is not valid, and you have to write 90.01 ...

so i' ll try with local radius = 1.01

but does that line have to stay the same?

"if (DOES_VEHICLE_EXIST(bike.a) == 1) then DELETE_CAR(bike.a) end"

Link to comment
Share on other sites

Yes, keep that line as it is. What it's saying is "If a bike was found within the radius, delete it."

 

The only thing you should need to adjust is the radius.

 

I may need to put the script into my own game and have a play around with it to see what's going on, but I won't be able to do that until sometime tomorrow.

Link to comment
Share on other sites

yes, I' ll try increasing the radius, that' s what i was thinkin' .

6 bikes are still there, sometimes only 5 with a radius of 10.01 cryani.gif and no cars on 2 block' s streets ...

Edited by nrv74
Link to comment
Share on other sites

With a radius of 3, it's finding some of the bikes.

 

The reason it wasn't deleting them is that the line should have been DELETE_CAR(bike), not DELETE_CAR(bike.a) - my mistake.

 

There's a bigger problem than that though: the deleted bikes are immediately respawned, just as they are with CLEAR_AREA_OF_CARS. That has me stumped. I'm guessing there is a R* script doing it that you'd need to disable, but I really don't have a clue now.

 

EDIT:

I don't think they respawn when you steal them, so perhaps instead of being deleted, they could be moved elsewhere on the map?

 

I'll play around with it a bit more and let you know if I come up with anything.

Edited by Erem
Link to comment
Share on other sites

I knew there was a problem with respawning immediately.

Very nice of you to play with it^^

If you find nothing to do, I guess i' ll have to place some of my bikes at the exact coords of the 8 fµ!!!!n' ones. bit that is not reaaly what i wanted.... whatever.

oh yeah, i still didn' t manage to fix that problem with tire inside the floor. that' s strange because with cars i fixed it very easily, using saved coords inside my trainer ini wich has 4 decimals, instead of taking z value printed on my screen which has 2 decimals ( Please excuse my english mistakes)

Link to comment
Share on other sites

Moving them may be the answer. I got rid of four of them that way and they stayed gone. I just need to get the script to detect them all and see what happens when they are all moved out of the shop. Hopefully they won't respawn.

 

At the moment, I've disabled the part of your script that spawns the new bikes. I'll have a look at that once these eight are out of the way.

Link to comment
Share on other sites

you never had the part of my script that spawns the 30 bikes. What you have was just a try to delete the old bikes, the 4 bikes created were spawned in algonquin not in the shop. I can give you that script, but it may take that whole page rolleyes.gif

don' t understand, I ' ve just tryied deleting the .a you told me, (but keeping the enormous 10.01 radius value) and this time the 8 old bikes were spawned

Edited by nrv74
Link to comment
Share on other sites

Yes, removing the .a only solves the problem of them not being deleted; it doesn't stop them respawning.

 

I'm working on something else to use instead of the DELETE_CAR native. I'll get back to you when I've made some progress.

 

 

I can give you that script, but it may take that whole page rolleyes.gif

You could PM it to me, if you want.

Edited by Erem
Link to comment
Share on other sites

Just a quick progress report:

I got your PM, but haven't had chance to do anything with it yet.

 

I've found a better way to detect the eight bikes as they don't always spawn in exactly the same spots, and I was using GET_RANDOM_CAR_IN_SPHERE incorrectly, as I suspected.

 

Here's what I have so far, a single function to remove the bikes which you only need to call once:

function RemoveBikes() local bike = {} for i = 0, 7 do   GET_RANDOM_CAR_IN_SPHERE(itof(-1078), itof(1466), itof(24.31), itof(24), itof(12), itof(2), bike)   if (DOES_VEHICLE_EXIST(bike.a) == 1) then     SET_CAR_COORDINATES(bike.a, itof(-951.68 - (4.5 * i)), 1424.42, itof(39.04))   end   Wait(10) endend

 

Trouble is, it doesn't work. It finds the bikes ok but when I move them to the roof of the nearby carpark, they still respawn in the shop.

 

When I go to the carpark, the bikes aren't there, so possibly the game is deleting them when they're out of my line of sight. I'm going to try moving them to beneath the floor next and hope I can con the game into believing they are still in the shop!

Link to comment
Share on other sites

Hiding them under the floor didn't work either.

 

If I move seven of the bikes out and leave one in the shop, the other seven don't respawn. The problem with that is the bikes could be found in any order so I have no control over which of the eight bikes is left behind, making it difficult for you to spawn your bikes around it.

 

I haven't given up yet though.

Link to comment
Share on other sites

there is no way to make an action being permanent ? I' m not sure to explain correctly...

I mean each time the game try to respawn those GD bikes, the function you created will remove them, even if it's each second?

 

Link to comment
Share on other sites

You could use a loop to repeatedly delete them, and if you just wanted an empty shop, that would work. As soon as you spawn your own bikes there, though, the code needs to be able to identify them somehow and leave them alone. That may be possible, but I've no idea how to do it if it is.

 

I just tested again and moved seven bikes beneath the floor... and this time two bikes remained. I didn't count them before testing but my debug messages confirm that I moved seven. So does the game sometimes spawn nine bikes there? Eight was bad enough! suicidal.gif

Link to comment
Share on other sites

so you think it is possible to remove the 9 bikes the way you did for seven of them?

 

Link to comment
Share on other sites

It seems to me that at least one of the bikes has to remain in the shop otherwise the whole lot of them respawn.

 

I could try to adjust the position and size of the sphere so that it doesn't remove the bike (or possibly bikes) closest to the door. That should stop the others respawning and you'd have a fairly good idea where the remaining bike(s) would be. That's the best idea I can come up with for now.

 

It might even work if we went back to using CLEAR_AREA_OF_CARS but didn't make the area so wide. The difference with CLEAR_AREA_OF_CARS is that the bikes are being deleted rather than hidden out of sight and that seems to trigger the respawn.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.