nrv74 Posted March 31, 2010 Share Posted March 31, 2010 (edited) 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. 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 March 31, 2010 by nrv74 Link to comment Share on other sites More sharing options...
Erem Posted March 31, 2010 Share Posted March 31, 2010 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 More sharing options...
nrv74 Posted March 31, 2010 Author Share Posted March 31, 2010 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 ; -- 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 More sharing options...
Erem Posted March 31, 2010 Share Posted March 31, 2010 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 More sharing options...
nrv74 Posted March 31, 2010 Author Share Posted March 31, 2010 (edited) 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. And I can already smell that' s gonna work fine I' ll let u know. thanks again Just don' t understand why you have x, y, and Z radius, and then radius 2........ I' ll give a few shots Edited March 31, 2010 by nrv74 Link to comment Share on other sites More sharing options...
Erem Posted March 31, 2010 Share Posted March 31, 2010 No problem. It's only theoretical though, so I hope it works. Link to comment Share on other sites More sharing options...
nrv74 Posted April 1, 2010 Author Share Posted April 1, 2010 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 More sharing options...
Erem Posted April 1, 2010 Share Posted April 1, 2010 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 More sharing options...
nrv74 Posted April 1, 2010 Author Share Posted April 1, 2010 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 Link to comment Share on other sites More sharing options...
Erem Posted April 1, 2010 Share Posted April 1, 2010 (edited) 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 April 1, 2010 by Erem Link to comment Share on other sites More sharing options...
nrv74 Posted April 1, 2010 Author Share Posted April 1, 2010 ok, so now I understand much more how it works. 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 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 I do have them Link to comment Share on other sites More sharing options...
Erem Posted April 1, 2010 Share Posted April 1, 2010 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 More sharing options...
nrv74 Posted April 1, 2010 Author Share Posted April 1, 2010 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 More sharing options...
Erem Posted April 1, 2010 Share Posted April 1, 2010 (edited) 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 April 1, 2010 by Erem Link to comment Share on other sites More sharing options...
nrv74 Posted April 1, 2010 Author Share Posted April 1, 2010 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 More sharing options...
Erem Posted April 1, 2010 Share Posted April 1, 2010 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 More sharing options...
nrv74 Posted April 1, 2010 Author Share Posted April 1, 2010 (edited) 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 and no cars on 2 block' s streets ... Edited April 1, 2010 by nrv74 Link to comment Share on other sites More sharing options...
Erem Posted April 2, 2010 Share Posted April 2, 2010 (edited) 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 April 2, 2010 by Erem Link to comment Share on other sites More sharing options...
nrv74 Posted April 2, 2010 Author Share Posted April 2, 2010 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 More sharing options...
Erem Posted April 2, 2010 Share Posted April 2, 2010 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 More sharing options...
nrv74 Posted April 2, 2010 Author Share Posted April 2, 2010 (edited) 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 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 April 2, 2010 by nrv74 Link to comment Share on other sites More sharing options...
Erem Posted April 2, 2010 Share Posted April 2, 2010 (edited) 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 You could PM it to me, if you want. Edited April 2, 2010 by Erem Link to comment Share on other sites More sharing options...
nrv74 Posted April 2, 2010 Author Share Posted April 2, 2010 PM is sent. /!\ there is added cars and bikes in my script /!\ Link to comment Share on other sites More sharing options...
Erem Posted April 2, 2010 Share Posted April 2, 2010 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 More sharing options...
nrv74 Posted April 2, 2010 Author Share Posted April 2, 2010 Sounds good!! My faith is coming back Link to comment Share on other sites More sharing options...
Erem Posted April 2, 2010 Share Posted April 2, 2010 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 More sharing options...
nrv74 Posted April 2, 2010 Author Share Posted April 2, 2010 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 More sharing options...
Erem Posted April 2, 2010 Share Posted April 2, 2010 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! Link to comment Share on other sites More sharing options...
nrv74 Posted April 2, 2010 Author Share Posted April 2, 2010 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 More sharing options...
Erem Posted April 2, 2010 Share Posted April 2, 2010 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now