Topic: ※ Danmakufu Q&A/Problem thread 3 ※  (Read 104612 times)

0 Members and 2 Guests are viewing this topic.

Tad Marx Barba

  • Mastermind Behind the Mirror
  • Struggling with my boring life =w=
  • Nickname: Marx
  • Gender: Male
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1770 on: May 09, 2019, 12:46:54 am »
Can you help me? My system has a problem...

When the player reach to a certain nonspell, and a certain percentage of vitality comes down, the boss's steps and difficulty indicator are deleted for no apparent reason...
I forgot delete
Code: [Select]
Obj_Delete(obj) from my Fade In task, my apologies  :V

tsunami3000

  • Touhou is cool i guess
  • Nickname: tsu
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1771 on: May 09, 2019, 06:19:47 pm »
I've been trying to learn how the user-defined item data works by checking how other users' projects. I get the idea due to how similar the code is to custom shots scripts, but I can't figure out what the "out" part is. I know it seems to define an area in the graphics image used for the item (just like "rect"), but I don't know what it is for.

Code: [Select]
ItemData{ id = 2 type = 2 rect = (192, 0, 208, 16) out = ( 194, 14, 205, 25) render = ALPHA }
some day i'll finally beat UFO... some day

Drake

  • *
  • LOOK AT ME
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1772 on: May 09, 2019, 08:49:30 pm »
When a normally-behaving item goes above the top of the screen there's a graphic shown that tells you the item is dropping there; in Touhou games it's a small triangular arrow. The `out` rect is for that graphic.

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

Kinedyme

  • Dream Magic - Duplex Spark!
  • Nickname: Kine
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1773 on: May 10, 2019, 01:05:09 pm »
How do non-piercing lasers for player scripts calculate their lengths to the target?
My only idea so far is to perform something like ray tracing every frame, but is there a more elegant solution?

tsunami3000

  • Touhou is cool i guess
  • Nickname: tsu
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1774 on: May 10, 2019, 01:32:05 pm »
When a normally-behaving item goes above the top of the screen there's a graphic shown that tells you the item is dropping there; in Touhou games it's a small triangular arrow. The `out` rect is for that graphic.

Gosh, it's so obvious now that you explained it. Thanks!
some day i'll finally beat UFO... some day

MakiBlank

  • Neophyte
  • Gender: Tomato
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1775 on: May 16, 2019, 10:17:38 am »
So I'm new to danmakufu and touhou in general and I've been trying to recreate Border of Wave and Particle. I have this current code setup:
Code: [Select]
task BoWaP{
if(ObjEnemy_GetInfo(bossObj, INFO_LIFE) <= 0) {return;}
    let angleT = rand(0, 360);
    let objcount = 0;
    loop{
        loop(5){
            let obj = CreateShotA1(ObjMove_GetX(bossObj), ObjMove_GetY(bossObj), 3, angleT, 52, 5);
            angleT += 360/5;
        }
        angleT += sin(objcount) * cos(objcount) * 12;
        objcount++;
        yield;
    }
}
When I run the code through the game it appears to stack the different patterns that the bullets are producing. Is there anything I have done wrong in the code that causes this?

Gregory

  • I draw stuffs
  • Nickname: Tanky !
  • Gender: Male
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1776 on: May 17, 2019, 05:56:17 am »
So I'm new to danmakufu and touhou in general and I've been trying to recreate Border of Wave and Particle. I have this current code setup:
Code: [Select]
task BoWaP{
if(ObjEnemy_GetInfo(bossObj, INFO_LIFE) <= 0) {return;}
    let angleT = rand(0, 360);
    let objcount = 0;
    loop{
        loop(5){
            let obj = CreateShotA1(ObjMove_GetX(bossObj), ObjMove_GetY(bossObj), 3, angleT, 52, 5);
            angleT += 360/5;
        }
        angleT += sin(objcount) * cos(objcount) * 12;
        objcount++;
        yield;
    }
}
When I run the code through the game it appears to stack the different patterns that the bullets are producing. Is there anything I have done wrong in the code that causes this?

Did you loop the BoWaP task again ? Because it worked fine on me
https://imgur.com/a/V5s2X3l

MakiBlank

  • Neophyte
  • Gender: Tomato
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1777 on: May 17, 2019, 06:45:39 am »
I dont think so, but here's my mainloop if it helps with the problem
Code: [Select]
@MainLoop{
    ObjEnemy_SetIntersectionCircleToShot(bossObj, ObjMove_GetX(bossObj), ObjMove_GetY(bossObj), 32);
    ObjEnemy_SetIntersectionCircleToPlayer(bossObj, ObjMove_GetX(bossObj), ObjMove_GetY(bossObj), 24);
if (count == 0) {
ObjMove_SetDestAtFrame(bossObj, GetCenterX(), 112, 60);
}
if(count % 30 == 0 && count >= 0){
BoWaP;
}
count++;
    yield;
}

Drake

  • *
  • LOOK AT ME
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1778 on: May 17, 2019, 06:47:41 am »
This is starting an instance of the BoWaP task every 30 frames, so yes, it's going to keep overlapping the whole thing over and over.

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

MakiBlank

  • Neophyte
  • Gender: Tomato
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1779 on: May 17, 2019, 07:11:49 am »
I just realized this. Fixed now!
I'm still pretty new to coding in general, so I sometimes forget what certain things do :P

BananaCupcakey

  • ^_^
  • Nickname: Banana
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1780 on: May 17, 2019, 11:47:08 am »
I was making the bullets to spawn bullets, it works, but the bullets also appeared on the top left of the screen.
How can I overcome this situation ?
https://pastebin.com/R82cpE05
Just keep it neutral :3

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
  • Gender: Male
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1781 on: May 17, 2019, 03:55:47 pm »
I was making the bullets to spawn bullets, it works, but the bullets also appeared on the top left of the screen.
How can I overcome this situation ?
https://pastebin.com/R82cpE05

I haven't taken a look at your code yet but I'm 100% sure it's because you're spawning bullets without checking if the parent bullet still exists.

Only spawn bullets from the parent if the parent has not been deleted.

More information: https://sparen.github.io/ph3tutorials/ph3u2l16.html

JDude :3

  • tururu
  • boy with code
  • Nickname: johnbr
  • Gender: Almost a Man
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1782 on: May 18, 2019, 02:20:14 am »
I was making the bullets to spawn bullets, it works, but the bullets also appeared on the top left of the screen.
How can I overcome this situation ?
https://pastebin.com/R82cpE05

Line 118:
let b = CreateShotA1(ObjMove_GetX(obj), ObjMove_GetY(obj), 0, obj, 318 , 7);
I suppose that instead of obj it's ObjMove_GetAngle(obj)

also Sparen is correct, you should make sure that it only shoots while the obj isn't deleted, like this code
Code: [Select]
while(!Obj_IsDeleted(obj)){
      //code here;
}
"dnh is hard" - said no one
"dnh is bullshit" - everyone making a creative pattern

Tad Marx Barba

  • Mastermind Behind the Mirror
  • Struggling with my boring life =w=
  • Nickname: Marx
  • Gender: Male
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1783 on: May 18, 2019, 11:40:50 pm »
Guys, Hello there.
How do I randomize 21 shoot tasks?

I've these bunch of code for my 21 shooting task, but I've no idea how to do that...  ???
Link to my code: Pastebin

Please, help me  :3

Drake

  • *
  • LOOK AT ME
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1784 on: May 19, 2019, 03:01:07 am »
You would generate a random number and then pick based on that using a switch or a bunch of if-elses.
Code: [Select]
function rand_int(min, max){
  return floor(rand(min, max));
}

alternative(rand_int(0, 22))
case(0){
  RING_1();
  wait(32 * 7 + 60);
}case(1){
  RING_2();
  wait(32 * 13);
}case(2){
// ...
}case(21){
  Octo_Fist(fr);
  wait(fr + 1340);
}

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

Tad Marx Barba

  • Mastermind Behind the Mirror
  • Struggling with my boring life =w=
  • Nickname: Marx
  • Gender: Male
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1785 on: May 19, 2019, 03:48:54 am »
You would generate a random number and then pick based on that using a switch or a bunch of if-elses.
Thanks Drake! It works!  :3 :D

kodaikyatto

  • Neophyte
  • Nickname: Kat
  • Gender: Female
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1786 on: May 25, 2019, 09:03:39 pm »
Hi! I doubt I'll get a response, but I thought it was worth a shot
I'm new to Danmakufu stuff, and I wanna ask a couple questions:
How do I make it so the spellcard activates when the health is down to a certain point, like in Touhou?
How do I make more lives for the boss?
How do I create dialogue?
Sorry for 3 questions, but I'm just a baby to this stuff and I thought this would be the correct place to ask.

Tad Marx Barba

  • Mastermind Behind the Mirror
  • Struggling with my boring life =w=
  • Nickname: Marx
  • Gender: Male
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1787 on: May 26, 2019, 05:31:37 am »
How to do a difficulty selector for plurals? Can you explain me? I want to do that with pictures instead of using only text ::)

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
  • Staff
  • LOOK AT ME
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1788 on: May 26, 2019, 08:59:20 am »
Hi! I doubt I'll get a response, but I thought it was worth a shot
I'm new to Danmakufu stuff, and I wanna ask a couple questions:
How do I make it so the spellcard activates when the health is down to a certain point, like in Touhou?
How do I make more lives for the boss?
How do I create dialogue?
Sorry for 3 questions, but I'm just a baby to this stuff and I thought this would be the correct place to ask.
Almost all your questions are covered in tutorials. Detailed written tutorials: https://sparen.github.io/ph3tutorials/ph3tutorials.html  and video tutorials: https://www.shrinemaiden.org/forum/index.php?topic=2852.0

Highly suggesting to start with those, especially since you said you're a baby to this.



How to do a difficulty selector for plurals? Can you explain me? I want to do that with pictures instead of using only text ::)
Depends on what your ultimate goal is. If it is just difficulty selection for plural (or single boss fight), then use:
- effect objects to spawn pictures
- use the virtual keys to move between the options
- set the difficulty based on the selection using commondata or your desired way

You can hold off your boss fight with a dummy attack/spell and launch the attacks once the difficulty has been set.

Usually difficulty selection menus are used in combination with full games. Which uses package scripts. Not sure how experienced you are with creating menu systems.

Drake

  • *
  • LOOK AT ME
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1789 on: May 27, 2019, 05:02:01 am »
You actually don't even need a dummy attack, just don't start (register) the boss scene or whatever else until the difficulty is selected.

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

BananaCupcakey

  • ^_^
  • Nickname: Banana
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1790 on: May 27, 2019, 02:35:52 pm »
Thanks for the suggestions, it's working well so far.
And yes I eat codes sometimes mostly for testing but I can't get this working correctly

task BExplode(obj){
    wait(50);
   let angle = rand(0,360);
    loop(15){
   if(Obj_IsDeleted(obj)){return;}
       ascent(i in -1..4){
        ascent(j in 0..3){
            let objB = CreateShotA1(ObjMove_GetX(obj), ObjMove_GetY(obj), 3 - j/6, angle + i*3, 320, 5);
         Gravity(objB);
        }
    }
      ObjShot_SetDeleteFrame(obj, 5);
      angle += 360/15;
   }
}

task Gravity(objB){
    wait(50);
   Choosing(objB);
}

task Choosing(objB){
    alternative(rand_int(0, 1))
    case(0){
    ObjMove_SetAngularVelocity(objB,-0.5);
    }
   case(1){
    ObjMove_SetAngularVelocity(objB,0.5);
    }
}

But the rings never set the velocity to 0.5, any ideas ?
« Last Edit: May 27, 2019, 02:39:13 pm by BananaCupcakey »
Just keep it neutral :3

Drake

  • *
  • LOOK AT ME
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1791 on: May 28, 2019, 02:09:21 am »
If you're using the rand_int function I wrote above, the maximum is exclusive. If you want to pick either 0 or 1 you need rand_int(0, 2).

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

GenoCraft

  • Craftsman of absolute unpredictability
  • Boundary of productive and lazy
  • Nickname: ♥♪!?
  • Gender: Male
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1792 on: June 15, 2019, 09:04:53 pm »
Is it normal for ObjMove_SetPosition to not work on the player object? If so, is there an alternative that works?

Drake

  • *
  • LOOK AT ME
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1793 on: June 16, 2019, 12:25:17 am »
It should work. If it doesn't there's something else going on.

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

Kinedyme

  • Dream Magic - Duplex Spark!
  • Nickname: Kine
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1794 on: June 24, 2019, 10:12:35 pm »
Is there a way to get the number of tasks currently running within a script?

I know that a value is displayed in the log window, but it would be great if I was able to capture that value at a specified point in my code.

Thanks in advance

PyuDi

  • daily touhou~
  • danmakufu!
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1795 on: July 06, 2019, 07:54:47 am »
Code: [Select]
if (frame%60==0)
{
   let obj = ShotA(1); //ShotA is any createshot
}
ObjMove_SetX(obj, 0); //error: obj is not defined

And this throws an error. How can I use an variable out of its {}?

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
  • Staff
  • LOOK AT ME
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1796 on: July 06, 2019, 08:21:51 am »
Code: [Select]
if (frame%60==0)
{
   let obj = ShotA(1); //ShotA is any createshot
}
ObjMove_SetX(obj, 0); //error: obj is not defined

And this throws an error. How can I use an variable out of its {}?
Please post code along with the error because we don't know how you exactly programmed this.

I assume this is inside the @MainLoop? Then you should define the variable globally.

PyuDi

  • daily touhou~
  • danmakufu!
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1797 on: July 06, 2019, 08:38:56 am »
code: https://pastebin.com/Yx1NdbdJ (look for  if (frame%30==0) )

-> How can I use an variable out of its declared {}?

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
  • Gender: Male
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1798 on: July 06, 2019, 01:45:16 pm »
code: https://pastebin.com/Yx1NdbdJ (look for  if (frame%30==0) )

-> How can I use an variable out of its declared {}?

Your code is as follows:
Code: [Select]
    loop(8)
            {
                let obj = CreateShotA1(rand(0,fx), 0, rand(1,3), 90+rand(-5,5), DS_BALL_BS_GREEN, 20);
            }
            ObjMove_SetAngle(obj, -90);  // obj is not defined
Your aim is to create eight objects and then set their angle immediately. Therefore, you can do the following:
Code: [Select]
    loop(8)
            {
                let obj = CreateShotA1(rand(0,fx), 0, rand(1,3), 90+rand(-5,5), DS_BALL_BS_GREEN, 20);
                ObjMove_SetAngle(obj, -90);  // obj is not defined
            }
           

Understanding scoping rules is important, but understanding why they exist is also important. I'd take a look at your old code and think about why what you originally wrote would cause problems IF the variables could be accessed from outside of the block. For example, how many of the objects would actually have their speed set?
 

SMF 2.0.15 | SMF © 2017, Simple Machines
Theme based on ModernDark64 design by BlocWeb
Page created in 0.052 seconds with 41 queries.