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

Re: Danmakufu Q&A/Problem Thread v3
« Reply #750 on: May 14, 2010, 01:40:03 AM »
I'm afraid I don't follow, I gave you info... The spell, clearly doesn't show up. If the spell didn't show up when I chose it, I would have said so, if that's what you meant.

You didn't give us anything. There are many reasons for many problems, telling us only the problem without any other information is very unhelpful. If you can't relay anything else, your best bet it to just post the script along with a brief description of your problem, as well as any possible solutions you may have already tried. Like Drake said, we can "best guess" the problem due to other people running into similar obstacles (and the very likely mistakes they made), but once you get better at scripting your problems will become more elaborate and we won't be able to guess it based off of your coding skill as we perceive it.

The best way to receive help is to post your script.

Re: Danmakufu Q&A/Problem Thread v3
« Reply #751 on: May 14, 2010, 02:10:57 AM »
Goddammit adding any comments gives me a script_enemy_main error WHY DO YOU DO THIS TO ME

Code: [Select]
#TouhouDanmakufu
#Title[Hibachi]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main
{
let frame = 0;
let attack = 5;

@Initialize
{
LoadUserShotData(GetCurrentScriptDirectory ~ "supershot\supershot.txt");
SetLife(18000);
SetInvincibility(60);
MagicCircle(false);
SetRateScoreSystemEnable(false);
PlayMusic(GetCurrentScriptDirectory ~ "bgm\]-[_-34(#!.mp3");
SetMovePosition02(GetCenterX, GetCenterY - 120, 10);

}

@MainLoop
{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
Bombimmunity;
if(GetLife<18000 && attack == 5)
{
pew;
attack = 6;
}
if(GetPlayerLife==1){SetLife(0);}

frame++;
yield;
}

@DrawLoop
{

}

@Finalize
{
}

function Wait(frames){loop(frames){yield;}}

task Bombimmunity
{
if(OnBomb)
{
SetDamageRate(0,0);
}
else
{
SetDamageRate(100, 0);
}
}

task pew
{
}

task pew2
{
ascent(j in 0..60)
{
ascent(i in 0..30)
{
CreateShot02(GetX+50*cos(i*360/30+j*4.5), GetY+50*sin(i*360/30+j*4.5), 4, i*360/30+j*4.5, -0.02, 2, PURPLE21, 10);
}
Wait(6);
}
Wait(30);
pew;
}
}

空SoraのNo鏡Kagami

  • Wolven Wind Warrior of the West (That's catchy)
  • Occupation: Hopeless Amazing Young Scriptor
Re: Danmakufu Q&A/Problem Thread v3
« Reply #752 on: May 14, 2010, 02:46:00 AM »
You didn't give us anything. There are many reasons for many problems, telling us only the problem without any other information is very unhelpful. If you can't relay anything else, your best bet it to just post the script along with a brief description of your problem, as well as any possible solutions you may have already tried. Like Drake said, we can "best guess" the problem due to other people running into similar obstacles (and the very likely mistakes they made), but once you get better at scripting your problems will become more elaborate and we won't be able to guess it based off of your coding skill as we perceive it.

The best way to receive help is to post your script.

Well, the problem was me forgetting to put #TouhouDanmakufu...
Me: Rapture is comin'
Person: OMG WHEN!
Me: Naow, APOCALYPSE SIGN "RAPTURE"!

Drake

  • *
Re: Danmakufu Q&A/Problem Thread v3
« Reply #753 on: May 14, 2010, 03:17:17 AM »
There we go. That would have been solved nigh immediately if you had posted your script. Keep it in mind.

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

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 #754 on: May 14, 2010, 04:08:51 AM »
Code: [Select]
PlayMusic(GetCurrentScriptDirectory ~ "bgm]-[_-34(#!.mp3");

WTF IS THAT!?!?!? :yumemi:
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Drake

  • *

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

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread v3
« Reply #756 on: May 14, 2010, 08:29:36 PM »
Had some inspiration and time to fool around with danmakufu, so I wanted to create a 12 sided TRIANGLEFAN magic circle. Now before everybody jumps the boat saying: DONT USE TRIANGLEFAN!!! USE STRIP. No, I need trianglefan here because the image I am using is not a strip like Fujiwara's circle tutorial.

Anyway, the vertex placing went smooth with some trig code ( /me brofists Drake & Naut ) but the UV placing is making me rage hard.

Code: [Select]
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(obj, 13);

ObjEffect_SetVertexXY(obj, 0, 0, 0);

ascent(circx in 1..13){
ObjEffect_SetVertexXY(obj, circx, circsize*cos(circx*360/11), circsize*sin(circx*360/11));
ObjEffect_SetVertexUV(obj, circx, ????, ???);   // <------- ?????????????

}

Image used:

Basically, how do I set up the code for the UV ? =|
« Last Edit: May 14, 2010, 08:57:16 PM by Helepolis »

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem Thread v3
« Reply #757 on: May 14, 2010, 08:34:00 PM »
No, I need trianglefan here because the image I am using is not a strip like Fujiwara's circle tutorial.
[...]
Basically, how do I set up the code for the UV ? =|
If you're not using the standard image, then nobody will know how to set up the vertices without seeing said image first.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread v3
« Reply #758 on: May 14, 2010, 08:57:46 PM »
If you're not using the standard image, then nobody will know how to set up the vertices without seeing said image first.
Rectangular image, 128x128. Forgot to add to my post. It is now added.

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem Thread v3
« Reply #759 on: May 14, 2010, 11:14:27 PM »
Then the coordinates should be exactly the same for UV as they are for XY. Just use half the width of the image instead of the radius of the circle, and add half the width of the image to both sets of coordinates too:

Code: [Select]
   ascent(circx in 1..13){
      ObjEffect_SetVertexXY(obj, circx, circsize*cos(circx*360/11), circsize*sin(circx*360/11));
      ObjEffect_SetVertexUV(obj, circx, 64*cos(circx*360/11)+64, 64*sin(circx*360/11)+64);
     
   }

8lue Wizard

  • Cobalt Magician
  • (Apparently)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #760 on: May 14, 2010, 11:26:39 PM »
   ascent(circx in 1..13){
      ObjEffect_SetVertexXY(obj, circx, circsize*cos(circx*360/11), circsize*sin(circx*360/11));

typo?

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread v3
« Reply #761 on: May 16, 2010, 11:12:01 AM »
Blue Basil, no it is not a typo. Else the circle won't close and leaves open a triangle.

Then the coordinates should be exactly the same for UV as they are for XY. Just use half the width of the image instead of the radius of the circle, and add half the width of the image to both sets of coordinates too:

Code: [Select]
   ascent(circx in 1..13){
      ObjEffect_SetVertexXY(obj, circx, circsize*cos(circx*360/11), circsize*sin(circx*360/11));
      ObjEffect_SetVertexUV(obj, circx, 64*cos(circx*360/11)+64, 64*sin(circx*360/11)+64);
     
   }
You are ace Azure. It worked. The only thing needed was setting ObjEffect_SetVertexUV(obj, 0, 64, 64); for the first vertex, else a small gap remained open.

Thank you =3


Question #2

New question regarding math and stuff. How do I pinpoint the angle towards the player using SetMovePosition? If I apply the "homing" code from Obj Bullets the Boss starts doing weird stuff. I basically want the boss to launch itself towards the player, but continue the angular path so it moves out of the screen. Basically it is like Marisa's Blazing Star

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 #762 on: May 16, 2010, 11:28:40 AM »
I basically want the boss to launch itself towards the player, but continue the angular path so it moves out of the screen. Basically it is like Marisa's Blazing Star

I tried to do that before... remember how boss/enemy scripts have SetSpeed and SetAngle?
Code: [Select]
task movement{
    SetAngle(GetAngleToPlayer);
    SetSpeed(3);
    while(GetX>GetClipMinX-30 && GetX<GetClipMaxX+30 && GetY>GetClipMinY-30 && GetY<GetClipMaxY+30){yield;}
    SetSpeed(0);
}
Change however you want...



Now for a question of my own :V

How would you detect if something's in an OVAL... circle's are easy with:
Code: [Select]
if(((x1-x2)^2+(y1-y2)^2)^0.5<=radius)but what about ovals? I'm guessing it also uses the distance function, but a value that changes depending on the length, width and angle of the oval will replace the radius...
« Last Edit: May 16, 2010, 03:04:44 PM by Kylesky »
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Re: Danmakufu Q&A/Problem Thread v3
« Reply #763 on: May 16, 2010, 06:33:34 PM »
Now for a question of my own :V

How would you detect if something's in an OVAL... circle's are easy with:
Code: [Select]
if(((x1-x2)^2+(y1-y2)^2)^0.5<=radius)but what about ovals? I'm guessing it also uses the distance function, but a value that changes depending on the length, width and angle of the oval will replace the radius...

This was just fucking painful. I tried out numerous prototype functions, like...

Code: [Select]
function EllipseCollision(x, y, c, d, r, s, angle, radius){
return
(s^2)(cos(angle)^2)(x^2) + (s^2)(sin(angle)^2)(y^2) - (s^2)(2)(x*cos(angle))(y*sin(angle)) - (s^2)(2)(x*c*cos(angle)) - (s^2)(2)(y*c*sin(angle)) + (s^2)(c^2) +
(r^2)(sin(angle)^2)(x^2) + (r^2)(cos(angle)^2)(y^2) + (r^2)(2)(x*cos(angle))(y*cos(angle)) - (r^2)(2)(y*d*cos(angle)) - (r^2)(2)(x*d*sin(angle)) + (r^2)(d^2) - (r^2)(d^2)
<= radius;
}

...or even...

Code: [Select]
function EllipseCollision(x, y, c, d, r, s, angle, radius){
let A = (s*s)*(cos(angle)*cos(angle)) + (r*r)*(sin(angle)*sin(angle));
let B = (s*s)*(sin(angle)*sin(angle)) + (r*r)*(cos(angle)*cos(angle));
let C = -2*((s*s)*(c*cos(angle)) + (r*r)*(d*sin(angle)));
let D = -2*((s*s)*(c*sin(angle)) + (r*r)*(d*cos(angle)));
let E = 2*((s*s)*(cos(angle)*sin(angle)) - (r*r)*(cos(angle)*sin(angle)));
let F = (s*s)*(c*c) + (r*r)*(d*d) - (r*r)*(s*s);

return A*x^2  + B*y^2  + C*x + D*y + E*x*y + F <= radius;
}

Only to find out something so fucking simple that I threw together after thinking about what we're trying to do for 30 seconds...

Code: [Select]
function EllipseCollision(x, y, c, d, r, s, angle){
return ((x-c)^2+(y-d)^2)^0.5 <= (|r*cos(angle) + s*sin(angle)|);
}

Actually works.

KILL ME NOW
« Last Edit: May 16, 2010, 10:50:10 PM by Naut »

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Henry

  • The observer
  • Exploring to the new world of Danmaku
Re: Danmakufu Q&A/Problem Thread v3
« Reply #765 on: May 17, 2010, 05:12:23 AM »
A question about the application of subdirectory.

For example, a SC script file "script\Testing\SCs\spellcard.txt" would like to use a file in "script\Testing\img\back.jpg".

From Naut I learnt that I could use .\\img\back.jpg,

however should the quotation marks be present like:

Code: [Select]
let background = ".\\img\back.jpg";
or it's omitted or any other detail since this is not working  :(
Old/Forgotten member.

Old Patchouli Project was outdated but new one is in progress.

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #766 on: May 17, 2010, 05:20:34 AM »
A question about the application of subdirectory.

For example, a SC script file "script\Testing\SCs\spellcard.txt" would like to use a file in "script\Testing\img\back.jpg".

From Naut I learnt that I could use .\\img\back.jpg,

however should the quotation marks be present like:

Code: [Select]
let background = ".\\img\back.jpg";
or it's omitted or any other detail since this is not working  :(
I believe Danmakufu requires you to use the quotes.
Also, iirc it should be
Code: [Select]
let thisisastring = ".\..\..\img\back.jpg"
* Mewkyuu is probably wrong

EDIT: Hey look
« Last Edit: May 17, 2010, 05:25:00 AM by ⑨dog »

Henry

  • The observer
  • Exploring to the new world of Danmaku
Re: Danmakufu Q&A/Problem Thread v3
« Reply #767 on: May 17, 2010, 05:34:46 AM »
What is the difference between . and .. ?  :ohdear:

Mukyuu?
Old/Forgotten member.

Old Patchouli Project was outdated but new one is in progress.

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 #768 on: May 17, 2010, 05:37:37 AM »
What is the difference between .\ and ..\ ?  :ohdear:

. is same directory, while .. is previous/outer directory
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #769 on: May 17, 2010, 06:08:57 AM »
Mukyuu?
Henry is correct.

Also, Mewkyuu is the name I go by on these forums.

Henry

  • The observer
  • Exploring to the new world of Danmaku
Re: Danmakufu Q&A/Problem Thread v3
« Reply #770 on: May 17, 2010, 06:21:10 AM »
Haven't realized...

Btw, is .\..\ equivalent to ..\ then?

Since I thought "..\test.txt" is equivalent to ".\test.txt"...
« Last Edit: May 17, 2010, 06:27:01 AM by Henry »
Old/Forgotten member.

Old Patchouli Project was outdated but new one is in progress.

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem Thread v3
« Reply #771 on: May 17, 2010, 07:17:53 AM »
.\ is the same thing as using GetCurrentScriptDirectory, while ..\moves up one directory. They are completely different things. If your script is script\test\Spell.txt and you want to access script\test\image.png, you would just use ".\image.png" as the path. If you want to access script\img\image.txt however, you will need to use ".\..\img\image.png".

Edit: using just "..\img\image.png" is completely wrong, as well as not using .\ or GetCurrentScriptDirectory at the beginning. Just don't do it.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread v3
« Reply #772 on: May 17, 2010, 08:01:48 AM »
I tried to do that before... remember how boss/enemy scripts have SetSpeed and SetAngle?
Code: [Select]
task movement{
    SetAngle(GetAngleToPlayer);
    SetSpeed(3);
    while(GetX>GetClipMinX-30 && GetX<GetClipMaxX+30 && GetY>GetClipMinY-30 && GetY<GetClipMaxY+30){yield;}
    SetSpeed(0);
}
Change however you want...
You will never believe it but I totally never knew SetAngle was usable for bosses. I feel so stupid. (  '.')b Thanks. 

Henry

  • The observer
  • Exploring to the new world of Danmaku
Re: Danmakufu Q&A/Problem Thread v3
« Reply #773 on: May 17, 2010, 08:02:25 AM »
I've heard if a file is referenced like this:

**in script\testing\SC\1.txt**
A line: #include_function ".\..\func\draw.txt"

The relative directories in draw.txt will switch to those of 1.txt, right?
Old/Forgotten member.

Old Patchouli Project was outdated but new one is in progress.

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 #774 on: May 17, 2010, 08:48:41 AM »
You will never believe it but I totally never knew SetAngle was usable for bosses. I feel so stupid. (  '.')b Thanks.
:V
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Henry

  • The observer
  • Exploring to the new world of Danmaku
Re: Danmakufu Q&A/Problem Thread v3
« Reply #775 on: May 17, 2010, 09:07:26 AM »
SetAngle is only applicable to bosses, right? :]
It's just like GetX and GetY for boss  ???
Old/Forgotten member.

Old Patchouli Project was outdated but new one is in progress.

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 #776 on: May 17, 2010, 09:32:05 AM »
SetAngle is only applicable to bosses, right? :]
It's just like GetX and GetY for boss  ???

I think SetAngle works for enemies also...

GetX and GetY also works for both bosses and enemies...
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Henry

  • The observer
  • Exploring to the new world of Danmaku
Re: Danmakufu Q&A/Problem Thread v3
« Reply #777 on: May 17, 2010, 10:52:08 AM »
I think SetAngle works for enemies also...

GetX and GetY also works for both bosses and enemies...

sigh...
I barely make scripts for enemies...
thank you for telling me  :D
Old/Forgotten member.

Old Patchouli Project was outdated but new one is in progress.

Kingault

  • Insert witty description here.
Need help with Danmakufu
« Reply #778 on: May 18, 2010, 12:47:48 AM »
Whenever I insert this into my script:

Code: [Select]
if(frame==60){
            CreateShot01(GetX, GetY, 3, GetAngleToPlayer, RED01, 10);
            frame = 0;
        }
        frame++;

This happens:




I have gone through the Error Message Troubleshooting guide, but still no change.

Here is the entire @MainLoop part of the script:
Code: [Select]
@MainLoop {
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 24);
        if(frame==60){
            CreateShot01(GetX, GetY, 3, GetAngleToPlayer, RED01, 10);
            frame = 0;
        }
        frame++;
    }


Please help. Thanks in advance.





Re: Need help with Danmakufu
« Reply #779 on: May 18, 2010, 12:50:24 AM »
These sort of things belong in the Q&A thread that we have in here.


But IOW your problem is likely because you havent defined Frame as a variable