Indeed, just instead of when modes are changed for returning the boomerang, pull the player towards the hook.
I didnt really wanna make a new thread for this, I decided to play with this and try add a sparkle trail but since my graphic skills suck it wasnt soo good
Is this any good?
Looks okay to me, nice job.
too much sparkle, stream is too long
[QUOTE=tricxta;72746]
I didnt really wanna make a new thread for this, I decided to play with this and try add a sparkle trail but since my graphic skills suck it wasnt soo good
Is this any good?
[/QUOTE]
It looks like you’re using an animated gif for the sparkles, meaning the sparkles are always predefined. This ends up looking boring.
Instead, create sparkles randomly at the boomerang position, give or take a tile or two from the center of the boomerang. When you create a sparkle, assign it an x or y(as I said, randomly on the boomerang position) as well as a size value and lifetime value(can be proportionate to the size, though). Then, always reduce the size. When size == 0, remove that instance of the sparkle. Create the sparkles in a random loop of 3-6 or so, so you’ll always get a bunch of sparkles.
Ok I shortened the trail like spooon said and now the boomerang will generate 4-6 sparkles which then place that number of sparkles in a 0-2 random position of the boomerang.
Doesnt really seem like its worth the extra loops required plus all of those objects which are gunna lag it up o_0
Maybe if you did it right so it didn’t look really bad it would be worth it.
Make it a bit thinner.
How are you doing the trails anyway?
[QUOTE=tricxta;72807]
Doesnt really seem like its worth the extra loops required plus all of those objects which are gunna lag it up o_0
[/QUOTE]
If a boomerang trail is causing any slowdown, you’re doing it wrong.
This thread is also retarded without Spooon’s posts.
Look at Scripting Showcase => See gaps in thread => See quote => lolwut.
I want the boomerang to turn back if it hits an object that tells it to so I added:
if(boomeranghitsomething){
this.boom.mode = 2;
}
But it does nothing, how can I make it work without rewriting the whole thing?
(the call doesn’t work on the flying boomerang)
[QUOTE=2ndwolf;98679]
I want the boomerang to turn back if it hits an object that tells it to so I added:
if(boomeranghitsomething){
this.boom.mode = 2;
}
But it does nothing, how can I make it work without rewriting the whole thing?
(the call doesn’t work on the flying boomerang)
[/QUOTE]
Well you’d have to tell the boomerang when it’s hit something. So the boomerang would have to do some kind of npc triggering on its flightpath, you could use a triggeraction or whatever. Then when that triggers an npc you’d use callweapon to let the boomerang know it’s time to turn around.
Ooooh, damnit that’s what I missed, callweapon. Tnx!
For anyone who’s in the past been annoyed by the bug that’s presented in shiny’s boomerang weapon script when changing levels here’s the fix for it.
this.curMapC = {onmapx(#L),onmapy(#L)};
if (isonmap && this.oldMapC[0] >= 0 && this.oldMapC[1] >= 0){//move the boomerang to counter for the level change on maps
this.change = {this.curMapC[0]-this.oldMapC[0],this.curMapC[1]-this.oldMapC[1]};
this.boom.x -= this.change[0]*64;
this.boom.y -= this.change[1]*64;
}
else {//discard the boomerang
if (!isonmap){
this.curMapC[0] = -1;
this.curMapC[1] = -1;
}
this.boom.dist = 0;
this.boom.mode = 0;
hideimg 1;
}
this.oldMapC = {this.curMapC[0],this.curMapC[1]};
If you insert this in the ‘playerenters’ part of the script the boomerang will shift accordingly on level entrance.
I like that bug
[QUOTE=tricxta;99224]
For anyone who’s in the past been annoyed by the bug that’s presented in shiny’s boomerang weapon script when changing levels here’s the fix for it.
this.curMapC = {onmapx(#L),onmapy(#L)};
if (isonmap && this.oldMapC[0] >= 0 && this.oldMapC[1] >= 0){//move the boomerang to counter for the level change on maps
this.change = {this.curMapC[0]-this.oldMapC[0],this.curMapC[1]-this.oldMapC[1]};
this.boom.x -= this.change[0]*64;
this.boom.y -= this.change[1]*64;
}
else {//discard the boomerang
if (!isonmap){
this.curMapC[0] = -1;
this.curMapC[1] = -1;
}
this.boom.dist = 0;
this.boom.mode = 0;
hideimg 1;
}
this.oldMapC = {this.curMapC[0],this.curMapC[1]};
If you insert this in the ‘playerenters’ part of the script the boomerang will shift accordingly on level entrance.
[/QUOTE]
I dont see the ‘playerenters’ part can you post the entire code with your fix? Thanks
This is the script I use on phoenix, it’s based off shiny’s but I changed a few things including functionality to pass over nominated tiles.
//Made by Tricxta
//Credit to shiny for base functionality
if (playerenters){
if (!isweapon){
toweapons boomerang;
return;
}
if (strequals(#s(client.boomDat),))
setstring client.boomDat,1,0,0,0,0;//level,extra data...
this.boom.level = strtofloat(#I(client.boomDat,0));
setimg shiny_boomerang-#v(this.boom.level)-icon.png;
this.boomtiles = {
// STA,KE,TI,LES, ,REP,LAC,ETI,LES, ,STRENGTH(1 = default),LEAPS
0x2 ,0x3 ,0x12 ,0x13 , ,0x2A5,0x2A6,0x2B5,0x2B6, ,1,0 , // BUSH
0x200,0x201,0x210,0x211, ,0x70A,0x70B,0x71A,0x71B, ,1,3 , // SIGN
0x2AC,0x2AD,0x2BC,0x2BD, ,0x6EA,0x6EB,0x6FA,0x6FB, ,2,2 , // VASE
0x22 ,0x23 ,0x32 ,0x33 , ,0x72A,0x72B,0x73A,0x73B, ,2,2 , // LIGHT ROCK
0x3DE,0x3DF,0x3EE,0x3EF, ,0x72A,0x72B,0x73A,0x73B, ,3,2 , // DARK ROCK
};
this.passOverTiles = {
0x278,0x11,0x60,0x20,0x21,0x70,0x9B8,0x9B9
};
this.maxDistance = 15;
this.curMapC = {onmapx(#L),onmapy(#L)};
if (isonmap && this.oldMapC[0] >= 0 && this.oldMapC[1] >= 0){//move the boomerang to counter for the level change on maps
this.change = {this.curMapC[0]-this.oldMapC[0],this.curMapC[1]-this.oldMapC[1]};
this.boom.x -= this.change[0]*64;
this.boom.y -= this.change[1]*64;
}
else {//discard the boomerang
if (!isonmap){
this.curMapC[0] = -1;
this.curMapC[1] = -1;
}
this.boom.dist = 0;
this.boom.mode = 0;
this.boom.x = playerx;
this.boom.y = playery;
hideimg 1;
}
this.oldMapC = {this.curMapC[0],this.curMapC[1]};
}
if (weaponfired && this.boom.mode==0 && this.boom.dist<=3){
this.boom.level = strtofloat(#I(client.boomDat,0));
setstring this.triggerNC,;
setani shiny_boomerang-throw,shiny_boomerang-#v(this.boom.level).png;
freezeplayer .35;
this.boom.dx=0;
this.boom.dy=0;
this.boom.speed=1;
setstring this.boom.extras,;
this.originx=playerx+1.5;
this.originy=playery+2;
for (this.i=0;this.i<4;this.i++){
if (keydown(this.i)){
this.boom.dx+=vecx(this.i);
this.boom.dy+=vecy(this.i);
}
}
if (this.boom.dx==0 && this.boom.dy == 0){
this.boom.dx+=vecx(playerdir);
this.boom.dy+=vecy(playerdir);
}
this.boom.x=playerx+this.boom.dx;
this.boom.y=playery+this.boom.dy;
sleep .3;
showani 1,this.boom.x,this.boom.y,0,shiny_boomerang,shiny_boomerang-#v(this.boom.level).png;
this.boom.mode=1;
timeout=0.05;
}
if (timeout){
this.boom.dist=(((this.boom.x-this.originx)^2)+((this.boom.y-this.originy)^2))^.5;
CheckDrops();
CheckTiles();
CheckNpcs();
CheckBaddies();
this.onwallCheck = ((onwall(this.boom.x+1.5,this.boom.y+2) && !(tiles[this.boom.x+1.5,this.boom.y+2] in this.passOverTiles)) || this.tBaddy >= 0);
if (this.onwallCheck == 1 && this.boom.mode==1){
putleaps 4,this.boom.x+.5,this.boom.y+1;
}
if (this.onwallCheck == 0 && this.boom.mode==1 && this.boom.dist < this.maxDistance){
this.boom.x+=this.boom.dx*this.boom.speed;
this.boom.y+=this.boom.dy*this.boom.speed;
showani 1,this.boom.x,this.boom.y,0,shiny_boomerang,shiny_boomerang-#v(this.boom.level).png;
}
else {
this.boom.dist=(((this.boom.x-playerx)^2)+((this.boom.y-playery)^2))^.5;
this.boom.mode=0;
if (this.boom.dist<=3){
for (i=0;i<int(sarraylen(this.boom.extras)/3);i++) {
if (strtofloat(#I(this.boom.extras,i*3)) == 0) playerrupees += 1;
else if (strtofloat(#I(this.boom.extras,i*3)) == 1) playerrupees += 5;
else if (strtofloat(#I(this.boom.extras,i*3)) == 2) playerrupees += 30;
else if (strtofloat(#I(this.boom.extras,i*3)) == 3) playerbombs += 5;
else if (strtofloat(#I(this.boom.extras,i*3)) == 4) playerdarts += 5;
else if (strtofloat(#I(this.boom.extras,i*3)) == 5) playerhearts += 1;
else if (strtofloat(#I(this.boom.extras,i*3)) == 19) playerrupees += 100;
play extra.wav;
}
hideimg 1;
break;
}
else {
this.returnAngle = getangle(this.boom.x-playerx,playery-this.boom.y);
this.boom.x += cos(this.returnAngle)*(this.boom.speed*-1);
this.boom.y += sin(this.returnAngle)*(this.boom.speed*-1);
showani 1,this.boom.x,this.boom.y,0,shiny_boomerang,shiny_boomerang-1.png;
}
}
timeout=0.05;
}
function CheckDrops() {
this.checkitem = testitem(this.boom.x+1.5,this.boom.y+2);
if (this.checkitem >= 0) {
insertstring this.boom.extras,0,#v(random(-1,1));
insertstring this.boom.extras,0,#v(random(-1,1));
insertstring this.boom.extras,0,#v(items[this.checkitem].type);
take2 this.checkitem;
play extra.wav;
}
for (i=0;i<int(sarraylen(this.boom.extras)/3);i++) {
showimg 10+i,shiny_drops-1.png,this.boom.x+strtofloat(#I(this.boom.extras,i*3+1))+.5,this.boom.y+strtofloat(#I(this.boom.extras,i*3+2))+.5;
changeimgpart 10+i,0,0,32,32;
changeimgvis 10+i,0;
if (strtofloat(#I(this.boom.extras,i*3)) == 0) changeimgpart 10+i,0*32,0,32,32;
else if (strtofloat(#I(this.boom.extras,i*3)) == 1) changeimgpart 10+i,1*32,0,32,32;
else if (strtofloat(#I(this.boom.extras,i*3)) == 2) changeimgpart 10+i,2*32,0,32,32;
else if (strtofloat(#I(this.boom.extras,i*3)) == 3) changeimgpart 10+i,3*32,0,32,32;
else if (strtofloat(#I(this.boom.extras,i*3)) == 4) changeimgpart 10+i,4*32,0,32,32;
else if (strtofloat(#I(this.boom.extras,i*3)) == 5) changeimgpart 10+i,5*32,0,32,32;
else if (strtofloat(#I(this.boom.extras,i*3)) == 19) changeimgpart 10+i,6*32,0,32,32;
}
}
function CheckTiles() {
for (i=0;i<9;i++) {
this.objtile = -1;
for (j=0;j<int(arraylen(this.boomtiles)/12);j++) {
if (tiles[this.boom.x+(i%3),this.boom.y+int(i/3)] == this.boomtiles[j*12]) {
this.checkx = int(this.boom.x+(i%3));
this.checky = int(this.boom.y+int(i/3));
this.objtile = j;
break;
}
}
if (this.objtile >= 0 && this.boom.level >= this.boomtiles[10+this.objtile*12]){
putleaps this.boomtiles[11+this.objtile*12],this.checkx,this.checky;
for (j=0;j<4;j++) {
tiles[this.checkx+(j%2),this.checky+int(j/2)] = this.boomtiles[this.objtile*12+5+j];
}
updateboard this.checkx,this.checky,2,2;
}
}
}
function CheckNpcs(){
this.tNpc = testnpc(this.boom.x+1.5,this.boom.y+2);
if (this.tNpc >= 0 && lindexof(#v(this.tNpc),this.triggerNC) < 0){
addstring this.triggerNC,#v(this.tNpc);
callnpc this.tNpc,Boomerang,;
}
}
function CheckBaddies(){
this.tBaddy = testcompu(this.boom.x+1.5,this.boom.y+2);
if (this.tBaddy >= 0)
hitcompu this.tBaddy,1,this.boom.x+1.5,this.boom.y+2;
}
It also hurts baddies, uses a minimal return path and triggers npcs so you can do stuff like:
if (Boomerang){
message owe;
}