filth 0 Posted January 24, 2007 first of all, thanks for listening. i have a problem. i'm trying to set up a situation where an ammo crate can be moved by a player to a fixed location on the map. i currently have the following set up: ammo crate has the following added to its init line: this addAction ["Move Ammo crate forward", "ammo1.sqs"] the script reads thus: ammocrate1 setpos getpos newposition hint "Ammo should have moved." exit the hint is there to tell me if the script is running, which it is. but the crate doesn't move. any ideas? thx. filth. Share this post Link to post Share on other sites
karantan 0 Posted January 25, 2007 It should work. Unless,,,you don't have that new position. Or you didn't named the ammo crate. You've named the ammo crate (ammocrate1), and you've placed a trigger to that new location and named it (newposition), right? Share this post Link to post Share on other sites
SevenBEF 0 Posted January 25, 2007 well here's a start; make ammo1.sqs like this <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _man = _this select 0 _bildpos = NearestBuilding _man ?(ammocrate1 distance _bildpos) < 3: goto "next" ammocrate1 setpos [(getpos _man select 0)-1.5,(getpos _man select 1)+2.5,(getpos _man select 2)] exit #next ammocrate1 setpos [(getpos _man select 0)+4,(getpos _man select 1)+3,(getpos _man select 2)] exit I used nearestbuilding but it doesn't quite work; maybe someone can help me out here so I learn what I'm doing wrong Anyway your ammocrate will follow you with this. Greetz, Seven Share this post Link to post Share on other sites
filth 0 Posted January 25, 2007 doh! i was using a marker instead of a trigger for the newposition. thank you both for your time. karantan, thanks for the trigger reminder. sevenBEF thanks for the script - it's given me another idea. brilliant. Share this post Link to post Share on other sites
baddo 0 Posted January 25, 2007 I used nearestbuilding but it doesn't quite work Hi, If I recall correctly what I tested a good time ago, nearestBuilding only returns buildings which have indexed positions in them. So I think it's not good to count on it in this case. Edit: Hmm I fail to understand what you were trying to achieve with the nearestBuilding command in your script? Baddo. Share this post Link to post Share on other sites
SevenBEF 0 Posted January 25, 2007 Well in case a structure would be to close near the player, setpos the crate somewhere further away so it wouldn't be stock half inside the building But it didn't seem to work; if I would stand next to some barracks or anything, the crate would be but partial visible... Share this post Link to post Share on other sites
baddo 0 Posted January 25, 2007 I do remember testing the nearestBuilding command a good time ago and what I remember for sure was that it didn't detect many buildings at all. The buildings which were not detected in that test were buildings which didn't have the indexed positions (the ones you can access with buildingPos). In comparison, all buildings in that test which had indexed positions were detected by nearestBuilding. Based on this information, using nearestBuilding to check if an ammo crate is near a building will fail very often because the building is simply not detected at all by nearestBuilding. Share this post Link to post Share on other sites
SevenBEF 0 Posted January 25, 2007 Hm ok thx for this reply I assume there is no way to do it then Share this post Link to post Share on other sites
baddo 0 Posted January 26, 2007 Don't assume I have not done this in practice but I think you could come up with a solution where you use nearestObject instead of nearestBuilding to do your checks. There is a problem of not knowing the size of the existing objects; how can you know how far you must move your new object so it doesn't collide with the existing object? Some compromise must be done for that. Share this post Link to post Share on other sites
SevenBEF 0 Posted January 27, 2007 Indeed ur right, there could be a workarround with nearestobject. But I was thinking that a very small bush is an object too (?) so I wanted to try nearestbuilding. Since the script didn't work out I didn't go deeper onto it. You could do more than just that one check I did in the above script to eventually get a nice spot in the open for the crate Share this post Link to post Share on other sites