DonkeyQuickOats Posted March 22, 2016 Share Posted March 22, 2016 (edited) I have been working on a mod for a while with the C# .NET Scripthook V and am having difficulty placing trailers in areas that are outside of the render zone or physics area. I'm sure there's a better term for this. In some locations I'll place a trailer and it will spawn and place as I expected. However, in other areas the trailer will be turned 90 degrees or will be placed elsewhere. Some of these locations have objects nearby the trailer, but if I spawn the trailer while standing next to the spot the trailer spawns fine. If I spawn it from a distance, the trailer doesn't spawn in the location I'm expecting. This happens in a few locations. It looks really goofy to have a trailer magically appear when you get within 20 feet of it, but so far has been the only solution that I can think of for reliably having it placed. I'm using the native: SET_VEHICLE_ON_GROUND_PROPERLY function to place the trailer. Has any one else ran into this? Am I doing something wrong? Here's a quick reproduce scenario: 1. Teleport to where trailer will be. 2. Spawn trailer (it appears where it should) 3. Kill self and end up in hospital far away from trailer spawn point 4. Spawn trailer again but while at hospital (trailer is now in another part of the map) 5. Teleport to trailer and it will not be positioned properly. Let me know if you need more info. Edited March 22, 2016 by DonkeyQuickOats Link to comment Share on other sites More sharing options...
aimless Posted March 22, 2016 Share Posted March 22, 2016 I had a problem with spawning vehicles at long distances they would explode just after spawning. Try ENTITY::SET_ENTITY_LOAD_COLLISION_FLAG set to true. Link to comment Share on other sites More sharing options...
R3QQ Posted March 23, 2016 Share Posted March 23, 2016 Are you using ENTITY::SET_ENTITY_AS_MISSION_ENTITY(trailer, false, true);? It prevents the system from removing your entity with cleanup (some sort of garbage collection I think). And maybe it can help with more things when making the entity more persistent. Just a thought. Link to comment Share on other sites More sharing options...
DonkeyQuickOats Posted April 7, 2016 Author Share Posted April 7, 2016 Thanks for the suggestions. I made three changes. First I realized that my height adjustment logic was flawed and was putting the trailer below ground level. Next I added ENTITY::SET_ENTITY_LOAD_COLLISION_FLAG and ENTITY::SET_ENTITY_AS_MISSION_ENTITY. The trailers are now spawning as expected. R3QQ 1 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