The above video goes away if you are a member and logged in, so log in now!
Yeah. I have been looking into it, and it does seem to be one of those things that either works out okay or does not.
Originally Posted by jumper
Now, that I think about it, it probably is better to just use the PC to do the testing on. If I had a second box, I would probably be more inclined to do it. After all, I only have a few weeks off, and I want to do some scripting not faffing about! Nevertheless, it is a very interesting topic. So, the difference between CEX or DEX is really just how it operates? DEX is optimised, if you will, for debugging while CEX is what you'd expect from a retail version? I have noticed you cannot play BlueRay or DVDs on DEX, along with some other limitations (Pointed out in that link).
Anyway, thanks for the advice and help. Appreciated!
I don't really want to create another topic, and I hope you don't mind the double post but this is a entirely different question related to scripting.
I'm working on a project, and I need the ability to produce a rocket that will go to a certain coordinate. I have been doing some research, and one way I can see how to do it would be to spawn a random pedestrian, give them the RPG launcher, freeze their position and make them invisible for aesthetics. Then, I should be able to use FIRE_PED_WEAPON, which also allows me to specify a vector.
I was looking to just somehow spawn a rocket that would go to a vector, but I can't see any native that seems capable of doing so. So, I guess the question is, is this the most elegant way of doing it or is there another way?
I haven't even tried this yet, I'm just gathering natives that I might need for the project, and working out how I could in theory do what it is I need to before starting the real code.
Also, while I'm on this topic: Do you need to do this REQUEST_MODEL, blah, blah routine prior to creating an object with CREATE_OBJECT? I am assuming you don't because I've seen direct usage of CREATE_OBJECT in certain scripts. Okay, so I found this out the hard way. Haha.
Last edited by Raeralus; 06-08-2013 at 02:50 PM.
Here, I'll PM you the source for the basic ped targetting from my truck, that should help get you going.
Originally Posted by Raeralus
All GTA V Media To Date:
I have yet another question.
Do you have to do anything special when creating objects that go beneath water? Because I'm trying to place part of a object (A tank, P_TANK_12 to be exact) under water. I did it with EvilB's brilliant object spawner, and obtained the coordinates, but when the object is created through a script, it seems to be higher than it should be. I tried turning off collision detection for the object, but that does not seem to make any difference. Is the water causing this misalignment?
All other objects seem to be in the expected coordinates, and they have one thing in common, they are not penetrating below the water level. I also noticed objects that naturally go in water (ie bouys) will automatically drop to the water level regardless of where you try and move it (with EvilB's object spawner).
I know it is possible as I've seen a few map mods that have made use of this rather odd dimension. So, I'm just assuming there's odd behaviour enacted on objects when you try and spawn them under the water level.
The object coordinates in EvilB's object spawner are off, so things won't be where you want them to be once you put them in a script, I believe he has fixed this problem now, and we're just waiting for his update.
Originally Posted by Raeralus
All GTA V Media To Date:
I was just beginning to think they were off as I did some testing. Couldn't really tell in the water. Although, it is still awesome, I cannot wait for that update! I was trying to work out what it uses to make the calculations, and it seems to be the centre of object although I'm not entirely sure. Would be nice if you could switch between the bottom, middle, and top to use as points when positioning the object. Just a thought.
Originally Posted by Colt
only z coord is off ... i think its due to the fact that given z coord is actually center of said object , so the taller the object the more the z coord will be off ( always higher than expected ) when i placed objects for zombie minigame i re-adjusted all my object's z coords manualy .
In my mind there is nothing wrong with evil's object spawner, it's more quirks of the game that haven't been compensated for. If you use "CREATE_OBJECT_NO_OFFSET" with the coordinates given by the spawner everything should match up.
The confusing part is, when you convert an objects.ini to work as a script, you definitely need to use "CREATE_OBJECT". So if you're wanting to use evil's object spawner to help write an objects.ini, the Z offset will end up being off until a way to compensate is figured out.
I had this idea that it may have something to do with the models dimensions. Say for example a models dimensions have 14.0 max Z and -14.0 min Z, my guess is that "CREATE_OBJECT_NO_OFFSET" and "CREATE_OBJECT" would have the same result for that model. The problem would be with models that have say 28.0 max and -5.0 min. This is just an idea but I may look into it a little, one of my posts somewhere has a best guess of how far a certain model was off (maybe in the mapmod thread?)
Funnily enough, that is what I was doing. Very frustrating! Haha. Although, it is a bit faster on the PC but still.
Originally Posted by HuN
I did spot the CREATE_OBJECT_NO_OFFSET native a few times, but I didn't think anything of it since the parameters were the same. I purely just want to create an object without writing a objects.ini file, so I should use the said native? I'm guessing the difference between these two natives is how the engine actually places the object? CREATE_OBJECT maybe using something as an offset in the world (that you cannot change, it seems), and CREATE_OBJECT_NO_OFFSET that won't use any offset?
Originally Posted by jumper
I will actually do some experimenting now with that theory, and let you know what I discover. I am guessing I can use one of those neon cubes for the perfect square dimensions.
So, using the original Z coordinate that the spawner indicated and CREATE_OBJECT_NO_OFFSET, the object did spawn in the exact location (or height I should say).
Thanks jumper, and I will look into that theory you suggested.
Last edited by Raeralus; 06-10-2013 at 06:33 AM.
I have some more questions... sort of. More or less, I need things pointed out to me that are wrong or could be done differently. A lot of the time, I assume things based on the name of a native, and it's signature.
With that out of the way, my first question is regarding network IDs. Firstly, I am assuming that every entity in a network game has a ID (objects, pedestrians, vehicles, etc) or is it just entities that are being utilised by a online player? I am assuming it's the latter based on certain source code I've analysed.
If I need to change some aspect of that entity, then I must first obtain control of that entity's network ID? And if I do not need control (which in my project, I don't), and just want information regarding that entity, I only need it's network ID?
So, in my case I need to obtain the coordinates of a player's vehicle. I have taken all the necessary steps to get to this stage. Then some point later, a pedestrian (fixed in position) will fire their weapon at these coordinates. In one test, this worked fine for my player (online), but no shots were fired at other players. In the second test (again online), sometimes shots are fired at online players. What makes these tests different is the fact in the first one I am using the vehicle's handle as the first parameter to FIRE_PED_WEAPON and in the second test, I get the network ID of the vehicle, and use that as the first parameter instead. Is this step necessary for online players (not myself)? Before all of this, I also get the ID of the player's ped. Is this, again, a necessary step?
The design of this mechanism works inside a loop that starts from 0 and stops at 16. This loop will run again when it completes the 16th iteration as it is inside a while loop that never evaluates to false (thus, causing it to execute indefinitely). The current iteration is passed to IS_NETWORK_PLAYER_ACTIVE as the first parameter, and if the return is true, I know this is a player, so I begin running a series of conditions and other code providing it is. If the return is false, the code that would run is skipped, and the loop completes the iteration and either stops (and is penultimately executed again) or begins the next iteration. Is this a good design?
I have considered having two loops as opposed to one big loop. The first loop would populate an array that would hold the online players and some information about them (handle, network ID, name, etc) providing again IS_NETWORK_PLAYER_ACTIVE yields truthful. The second loop kicks in, and will only cycle depending on the number of indexes inside the array, and if they satisfy a series of conditions, FIRE_PED_WEAPON is invoked on their vehicle's coordinates. At the end, everything is reset, and the two loops go again.
The main anomaly I am having is that sometimes the NPC will fire wildly out of control. Sometimes only at a certain coordinate (commonly, it points up) or sometimes it will not fire at all even when all the conditions are met.
Has anyone had this problem before? I should have posted the code, and WILL only if you need it to help answer this problem. I am pretty sure I have not missed any steps, and really just need to know if all this is correct (in terms of network IDs, and how I am going through them), and so the only problem should be related to FIRE_PED_WEAPON. Maybe I need to halt execution between iterations?
I am going to convert to the second design, and see if that makes any difference. It probably is more efficient than just one big loop.
I know there is a lot of detail here, but thanks if you can help me.
Last edited by Raeralus; 06-12-2013 at 06:26 AM.