Author Topic: Danmakufu Q&A/Problem Thread v3  (Read 213421 times)

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #330 on: March 03, 2010, 01:07:27 PM »
EDIT: Why do my object shots look a lot brighter than the same shots created with CreatePlayerShot01()?

that... I have no idea why... I haven't been experimenting with graphic differences and stuff... :ohdear:
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #331 on: March 03, 2010, 01:15:39 PM »
EDIT: Why do my object shots look a lot brighter than the same shots created with CreatePlayerShot01()?

In your shot definition file (the one that starts with #PlayerShotData), if you defined an alpha value, it will use that when doing CreatePlayerShot01. However, if you create the bullet as an object, you need to manually set the alpha with Obj_SetAlpha.
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.

8lue Wizard

  • Cobalt Magician
  • (Apparently)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #332 on: March 03, 2010, 01:22:55 PM »
^ I thought of that, but even using Obj_SetAlpha to the same value, the object shots are still brighter.



Obj shots from main body (without/with setalpha), CreatePlayerShot01's from the options.
« Last Edit: March 03, 2010, 01:40:34 PM by Blue Mouse »

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #333 on: March 03, 2010, 01:35:49 PM »
Hmmmm.... strange. It worked for my player.
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.

8lue Wizard

  • Cobalt Magician
  • (Apparently)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #334 on: March 03, 2010, 02:22:22 PM »
>.< Wow. I'm either really failing today or... well, I'm just really failing today.

Code: [Select]
            let j = 0;
            while(j < length(Arrow)){
                let obj = Arrow[j];
                if(!Obj_BeDeleted(obj)){
                    if(((GetEnemyInfo(bastard, ENEMY_X)-Obj_GetX(obj))^2+
                        (GetEnemyInfo(bastard, ENEMY_Y)-Obj_GetY(obj))^2)^0.5<=20) {
                        ping = true;
                        // do stuff;
                        Obj_Delete(obj);
                    } else if (Obj_GetY(obj) <= GetClipMinY()) {
                        Obj_Delete(obj);
                    }
                } else {
//                    erase(Arrow,j);
//                    j--;
                }
                j++;
            }

If I un-comment out those lines, it does an infinite loop, but... that's a standard maneuver for iterating through an array, isn't it?

Re: Danmakufu Q&A/Problem Thread v3
« Reply #335 on: March 03, 2010, 02:53:51 PM »
If you uncomment out those lines, then j will decrease below length(Arrow), and thus the while( j < length(Arrow) ) will always be true, causing an infinite loop, I assume. Chances are your logic is incorrect somewhere, though I can't see it at the moment. Enemy enumeration has never looked so confusing.
« Last Edit: March 03, 2010, 02:55:30 PM by Naut »

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #336 on: March 03, 2010, 03:03:32 PM »
If you uncomment out those lines, then j will decrease below length(Arrow), and thus the while( j < length(Arrow) ) will always be true, causing an infinite loop, I assume. Chances are your logic is incorrect somewhere, though I can't see it at the moment. Enemy enumeration has never looked so confusing.

doesn't j stay the same? cause there's both a j++; and a j--;

but then you're also erasing something in the array... which I think is the 1st (or 0 in array) term...

Code: [Select]
            let j = 0;
            while(j < length(Arrow)){
                let obj = Arrow[j];
                if(!Obj_BeDeleted(obj)){
                    if(((GetEnemyInfo(bastard, ENEMY_X)-Obj_GetX(obj))^2+
                        (GetEnemyInfo(bastard, ENEMY_Y)-Obj_GetY(obj))^2)^0.5<=20) {
                        ping = true;
                        // do stuff;
                        Obj_Delete(obj);
                    } else if (Obj_GetY(obj) <= GetClipMinY()) {
                        Obj_Delete(obj);
                    }
                } else {
//                    erase(Arrow,j);
//                    j--;
                }
                j++;
            }

Ok... analyze...

Getting an object from the array Arrow:
1)As long as it's not deleted:
1a)If it's 20 pixels away from "bastard", do stuff and delete it
1b)Otherwise, if it's above the playing field, delete it
2)If it HAS been deleted, remove it from the array, and subtract 1 from j
3)Add 1 to j after all that...

this makes j and the length of the array go down if something has been deleted, and j increases reaching the length sooner or later...

so you're basically checking everything in the array if they're either close to "bastard" or above the field...
« Last Edit: March 03, 2010, 03:24:35 PM by Kylesky »
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

8lue Wizard

  • Cobalt Magician
  • (Apparently)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #337 on: March 03, 2010, 03:10:12 PM »
except that every time j--; executes, so does erase();, which causes length(Arrow) to drop by 1 as well. So it should be getting 1 closer to finishing every time... except that it's not.

but then... aren't you saying here that if it's not 20 pixels away from "bastard" you automatically do the commented out lines?

No, the else is operating on if(!Obj_BeDeleted()) - in other words, only if the object I pulled out of Arrow no longer exists

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #338 on: March 03, 2010, 03:13:55 PM »
No, the else is operating on if(!Obj_BeDeleted()) - in other words, only if the object I pulled out of Arrow no longer exists

sorry... that was wrong... I updated my previous post if you noticed :D
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

8lue Wizard

  • Cobalt Magician
  • (Apparently)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #339 on: March 03, 2010, 03:42:08 PM »
know what? **** it. I'll make 'em straight homing. Maybe I'll come back to this method when I implement it for Musuu. (It'll be SO much goddamn easier in Musuu, too.)

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #340 on: March 03, 2010, 03:49:55 PM »
know what? **** it. I'll make 'em straight homing. Maybe I'll come back to this method when I implement it for Musuu. (It'll be SO much goddamn easier in Musuu, too.)

yeowtch... another person pissed at danmakufu... (nice graphics for that nazrin player btw... are the mice the ones in the Arrow array?)
« Last Edit: March 03, 2010, 03:54:40 PM by Kylesky »
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #341 on: March 03, 2010, 04:00:44 PM »
Taking it to this thread now.

As you may have noticed, I have released a new project. If you have played it or read the thread, you may have noticed this:

...though it has an unhealthy tendency to do this:



Sometimes right when I launch the script, occasionally after the ten-second intro "attack"; once I'm into the script proper, I'm usually okay, though one time it crashed halfway through. >.>

It's intermittent, and I've never seen DMF act like this before, so... ???

There seems to be nothing wrong with the individual spell- and non-card scripts, so I'm asking you, why would a plural script randomly cause danmakufu to crash? Could it be because of the type of file used for the bgm or something? I'm stumped.
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

Re: Danmakufu Q&A/Problem Thread v3
« Reply #342 on: March 03, 2010, 04:04:19 PM »
NEVER USE .OGG AND DANMAKUFU

EVER
« Last Edit: March 03, 2010, 04:05:50 PM by Naut »

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #343 on: March 03, 2010, 04:11:35 PM »
Ah. Ok.

 :blush:
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #344 on: March 03, 2010, 04:16:14 PM »
Code: [Select]
            let j = 0;
            while(j < length(Arrow)){
                let obj = Arrow[j];
                if(!Obj_BeDeleted(obj)){
                    if(((GetEnemyInfo(bastard, ENEMY_X)-Obj_GetX(obj))^2+
                        (GetEnemyInfo(bastard, ENEMY_Y)-Obj_GetY(obj))^2)^0.5<=20) {
                        ping = true;
                        // do stuff;
                        Obj_Delete(obj);
                    } else if (Obj_GetY(obj) <= GetClipMinY()) {
                        Obj_Delete(obj);
                    }
                } else {
//                    erase(Arrow,j);
//                    j--;
                }
                j++;
            }

If I un-comment out those lines, it does an infinite loop, but... that's a standard maneuver for iterating through an array, isn't it?

Why oh why do people NEVER use ascents or descents for this stuff. Descents are ideal when dealing with arrays where you need to delete something if it doesn't match a certain condition. Lemme rewrite this for you:

Code: [Select]
            descent(j in 0..length(Arrow)){
                let obj = Arrow[j];
                if(!Obj_BeDeleted(obj)){
                    if(((GetEnemyInfo(bastard, ENEMY_X)-Obj_GetX(obj))^2+
                        (GetEnemyInfo(bastard, ENEMY_Y)-Obj_GetY(obj))^2)^0.5<=20) {
                        ping = true;
                        // do stuff;
                        Obj_Delete(obj);
                    } else if (Obj_GetY(obj) <= GetClipMinY()) {
                        Obj_Delete(obj);
                    }
                } else {
                      erase(Arrow,j);
                }
            }
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #345 on: March 03, 2010, 04:24:45 PM »
Why oh why do people NEVER use ascents or descents for this stuff. Descents are ideal when dealing with arrays where you need to delete something if it doesn't match a certain condition. Lemme rewrite this for you:

Code: [Select]
            descent(j in 0..length(Arrow)){
                let obj = Arrow[j];
                if(!Obj_BeDeleted(obj)){
                    if(((GetEnemyInfo(bastard, ENEMY_X)-Obj_GetX(obj))^2+
                        (GetEnemyInfo(bastard, ENEMY_Y)-Obj_GetY(obj))^2)^0.5<=20) {
                        ping = true;
                        // do stuff;
                        Obj_Delete(obj);
                    } else if (Obj_GetY(obj) <= GetClipMinY()) {
                        Obj_Delete(obj);
                    }
                } else {
                      erase(Arrow,j);
                }
            }

why the heck did I forget ascents and descents... *facepalm*
I used that in my original! :blush:
Specifically here...

...
Code: [Select]
task ringshots(x, y, angle)
{
...
ascent(i in EnumEnemyBegin..EnumEnemyEnd) {
enemy_target=EnumEnemyGetID(i);
if( ((GetEnemyInfo(enemy_target, ENEMY_X)-Obj_GetX(obj))^2+(GetEnemyInfo(enemy_target, ENEMY_Y)-Obj_GetY(obj))^2)^0.5<=20) //distance from bullet to enemy is less than 20 (it's a big bullet)
{
CreatePlayerShot01(Obj_GetX(obj),Obj_GetY(obj),1,270,1.5,1,2);
Obj_Delete(obj);
}
}
}
}
Am such an idiot...
« Last Edit: March 03, 2010, 04:27:59 PM by Kylesky »
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #346 on: March 03, 2010, 04:25:41 PM »
Why oh why do people NEVER use ascents or descents for this stuff. Descents are ideal when dealing with arrays where you need to delete something if it doesn't match a certain condition.
They are not in the video tutorials. Go figure.

All this loop(n){ x++; do shit related to x; } and while(x<n){ x++; do shit related to x; } is so much more typing and less clear compared to simply using ascents and descents. I almost though I was the only one that regularly uses them. Glad you disproved me on this one


Also: Damn, as an mp3 the loop point of the music got changed yet again. Now I'll have to refix it... >.<
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

8lue Wizard

  • Cobalt Magician
  • (Apparently)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #347 on: March 03, 2010, 04:27:08 PM »
yeowtch... another person pissed at danmakufu... (nice graphics for that nazrin player btw... are the mice the ones in the Arrow array?)

No, the purple shots were in Arrow. The idea was, each of the mice can track a target, and their distance to that target. (measured in frames, of course) Whenever a "dowsing" shot hit an enemy, it'd relay that position to each of the mice; if the mouse is closer to that enemy than its current target (or if it doesn't have a target) then it turns and chases the new enemy.

I've gone through and commented up my code, in case anybody wants to poke around and see just what the **** is going wrong.

Why oh why do people NEVER use ascents or descents for this stuff. Descents are ideal when dealing with arrays where you need to delete something if it doesn't match a certain condition. Lemme rewrite this for you:

I'm not sure which would piss me off more: if this doesn't work, or if it does. Going to try it now.

It's not crashing, but slowdown happens really quickly (down to ~20fps after 10-15 seconds; compare my original with commented-out lines, which was ~54fps at the end of my 45s test card)

edit: D'OH! I figured it out... I wasn't using erase() right. I was expecting it to modify the array I passed it, but instead it returns the modified array. v_v gyeh...

Worst part is, this isn't the first time I've made this mistake. >.< (though never with this magnitude of breakage)
« Last Edit: March 03, 2010, 04:38:30 PM by Blue Mouse »

Re: Danmakufu Q&A/Problem Thread v3
« Reply #348 on: March 03, 2010, 04:39:56 PM »
never mind, I remember you have to have a TRAIGNLELIST or something like that
« Last Edit: March 03, 2010, 04:47:19 PM by Demonbman »

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #349 on: March 03, 2010, 04:41:40 PM »
D'OH! I figured it out... I wasn't using erase() right. I was expecting it to modify the array I passed it, but instead it returns the modified array. v_v gyeh...

Worst part is, this isn't the first time I've made this mistake. >.< (though never with this magnitude of breakage)

Ahahaha, wow. I dunno how I didn't catch that either.
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #350 on: March 03, 2010, 04:42:09 PM »
@ Demonbman:

You forgot the ObjEffect_SetPrimitiveType command.
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #351 on: March 03, 2010, 04:43:41 PM »
Also, don't forget the load the graphic if you didn't... since a lot of people also forget to do that...
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread v3
« Reply #352 on: March 03, 2010, 06:22:10 PM »
What you try to accomplish is certainly possibly, but you need conditional statements. I happen to have used such code in a form of my newest project...  :V

Assuming ang is the angle you have and (x|y) is the point from which you need the distance from, it should look something like this...

Code: [Select]

function GetShit(x, y, ang){

let dist1;
let dist2;

while(ang>180){ ang-=360; }
while(ang<=-180){ ang+=360; }

let atl=atan2(GetClipMinY-y, GetClipMinX-x); //angle to top left corner
let atr=atan2(GetClipMinY-y, GetClipMaxX-x); //angle to top right corner
let abl=atan2(GetClipMaxY-y, GetClipMinX-x); //angle to bottom left corner
let abr=atan2(GetClipMaxY-y, GetClipMaxX-x); //angle to bottom right corner

if(ang>=atl && ang<=atr){ // In that case, the angle points to the top
  dist1=y-GetClipMinY;
  dist2=( (dist1^2) * ( (dist2/tan(ang+90))^2) )^0.5;
}
if(ang>=abr && ang<=abl){ // In that case, the angle points to the bottom
  dist1=GetClipMaxY-y;
  dist2=( (dist1^2) * ( (dist2/tan(ang))^2) )^0.5;
}
if(ang>=atr && ang<=abr){ // In that case, the angle points to the right side
  dist1=GetClipMaxX-x;
  dist2=( (dist1^2) * ( (dist2/tan(ang-90))^2) )^0.5;
}
if( (ang>=-180 && ang<=atl) || (ang>=abl && ang<=180) ){ // In that case, the angle points to the left side
  dist1=x-GetClipMinX;
  dist2=( (dist1^2) * ( (dist2/tan(ang+180))^2) )^0.5;
}

return dist2;
}

I don't know if this works, but I am too tired to test is right now and have to go to sleep in ~ 20 minutes. If the code doesn't work, I'll get back to it tomorrow.

Your code returned this error:
---------------------------
ScriptError「C:\Users\AweStriker\Downloads\th_dnh\script\AweScript\PrismStar.txt」
---------------------------
一回も代入していない変数を使おうとしました(91行目)

  dist2=( (dist1^2) * ( (dist2/tan(ang+90))^2) )^0.5;
}
if(ang>=abr && ang<=abl){ // In that case, the angle points to the b
~~~
---------------------------
OK   
---------------------------

which is variable-related.
(Also I renamed it to GetDistToEdge, because I like indicative names)

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #353 on: March 03, 2010, 06:25:29 PM »
And I instantly see why. This is why I shouldn't code 20 minutes before going to bed.  :V

dist2=( (dist1^2) * ( (dist2/tan(ang+90))^2) )^0.5;

should be

dist2=( (dist1^2) * ( (dist1/tan(ang+90))^2) )^0.5;

Fix this error in all the respective lines, then test again. Hopefully it will work.

Edit: Ack, screw it! It should be:


dist2=( (dist1^2) + ( (dist1/tan(ang+90))^2) )^0.5;
« Last Edit: March 03, 2010, 06:32:37 PM by Iryan »
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread v3
« Reply #354 on: March 03, 2010, 07:48:09 PM »
Well, that spellcard's done, but I'm having trouble with the next one.
Yes, this is for a boss...
Code: [Select]
#TouhouDanmakufu
#Title[Reflection Sniper]
#Text[Looks more like a bomb than a bullet]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{

let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "Materials\Graphics\PlaceholderBoss.png";
#include_function "lib\ExpandedShotDatav4\shot_replace.dnh";

@Initialize{
SetLife(1000);
SetDamageRate(25,15);
SetTimer(40);
SetScore(1000);
SetMovePosition02(GetCenterX,GetCenterY,5);
LoadGraphic(imgBoss);
ShotInit;
mainTask;
}

@MainLoop{
SetCollisionA(GetX,GetY,32);
SetCollisionB(GetX,GetY,16);
yield;
}

@DrawLoop{

SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,64,64);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);

}

@BackGround{



}

@Finalize{

DeleteGraphic(imgBoss);

}
task mainTask{
wait(60);
startmove;
wait(60);
SniperGun;
ascent(i in -1..1){
ReflectPod(GetAngle+60*i);
}
}

task startmove{
let cirno=9;
let anglechange;
let curvetime = 0;
SetSpeed(1);
SetAngle(rand(0,360));
let selected = GetAngle;
while(cirno==9){
SetAngle(selected);
SetSpeed(1);
anglechange=rand(-0.2,0.2);
if(curvetime>=120){
loop(150){
SetAngle(GetAngle+anglechange);
SetSpeed(1);
if(GetEnemyX<GetClipMinX){
SetAngle(rand(-90,90));
}
if(GetEnemyX>GetClipMaxX){
SetAngle(rand(90,270));
}
if(GetEnemyY<GetClipMinY){
SetAngle(rand(0,180));
}
if(GetEnemyY>GetClipMaxY){
SetAngle(rand(180,360));
}
yield;
}
curvetime=0;
selected=rand(0,360);
SetSpeed(0);
wait(120);
}
curvetime++;
if(GetEnemyX<GetClipMinX){
SetAngle(rand(-90,90));
selected = GetAngle;
SetSpeed(1);
}
if(GetEnemyX>GetClipMaxX){
SetAngle(rand(90,270));
selected = GetAngle;
SetSpeed(1);
}
if(GetEnemyY<GetClipMinY){
SetAngle(rand(0,180));
selected = GetAngle;
SetSpeed(1);
}
if(GetEnemyY>GetClipMaxY){
SetAngle(rand(180,360));
selected = GetAngle;
SetSpeed(1);
}
yield;
}
}

task fire{

}

task ReflectPod(angle){
let reflecttime=0;
let reflect = Obj_Create(OBJ_SHOT);
Obj_SetPosition(reflect,GetX,GetY);
Obj_SetAngle(reflect,angle);
ObjShot_SetGraphic(reflect,ORANGE02);
Obj_SetSpeed(reflect,1);
ObjShot_SetBombResist(reflect,true);
Obj_SetCollisionToPlayer(reflect,false);
while(!Obj_BeDeleted(reflect)){
if(Obj_GetX(reflect)<=GetClipMinX||Obj_GetX(reflect)>=GetClipMaxX){
Obj_SetAngle(reflect,180-angle);
}
if(Obj_GetY(reflect)<=GetClipMinY||Obj_GetY(reflect)>=GetClipMaxY){
Obj_SetAngle(reflect,360-angle);
}
if(reflecttime==540){
explosion(Obj_GetX(reflect),Obj_GetY(reflect));
Obj_Delete(reflect);
}
if(GetDistance(Obj_GetX(reflect),Obj_GetY(reflect),GetPlayerX,GetPlayerY)<12){
explosion(Obj_GetX(reflect),Obj_GetY(reflect));
Obj_Delete(reflect);
}
reflecttime++;
wait(1);
}
}

task SniperGun{
CreateLaser01(GetX,GetY,5,GetAngleToPlayer,100,25,PURPLE41,0);
}

task DualBomb{

}

function explosion(x,y){
let dir = 90;
loop(5){
CreateShotA(1,x,y,0);
SetShotDataA(1,0,0.1,dir,0.5,0,0,ORANGE03);
SetShotKillTime(1,240);
CreateShotA(2,0,0,0);
SetShotDataA(2,0,5,dir,0,-0.8,1,ORANGE01);
ascent(m in 1..24){
AddShot(m*10,1,2,0);
}
FireShot(1);
dir+=360/5;
}
loop(25){
CreateShot01(x,y,1,dir,RED01,0);
dir+=360/25;
}
}

function wait(w){
loop(w){yield;}
}

function GetDistance(x1,y1,x2,y2){
return(((x2-x1)^2+(y2-y1)^2)^(1/2))
}
}

There are several problems:
1. Only 2 reflect objectshots are being spawned. Where's the third one?

2. The reflect objectshots will bounce in the opposite direction of the one they were traveling rather than actually reflect (but only after they've bounced once; the first bounce is a true reflection)

3. Only one ORANGE01 shot is spawned from the explosion function. There should be one every ten frames.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #355 on: March 03, 2010, 08:00:12 PM »
There are several problems:
1. Only 2 reflect objectshots are being spawned. Where's the third one?
The ascent function starts on the lowest value and increases by one each loop, ending when it is 1 lower than the upper bound. ascent(i in 0..3){} is done once for i=0, i=1 and i=2. Your stuff is repeated for i=-1 and i=0. To make it work, change it to (i in -1..2)
 
Quote
3. Only one ORANGE01 shot is spawned from the explosion function. There should be one every ten frames.
Um, you are adding shots, okay, but you are not creating the shots you are adding. You only create one shot and then try to add that one shot 23 times. After the first time, the id ceases to exist and you have to create it again.
Code: [Select]
         CreateShotA(2,0,0,0);
         SetShotDataA(2,0,5,dir,0,-0.8,1,ORANGE01);
         ascent(m in 1..24){
            AddShot(m*10,1,2,0);
         }
...should be...
Code: [Select]
         ascent(m in 1..24){
            CreateShotA(m*10,0,0,0);
            SetShotDataA(m*10,0,5,dir,0,-0.8,1,ORANGE01);
            AddShot(m*10,1,m*10,0);
         }


Quote
2. The reflect objectshots will bounce in the opposite direction of the one they were traveling rather than actually reflect (but only after they've bounced once; the first bounce is a true reflection)
You are determining the new angle based on the variable angle, not on the actual angle of the bullet. On the first reflection they are still the same, but after that they are not. To fix this, insert angle=Obj_GetAngle(reflect); into your while loop{}.

« Last Edit: March 03, 2010, 08:02:28 PM by Iryan »
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

Drake

  • *
Re: Danmakufu Q&A/Problem Thread v3
« Reply #356 on: March 03, 2010, 10:14:06 PM »
Sorry for bringing this up now, but
They are not in the video tutorials. Go figure.
made me rage really hard, even though obviously Iryan isn't talking about himself.

The wiki and other tutorials exist for a reason. Hele's tutorials are not everything that can be possibly explained to you, and they're just videos. He's not going to explain to you every fucking little thing danmakufu has buried in it's predeffed function list and every nuance of it's syntax. They aren't explaining super duper complex programming shit, nor does it explain every simple little programming turd. The wiki exists as a reference to the functions that are available and what you can do with the base of the language, so use it. This also goes for the other tutorials. They're damn fine tutorials, and it would pain me to see questions being asked that could have been answered easily if the person would use the VERY OBVIOUSLY PLACED RESOURCES outlined for them.

fuckjsd

EDIT: complaining about danmakufu is best reserved for stuff that is impossible due to it's own limitations, or really really complicated stuff that generally is hard to accomplish by anyone and/or takes stupidly large amounts of time to complete
« Last Edit: March 03, 2010, 10:16:15 PM by Drake »

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Re: Danmakufu Q&A/Problem Thread v3
« Reply #357 on: March 03, 2010, 10:44:32 PM »
@ Demonbman:

You forgot the ObjEffect_SetPrimitiveType command.
lol I notice that now
But now that I put it in it still doesnt work :X

Ill post the whole Bomb script

Code: [Select]
script_spell Ultimate_Shield{
let shield = GetCurrentScriptDirectory~"img\字る.png";
let sparkle = GetCurrentScriptDirectory~"img\effect.png";
let spin = 4;

@Initialize{yield; LoadGraphic(shield); LoadGraphic(sparkle); run();}
@MainLoop{spin++; yield;}
@Finalize{DeleteGraphic(shield); DeleteGraphic(sparkle);}

task run(){SetPlayerInvincibility(220); loop(10){yield;} Sparlke; loop(220){yield;} End;}

task Sparlke{
loop{
loop(1){yield;}
Sparkle(GetPlayerX+rand(-120,120),GetPlayerY+rand(-120,120));
}}

task Sparkle(xx,yy){

let spark=Obj_Create(OBJ_EFFECT);
let atta = 0;
let attb = 0;
let attfra = 0;

ObjEffect_SetTexture(spark,sparkle);
ObjEffect_SetScale(spark,1,1);
ObjEffect_SetRenderState(spark,255);
ObjEffect_CreateVertex(spark,8);
ObjEffect_SetLayer(spark,8);
ObjEffect_SetPrimitiveType(spark,PRIMITIVE_TRIANGLEFAN);

while(Obj_BeDeleted(spark)==false){attfra++;

   ObjEffect_SetVertexXY(spark, 0, xx-20,yy-20);
   ObjEffect_SetVertexXY(spark, 1, xx,yy-20);
   ObjEffect_SetVertexXY(spark, 2, xx+20,yy-20);
   ObjEffect_SetVertexXY(spark, 3, xx+20,yy);
   ObjEffect_SetVertexXY(spark, 4, xx+20,yy+20);
   ObjEffect_SetVertexXY(spark, 5, xx,yy+20);
   ObjEffect_SetVertexXY(spark, 6, xx-20,yy+20);
   ObjEffect_SetVertexXY(spark, 7, xx-20,yy);

ObjEffect_SetVertexUV(spark,0,0,0);
ObjEffect_SetVertexUV(spark,1,0,10);
ObjEffect_SetVertexUV(spark,2,0,20);
ObjEffect_SetVertexUV(spark,3,10,0);
ObjEffect_SetVertexUV(spark,4,20,20);
ObjEffect_SetVertexUV(spark,5,20,10);
ObjEffect_SetVertexUV(spark,6,20,0);
ObjEffect_SetVertexUV(spark,7,10,0);

if(attfra>80){atta++;
ObjEffect_SetVertexXY(spark, 1, xx,yy-20+atta);
ObjEffect_SetVertexXY(spark, 3, xx+20-atta,yy);
ObjEffect_SetVertexXY(spark, 5, xx,yy+20-atta);
ObjEffect_SetVertexXY(spark, 7, xx-20+atta,yy);}

if(atta==20){Obj_Delete(spark);}
}}

What I want to happen is a object that appears, then the corners fold in, but I cant even get the image to appear at all >_<;
« Last Edit: March 04, 2010, 05:20:36 AM by Demonbman »

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread v3
« Reply #358 on: March 04, 2010, 12:59:18 AM »
 >:(

Okay, I'm fed up with this... I've been trying to use COLOR## shot IDs with Shot Replace V4, and I can't get it to work. I'm assuming the problem is somewhere in the shot_replace.dnh file, as if I put in the plain number ID it works fine. There is EXACTLY ONE LINE that could possibly have the problem in it...
Code: [Select]
LoadUserShotData(".\supershot.txt")And that would be it.

What the heck do I put in that line to make it work, if anything will? Or does the sub need to be a function, or a task? Or do I just need to use the numbers?

Re: Danmakufu Q&A/Problem Thread v3
« Reply #359 on: March 04, 2010, 02:09:59 AM »
There is no shot_replace.dnh that comes with supershot v4 or v4.1. Did you make your own?