Global Administration
|
 |
Join Date: Oct 2002
Location: Lynn Ma
Posts: 883
|
|
setshootparams help
I really don't get what I'm doing wrong. I'm trying to implement picking up and throwing bushes on delteria but for some odd reason I can't get he setshootparams to work right at all. So I got picking up and throwing part finished, but the setshootparams isn't working when the bush lands for that "leap effect".
Here is What i did.
-Skipped Some stuff that isn't needed int he code below
PHP Code:
function onActionServerSide(cmd, data) { switch (cmd) { case "liftItem":{ for ( temp.i = 0; i < 4; i++ ) { tiles[ params[ 1 ] + i % 2, params[ 2 ] + int( i / 2 ) ] = this.replaceTiles[ params[ 3 ] ][ i ]; } updateBoard( params[ 1 ], params[ 2 ], 2, 2 ); client.carrying = true; } } } function onCreated(){ addTileVars() ; } function addTileVars() { this.replaceTiles = { { 0x1C0, 0x1C1, 0x1D0, 0x1D1 }, // sign 1 { 0x1C2, 0x1C3, 0x1D2, 0x1D3 }, // pot 1 { 0x1C4, 0x1C5, 0x1D4, 0x1D5 }, // pot 2 { 0x1C6, 0x1C7, 0x1D6, 0x1D7 }, // rock 1 { 0x1C8, 0x1C9, 0x1D8, 0x1D9 }, // bush 1 { 0x1CA, 0x1CB, 0x1DA, 0x1DB }, // rock 2 { 0x1CC, 0x1CD, 0x1DC, 0x1DD }, // sign 2 { 0x1CE, 0x1CF, 0x1DE, 0x1DF } // bush 2 }; } //#CLIENTSIDE public function onDoGrab() { player.ani = "grab"; if (client.carrying == false){ onCheckLift(); } else { setAni( "delt_carrythrow", player.attr[ 9 ] ); movement.pauseani(0.3); throwItem(); } }
public function onCheckLift(){ temp.tx = player.x + 1.5 + vecx( player.dir ) * 1.5; temp.ty = player.y + 2 + vecy( player.dir ) * 1.5; if ( onWall( tx, ty ) ) { temp.testx = int( tx ); temp.testy = int( ty ); temp.tile = tiles[ testx, testy ]; temp.px = int( tx ); temp.py = int( ty ); for ( i = 0; i < this.liftTiles.size(); i++ ) { for ( t = 0; t < 4; t++ ) { if ( tile == this.liftTiles[ i ][ t ] ) { px -= t % 2; py -= int( t / 2 ) % 2; for ( j = 0; j < 4; j++ ) { if ( tiles[ px + j % 2, py + int( j / 2 ) ] != this.liftTiles[ i ][ j ] ) { return; } } player.attr[ 9 ] = i; if ( i in { 3, 5 } ) { movement.freezeplayer(0.3); onReleaseGrab(); scheduleEvent( 0.3, "LiftItem", px, py, i ); } else { onLiftItem( px, py, i ); } break; } } } } } function onLiftItem( px, py, i ) { setAni( "delt_lift", { px, py, i } ); this.pauseani(0.3); player.idleani = "delt_carrystill"; player.walkani = "delt_carry"; triggerServer( "weapon", this.name, "liftItem", px, py, i ); }
function throwItem() { cancelEvents( "LiftItem" ); gravity = 1; this.pauseani(0.3); //onReleaseGrab();
echo("thrownobj", player.attr[ 9 ], player.account ); setshootparams("thrownobj2",player.attr[ 9 ]); // projectile with x,y,z,angle,zangle,strength,ani,aniparams //setShootParams( "thrownobj", player.attr[ 9 ], player.account ); shoot( player.x, player.y, 1.5, getangle( vecx( player.dir), vecy( player.dir ) ), 0, 1, "delt_carryitem", player.attr[ 9 ] ); client.carrying = false; setani("iidle", nil); player.idleani = "iidle"; player.walkani = "iwalk"; //replaceAni( "push", "push" ); player.attr[ 9 ] = null; }
So All that works besides last part, the bush actual gets thrown with
shoot( bleh ), but when it lands nothing happens with setShootparams.
I made this NPC for the ActionProjectile2 Test and called it MDPROJECTILES and added it to my self.
PHP Code:
//#CLIENTSIDE function onActionProjectile2(px,py,obj,dir,throwobj) { if (obj == "thrownobj2") echo("Testing Projectiles"); } /* function onActionProjectile2( dx, dy, wpn ) { echo("Test Projectile:" SPC params[1]); // 0 - bush, 1 - grass, 2 - white rock, // 3 - brown rock, 4 - black pellets, 5 - splash temp.tile = tiles[ dx, dy ]; if ( tile in | 0x40, 0x11F | || tile in | 0x2C0, 0x2C5 | || tile in | 0x2D0, 0x2D5 | || tile in | 0x2E0, 0x2E3 | || tile in | 0x2F0, 0x2F3 | ) { putLeaps( 5, dx - 1, dy - 1 ); } else { temp.leaps = { 3, 2, 2, 3, 0, 2, 3, 0 }; putLeaps( leaps[ params[ 3 ] ], dx - 1, dy - 1 ); } } */
Remember I cut this portion out of the movement system. |
Last edited by MysticalDragon; 06-09-2012 at 08:15 PM..
|