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

Trung0246

  • Gaming, coding, drawing, composing, ... for fun
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #720 on: July 14, 2017, 02:31:18 AM »
How to disable the number show up when player collect item ?
My workbench & codedump
Gallery & album (WIP)

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #721 on: July 14, 2017, 07:30:10 AM »
How do i aim a straight laser to a certain object?

Jimmy

  • Shameless spender
  • gaining big pounds
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #722 on: July 14, 2017, 10:01:49 AM »
How to disable the number show up when player collect item ?
Use ObjItem_SetRenderScoreEnable(item,bool) and put false as the second parameter.
« Last Edit: July 14, 2017, 11:38:29 PM by Jimmy »
Normal 1cc: EoSD, PCB, IN, PoFV, MoF, UFO, TD, DDC, LoLK Legacy, HSiFS, WBaWC
Hard 1cc: IN, DDC, HSiFS
Extra clears: MoF, DDC, HSiFS, WBaWC

Goals: Going Extra Hard!

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #723 on: July 15, 2017, 06:42:52 AM »
How do i aim a straight laser to a certain object?
To aim it at a desired object, you need to calculate the angle from the straight laser source to the object using atan2.
Code: [Select]
let laserAngle = atan2(y1-y2,x1-x2);
xy1 for the laser position and xy2 for the object position.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #724 on: July 17, 2017, 01:55:23 PM »
So I am wondering.... that how to make bullets act/shoot like Hina's last spell (Pain Flow) and bullets curves like gengetsu's last attack ?
*its not gengetsu rape time
Just keep it neutral :3

Jimmy

  • Shameless spender
  • gaining big pounds
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #725 on: July 17, 2017, 04:17:48 PM »
So I am wondering.... that how to make bullets act/shoot like Hina's last spell (Pain Flow) and bullets curves like gengetsu's last attack ?
*its not gengetsu rape time

Here.
Normal 1cc: EoSD, PCB, IN, PoFV, MoF, UFO, TD, DDC, LoLK Legacy, HSiFS, WBaWC
Hard 1cc: IN, DDC, HSiFS
Extra clears: MoF, DDC, HSiFS, WBaWC

Goals: Going Extra Hard!

R. P. Genocraft

  • Craftsman of absolute unpredictability
  • Boundary of productive and lazy
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #726 on: July 17, 2017, 05:18:09 PM »
I want to make a spell card background that works like Sagume's, how can I create that effect?

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #727 on: July 18, 2017, 02:20:08 AM »
What part of it? The blending or the motion? If it's the latter, it works the same as Junko's, for which I have a writeup here:
https://www.shrinemaiden.org/forum/index.php/topic,19249.msg1257975.html#msg1257975

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #728 on: July 18, 2017, 12:34:56 PM »
Soon after i edited, it said angleToPlayer is not defined, I'm not so sure about where to make it defined, any ideas ? https://pastebin.com/qNb1FTts
*if you don't mind, send the full script and i'l try to observe :3
« Last Edit: July 18, 2017, 12:39:18 PM by BananaCupcakey »
Just keep it neutral :3

CrestedPeak9

  • Fangame Advocate
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #729 on: July 18, 2017, 12:36:44 PM »
the function is GetAngleToPlayer(objBoss)
the script here uses a custom function which I assume does the same thing
just change it and you should be good
Lunatic 1cc: EoSD, PCB, IN, MoF, TD, DDC, LoLK, HSiFS, WBaWC

Jimmy

  • Shameless spender
  • gaining big pounds
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #730 on: July 18, 2017, 12:50:23 PM »
Soon after i edited, it said angleToPlayer is not defined, I'm not so sure about where to make it defined, any ideas ? https://pastebin.com/qNb1FTts
*if you don't mind, send the full script and i'l try to observe :3
Yep, angleToPlayer is a custom function that I took from Helepolis' tutorials quite a time ago and pretty much kept it unaltered. I wrote it in one of the #include files of the script I took the task from.

PS: I'm currently not home and thus on my mobile, will edit this post and provide pastes of the relevant files as soon as I've returned.


EDIT: Here's the script where that task is from (it's called Shot1 there) and my library of miscellaneous functions that contains angleToPlayer.
« Last Edit: July 18, 2017, 04:04:21 PM by Jimmy »
Normal 1cc: EoSD, PCB, IN, PoFV, MoF, UFO, TD, DDC, LoLK Legacy, HSiFS, WBaWC
Hard 1cc: IN, DDC, HSiFS
Extra clears: MoF, DDC, HSiFS, WBaWC

Goals: Going Extra Hard!

R. P. Genocraft

  • Craftsman of absolute unpredictability
  • Boundary of productive and lazy
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #731 on: July 18, 2017, 01:28:06 PM »
What part of it? The blending or the motion? If it's the latter, it works the same as Junko's, for which I have a writeup here:
https://www.shrinemaiden.org/forum/index.php/topic,19249.msg1257975.html#msg1257975
It's the latter, thank you!

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #732 on: July 21, 2017, 09:55:06 PM »
    Hey guys! I am new in the scripting world, just began this week and I have some problems with a pattern :(. I fact, I don't understand why it does something like that :ohdear:, I need someone to try it and tell me why it does something like that, and how you would fix it :blush::

https://drive.google.com/drive/folders/0Bwf7GLCc6Z9JbWh3NjF3YTlfdW8?usp=sharing

    As you can see, the problem resides in the delay laser. I want my big stars to explode only when hitting the delay laser, but when the laser hits the bottom of the screen and teleport to the top, everything explode, I really don't get it ???.
    I think it's because of the fact that the laser doesn't actually warp to the top, but goes really fast to the top while hitting the stars, which cause the stars to explode, but why? I've set the laser to teleport to the top, it shouldn't do something like that... :ohdear:

    Actually, I was able to fix it, but in a weird way that I don't understand, so I still need someone to tell me how he/she would do :D.
« Last Edit: July 23, 2017, 10:56:19 AM by Axyo »

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #733 on: July 22, 2017, 07:14:21 AM »
It's quiet weird while the bullets shoot from the ceiling,haha, what have i done ? https://pastebin.com/2PntFf07
Just keep it neutral :3

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #734 on: July 22, 2017, 08:43:16 AM »
You fire around BossX and BossY. You set these both to be 10 at the start of the file, but never change them. You want to use ObjMove_GetX(objBoss) and ObjMove_GetY(objBoss).

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #735 on: July 22, 2017, 12:24:29 PM »
When i change intersection circle of a shot via ObjShot_SetIntersectionCircleA1 it doesnt intersect with any other objects, making IsIntersected_Obj_Obj impossible to use, while if i dont change the intersection circle, it works fine. Is there any other way to register the intersection of 2 objects except for IsIntersected_Obj_Obj?

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #736 on: July 22, 2017, 02:32:37 PM »
And, .... how to replicate Mishaguji-sama ? :3
Just keep it neutral :3

CrestedPeak9

  • Fangame Advocate
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #737 on: July 22, 2017, 03:04:49 PM »
And, .... how to replicate Mishaguji-sama ? :3

Create two  bullet rings and set opposite angular velocities.

When i change intersection circle of a shot via ObjShot_SetIntersectionCircleA1 it doesnt intersect with any other objects, making IsIntersected_Obj_Obj impossible to use, while if i dont change the intersection circle, it works fine. Is there any other way to register the intersection of 2 objects except for IsIntersected_Obj_Obj?

ObjShot_SetIntersectionCircleA1
Parameters:
 1) object ID (real)
 2) hitbox radius (real)
Creates a hitbox of specified radius for collision detection of the shot object. In order to maintain the hitbox, it must be set every frame. There can be multiple hitboxes set for one shot object.

In other words, set the hitbox every frame and it should work as intended.
Lunatic 1cc: EoSD, PCB, IN, MoF, TD, DDC, LoLK, HSiFS, WBaWC

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #738 on: July 22, 2017, 03:16:52 PM »
ObjShot_SetIntersectionCircleA1
Parameters:
 1) object ID (real)
 2) hitbox radius (real)
Creates a hitbox of specified radius for collision detection of the shot object. In order to maintain the hitbox, it must be set every frame. There can be multiple hitboxes set for one shot object.

In other words, set the hitbox every frame and it should work as intended.

Yes, i already did make the task to set it every frame, but that still doesnt work, the hitbox changes only for player intersection, and other shots just dont react to that object

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #739 on: July 22, 2017, 03:34:09 PM »
 while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){
        let angleT = GetAngleToPlayer(objBoss);
        loop(13){
            ascent(i in 0..1){
            CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2.5 - i/3, angleT, 406, 5);
            }
         ObjMove_SetAngularVelocity(obj, -10) ;
            angleT += 360/12;
        }
        wait(50);
    }

any ideas ? it doesn't spin like it...  ???
Just keep it neutral :3

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #740 on: July 22, 2017, 03:54:05 PM »
while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){
        let angleT = GetAngleToPlayer(objBoss);
        loop(13){
            ascent(i in 0..1){
            CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2.5 - i/3, angleT, 406, 5);
            }
         ObjMove_SetAngularVelocity(obj, -10) ;
            angleT += 360/12;
        }
        wait(50);
    }

any ideas ? it doesn't spin like it...  ???

You have to declare your "obj" before assigning your function to it, otherwise it won't do anything. And, your angular velocity is way too high, -10 will make your bullets spin so fast that they won't go anywhere, try something like -0.2. If I was you, I would do:

 while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){
        let angleT = GetAngleToPlayer(objBoss);
        loop(13){
            ascent(i in 0..1){
                 let obj = CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2.5 - i/3, angleT, 406, 5);
                 let obj2 = CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2.5 - i/3, angleT, 406, 5);
       }
         ObjMove_SetAngularVelocity(obj, -0.2) ;
         ObjMove_SetAngularVelocity(obj2, 0.2);
            angleT += 360/12;
        }
        wait(50);
    }

    I am sure of nothing though. I don't get why you used an "ascent", if you wanna slowdown the speed of your bullets, you can simply use "CreateShotA2".
« Last Edit: July 22, 2017, 04:12:57 PM by Axyo »

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #741 on: July 22, 2017, 04:18:23 PM »
Just keep it neutral :3

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #742 on: July 22, 2017, 04:33:42 PM »
https://pastebin.com/eLFp9uZ0
can obj be 0 ?

Well, if your "obj" is equal to 0, it won't do anything. Think it this way:
your function "ObjMove_SetAngularVelocity" is assigned to who? No one, but to a random "0" that isn't an object or something. Between your parentheses, you have 2 parameters: The first one is the object ID which you wanna assign to your function, the other one is the angular velocity.
     The object ID is your bullet, right? You want say that you want your bullet to have this angular velocity, not a random 0 to have angular velocity, because it means nothing, 0 isn't an object or something. But how to do it? It's simple, you want to declare your bullet as the object to have this angular velocity, to do so you simply write what I wrote:

let obj = CreateShotA1 etc....

What it is going to do, is declare a new local variable, which is obj (you don't need the other one) and will tell to the script that your obj is assigned to your shot. Once you've written this, you can affect your shot by putting your new variable inside your function, I don't know if I was clear enough, my english is quite bad, sorry for this.
« Last Edit: July 22, 2017, 04:36:15 PM by Axyo »

R. P. Genocraft

  • Craftsman of absolute unpredictability
  • Boundary of productive and lazy
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #743 on: July 22, 2017, 09:00:52 PM »
How can I get and object's alpha? I can't find a function that does that.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #744 on: July 22, 2017, 09:32:59 PM »
How can I get and object's alpha? I can't find a function that does that.
Unfortunately, there is no function for that. If you want to track an objects alpha, you can try to use Get/Set Values and pass the alpha value through. That way you can some sort of track an object's alpha.

Example:
Code: [Select]
function someObject() {
let obj = ...
let alpha = 200;

Obj_SetValue(obj, "alphaValue", alpha);

return obj;
}

task testRetrieveAlpha() {
let testObject = someObject();

let retrievedValue = Obj_GetValue(testObject, "alphaValue");

<generic text object prints 'retrievedValue'>
}
If the text object is produced, it should report 200. Above can be turned into more "object orientated" methods/functions, but I tried to keep it simple here.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #745 on: July 23, 2017, 01:51:37 AM »
After i let "let obj = CreateShotA1;", then it says that it's not the correct parameters , any ideas ? .-.
Just keep it neutral :3

CrestedPeak9

  • Fangame Advocate
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #746 on: July 23, 2017, 02:23:40 AM »
After i let "let obj = CreateShotA1;", then it says that it's not the correct parameters , any ideas ? .-.

facepalm

Tell me, how many parameters are needed in creating a shot using CreateShotA1?
When you assign to obj and use the CreateShotA1 function, you are creating a bullet and assigning the bullet ID to obj.
So create a shot as normal, and obj will be the ID of the shot.
Lunatic 1cc: EoSD, PCB, IN, MoF, TD, DDC, LoLK, HSiFS, WBaWC

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #747 on: July 23, 2017, 03:44:07 AM »
Banana, I would really recommend to go back through tutorials until your basic understanding of scripting improves. Your past few problems have essentially been you typing things in without understanding what it's actually doing. You can't just keep typing whatever and then asking for help when it inevitably doesn't work.

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #748 on: July 23, 2017, 11:08:38 AM »
    Hey guys! I am new in the scripting world, just began this week and I have some problems with a pattern :(. I fact, I don't understand why it does something like that :ohdear:, I need someone to try it and tell me why it does something like that, and how you would fix it :blush::

https://drive.google.com/drive/folders/0Bwf7GLCc6Z9JbWh3NjF3YTlfdW8?usp=sharing

    As you can see, the problem resides in the delay laser. I want my big stars to explode only when hitting the delay laser, but when the laser hits the bottom of the screen and teleport to the top, everything explode, I really don't get it ???.
    I think it's because of the fact that the laser doesn't actually warp to the top, but goes really fast to the top while hitting the stars, which cause the stars to explode, but why? I've set the laser to teleport to the top, it shouldn't do something like that... :ohdear:

    Actually, I was able to fix it, but in a weird way that I don't understand, so I still need someone to tell me how he/she would do :D.

   Well, I guess no one's going to help me like that so let's be more specific: When I fix this problem, I have some random stars popping out from the top left corner of my screen. I tried all sort of things like cancel the function that make my stars explode when the laser teleport to the top, or deleting all explosion outside from the screen thinking that the small stars were stacking outside from the screen and reappearing at the top left corner, and trying out other things. The conclusion to this would be that all the stars that explode from hitting the delay laser stack for reappearing later, but I didn't ask for this, I don't get it, can someone help me?
    This is a recurrent problem since in my other scripts, I have the same problem with random stuff popping out from the top left corner of my screen. I thought it was because danmakufu could't interpret functions outside from the screen so to fix that it would make them happen at X=0 and Y=0 but now I am lost.

Infy♫

  • Demonic★Moe
  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #749 on: July 23, 2017, 07:51:36 PM »
I'm wondering if there's a ph3 thread for useful code snippets, and/or a library of extra functions to make life easier?

I am currently collecting my own and others' old 0.12m functions and porting them to ph3 to make a wholesome library. If someone did this already, it would be rather useless!
« Last Edit: May 15, 2019, 05:46:38 PM by Infy♫ »