Deus Ex 0 Posted March 30, 2003 I am using </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">this setpos [(getpos this select 0), (getpos this select 1), 9]<span id='postcolor'> which when I put it in it looks like this </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">this setpos [0,1]<span id='postcolor'> But its not working whenever i use that on anything to make it higher, it just disapears. what am i doing wrong? Share this post Link to post Share on other sites
iNeo 0 Posted March 30, 2003 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Deus Ex @ Mar. 31 2003,01:08)</td></tr><tr><td id="QUOTE">which when I put it in it looks like this </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">this setpos [0,1]<span id='postcolor'><span id='postcolor'> What do you mean? You're only supposed to use the first code string you posted, ie </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">this setpos [(getpos this select 0), (getpos this select 1), 9]<span id='postcolor'> Share this post Link to post Share on other sites
Deus Ex 0 Posted March 30, 2003 I am using that, but it's not working, i'm trying to set 2 sets of sandbags on top of eachother, but when I use that in the init, its just not there... it not on top. its not anywhere. Share this post Link to post Share on other sites
Guest jacobaby Posted March 30, 2003 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (iNeo @ Mar. 31 2003,00:13)</td></tr><tr><td id="QUOTE">8--></span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Deus Ex @ Mar. 31 2003,018)</td></tr><tr><td id="QUOTE">which when I put it in it looks like this </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">this setpos [0,1]<span id='postcolor'><span id='postcolor'> What do you mean? You're only supposed to use the first code string you posted, ie </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">this setpos [(getpos this select 0), (getpos this select 1), 9]<span id='postcolor'><span id='postcolor'> As Ineo says, what is that extra bit about? You will be setting the position as the far NW corner of the map doing that. If you want two things exactly lined up, use an empty object underneath, either a invisible H or a game logic. Call it say, GL1. Now then, in the init line of your sandbags, which you can keep tucked away neatly in a corner somewhere, you should put this; </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> Bottom sandbag; THIS SETPOS GETPOS GL1 Top Sandbag; THIS SETPOS [GETPOS GL1 SELECT 0, GETPOS GL1 SELECT 1, 1] <span id='postcolor'> That will set them roughly on top of each other, you can adjust the height by makig the 1 more or less. This part of the line, "GETPOS GL1 SELECT 0" calls for the X co-ordinate of the game logic, and makes it the same for the sandbag. and this "GETPOS GL1 SELECT 1" calls for the Y co-ord of the game logic. The Z co-ordinate is the one you need to alter. TJ Share this post Link to post Share on other sites
Deus Ex 0 Posted March 31, 2003 Ok i see. But isnt there an easier way? Instead of naming each and everyone of them? I don't want it to be exactly lined up. I just wanna line them up by hand copy and paste, so im not sitting there for 3 hours naming every single one. Is there a way to do that? I've done it before but it's been a while, so I forgot. Share this post Link to post Share on other sites
Deus Ex 0 Posted March 31, 2003 Uhh ok never mind, I figured it out, I use "this" instead of "name"... Stupid me.. Sorry, thanks for bearin with me. Share this post Link to post Share on other sites
-iCeMaN- 0 Posted April 1, 2003 What do you put in the INIT line to set a vehicles speed? -iCe- Share this post Link to post Share on other sites
Guest jacobaby Posted April 2, 2003 you cant as such AFAIK. Share this post Link to post Share on other sites
Harnu 0 Posted April 2, 2003 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (|iCeMaN| @ April 01 2003,23:36)</td></tr><tr><td id="QUOTE"> What do you put in the INIT line to set a vehicles speed? -iCe-<span id='postcolor'> The best you can do for speed is to detect the speed and slow/speed up a vehicle depending on how fast/slow you want it. Share this post Link to post Share on other sites
Guest Posted April 2, 2003 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (|iCeMaN| @ April 01 2003,23:36)</td></tr><tr><td id="QUOTE"> What do you put in the INIT line to set a vehicles speed? -iCe-<span id='postcolor'> </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _v0 = 150 _dir = getDir(_vehicle) _vBase = [sin(_dir),cos(_dir), 0] _vehicle setVelocity  [(_vBase select 0)*sqrt(_v0),(_vBase select 1) * sqrt(_v0), 0] <span id='postcolor'> where _v0 is the velocity and _vehicle is the vehicle. On init line, instead of script it would look like this: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">v0=150;dir=getDir(this);vBase = [sin(dir),cos(dir), 0]  ;this  setVelocity  [(vBase select 0)*sqrt(v0),(vBase select 1) * sqrt(v0), 0]<span id='postcolor'> I havn't tried it, but it should work. Share this post Link to post Share on other sites
InqWiper 0 Posted April 2, 2003 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">v0=150;dir=getDir(this);vBase = [sin(dir),cos(dir), 0]  ;this  setVelocity  [(vBase select 0)*sqrt(v0),(vBase select 1) * sqrt(v0), 0]<span id='postcolor'> Why didnt you people think of that ?  Share this post Link to post Share on other sites
Shashman 0 Posted April 2, 2003 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (denoir @ April 02 2003,07:29)</td></tr><tr><td id="QUOTE"></span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">v0=150;dir=getDir(this);vBase = [sin(dir),cos(dir), 0]  ;this  setVelocity  [(vBase select 0)*sqrt(v0),(vBase select 1) * sqrt(v0), 0]<span id='postcolor'><span id='postcolor'> Jeeeez I thought I'd never see something like that again after finishing school! *sigh* Looks like I'm gonna be eternally haunted by those horrible cos and sins  ( ) Share this post Link to post Share on other sites
Guest BratZ Posted April 2, 2003 OMG thats great stuff Denoir.. I was gonna break out some math books to figure that out ! apparantly the (_v0 = 150) is where I would set the speed that I want to make it Share this post Link to post Share on other sites
Guest Posted April 2, 2003 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (BratZ @ April 02 2003,19:56)</td></tr><tr><td id="QUOTE">apparantly the (_v0 = 150) is where I would set the speed that I want to make it<span id='postcolor'> The v0 wasn't normalized. If you want the v0 to be in km/h as BIS' "speed" function returns you'll have to scale v0 to fit: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">v0=200; v0 = v0/3.6; dir=getDir(this);vBase = [sin(dir),cos(dir), 0] ;this setVelocity [(vBase select 0)*v0,(vBase select 1) * v0, 0]<span id='postcolor'> And it's not at all complicated. The setVelocity function takes a velocity vector as input. It's like an arrow pointing in the direction of where it is going with the lenght representing how fast it is going. The getDir function gives us the direction (angle) of our vehicle. Using a normal coordinate system our equation would be v = v0 * [cos(angle), sin(angle) ]. Now OFP uses a bit different coordinate system where 1) zero angle is shifted 90 degrees 2) y component is flipped For 1) cos(angle + 90) = sin(angle) and sin(angle + 90) = cos angle For 2) cos(-angle)=cos(angle) ->no change So our velocity vector is [v0*sin(angle), v0*cos(angle)]. The speed scaling (i.e matching to BIS' speed function) is a bit more mysterious. For some reason they chose to assign setVelocity in m/s while speed returns in km/h. So you have to scale v0 with a factor of 3.6 (normal conversion 1 m/s = 3.6 km/h) Share this post Link to post Share on other sites