Author Topic: ※ Dnh Q&A/Problem ※ for Danmakufu ph3 (locked)  (Read 270079 times)

fondue

  • excuse me
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #150 on: December 23, 2011, 05:59:09 PM »
That would be the CreateShotB series.
CreateShotB1(x, y, xspeed, yspeed, graphic, delay);
CreateShotB2(x, y, xspeed, yspeed, xaccel, yaccel, xmaxspd, ymaxspd, graphic, delay);
CreateShotOB1(obj, xspeed, yspeed, graphic, delay);

Aren't there any more createshotB functions? the y-speed and the x-speed parameters for them dont work, even though Dnh recognises them. Also, i dont really understand the last function you put down...

KrackoCloud

  • I don't mean to be greedy...
  • ... but white rice is my favorite food.
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #151 on: December 23, 2011, 08:26:36 PM »
The Dnh Wiki has no information on that...
nor with some of the other stuff.
It's there, it just doesn't have a description for it right now.
http://dmf.shrinemaiden.org/wiki/index.php?title=Shot_Object_Functions#ObjStLaser_SetAngle
Check towards the bottom.

Even when I try to create object bullets (By defining all the properties) I still don't manage to change their properties when a certain condition is met (in this case, home on the player when it hits a wall):
(EDIT: Minor spelling mistake corrected)
Code: [Select]
stuff
I don't see what's wrong. I tried it out and it works fine.

Aren't there any more createshotB functions? the y-speed and the x-speed parameters for them dont work, even though Dnh recognises them. Also, i dont really understand the last function you put down...
What are you filling in for the xspeed and yspeed?
If you want the bullet to move at, say, a 35-degree angle, I think the speeds should be
xspeed= speed*cos(35)
yspeed= speed*sin(35)

Yukari-Chan

  • Excuse me while I prepare /your/ demise. <3 TSO
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #152 on: December 23, 2011, 08:26:45 PM »
I don't get ph3 beta. What are the functions to script? And how to task?
" Borders are Borders. They were meant to be manipulated and mistreated. "

KrackoCloud

  • I don't mean to be greedy...
  • ... but white rice is my favorite food.
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #153 on: December 24, 2011, 12:03:55 AM »
Anyone have an example for a scrolling, tiled background? Or even a static background, for that matter.

Also, how do I display quotation marks in text?

Schezo

  • en-counse
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #154 on: December 24, 2011, 03:26:00 AM »
Cloud:
This is what I used to make my background during the spellcards in Schezo4U
Code: [Select]
task DrawBGspell(drawbg){
let bgs = 0;

if(drawbg){
ObjPrim_SetTexture(objBG1, BG1);
Obj_SetRenderPriorityI(objBG1,25);
ObjPrim_SetTexture(objBG2, BG2);
Obj_SetRenderPriorityI(objBG2,26);
}

while(!Obj_IsDeleted(objEnemy))
{

if(drawbg){
        ObjSprite2D_SetSourceRect(objBG1,0,bgs,700,500+bgs);
ObjSprite2D_SetDestRect(objBG1,0,0,700,512);
ObjSprite2D_SetSourceRect(objBG2,-bgs/3,bgs/2,700-bgs/3,500+bgs/2);
ObjSprite2D_SetDestRect(objBG2,0,0,512,512);
bgs++;
}
yield;
}
}
With objBG1 and 2 being predefined call the task in initialize and it should give a decent background.
objBG1 was a 480x640
objBG2 was a 256x256

I don't know about the quotation marks though.

NonexistentFlower

  • 悪ノ花(君)
  • Oh... And... I'm a boy.
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #155 on: December 24, 2011, 05:27:23 AM »
I don't see what's wrong. I tried it out and it works fine.
Well, then there must be something wrong with my machine.
......I said nothing.

Rosen

  • Cry moar desu!
  • Hyu~ dorodorodoro!
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #156 on: December 24, 2011, 05:47:24 AM »
Well, then there must be something wrong with my machine.
Try using ObjMove_AddPattern instead.

NonexistentFlower

  • 悪ノ花(君)
  • Oh... And... I'm a boy.
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #157 on: December 24, 2011, 06:02:14 AM »
Try using ObjMove_AddPattern instead.
Ah, but I want to make it change directions once a certain condition is met; barring more math, how could I do it with that?
......I said nothing.

Rosen

  • Cry moar desu!
  • Hyu~ dorodorodoro!
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #158 on: December 24, 2011, 06:13:08 AM »
Ah, but I want to make it change directions once a certain condition is met; barring more math, how could I do it with that?
Your conditions are right, and it also works fine when i run your task.

KrackoCloud

  • I don't mean to be greedy...
  • ... but white rice is my favorite food.
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #159 on: December 24, 2011, 06:15:53 AM »
At this rate it might be better if you could pastebin the whole script for us.

Drake

  • *
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #160 on: December 24, 2011, 07:34:59 AM »
Quotation marks can probably maybe be used with an escape character like "blabla"blablabla" or something.

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

KrackoCloud

  • I don't mean to be greedy...
  • ... but white rice is my favorite food.
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #161 on: December 24, 2011, 07:47:02 PM »
It works! Thanks.

Miplouf Saigyouki

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #162 on: December 26, 2011, 12:04:28 PM »
I'll repeat my question...

Can anyone (that uses Ph3) can tell me how to make a shot task?
Because I want to know how to do cool things!:3

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #163 on: December 26, 2011, 02:17:06 PM »
Code: [Select]
task Taskname(your parameters){

//define whatever you need (often, a time counter) and put any code you need here

let obj=ObjShot_Create(OBJ_SHOT);
 ObjMove_SetPosition(obj,some x, some y);
ObjShot_SetGraphic(obj, bullet id);
ObjMove_SetAngle(obj, some angle);
ObjMove_SetSpeed(obj, some speed);
 //etc. (delay, fade, bomb resist ...)
ObjShot_Regist(obj);

while(GetLife>0 && !Obj_IsDeleted(obj)){ //you'll usually want the bullet to disappear when the current nonspell/spell ends, and the task to end when the bullet is deleted (eg by a bomb)
yield; //don't forget that little one : it pauses this task in order to let the other tasks advance too
//put what the bullet does every frame here.
}
Obj_Delete(obj); // if you got out of the loop because life was under 0, delete the bullet.
//put other aftereffects here if any.
}

Try to understand the following task, as an example.

Code: [Select]
task EDivShot(x,y,a,g,d,k){

let obj=ObjShot_Create(OBJ_SHOT);
ObjMove_SetPosition(obj,x,y);
ObjShot_SetGraphic(obj,g);
ObjMove_SetAngle(obj,a);
ObjMove_SetSpeed(obj,0);
ObjShot_Regist(obj);

let t=0;

while(GetLife>0 && !Obj_IsDeleted(obj)){

t++;
yield;

if(t==d){CreateShotA2(ObjMove_GetX(obj),ObjMove_GetY(obj),0,a-60,0.05,1.5,g+1,0);
CreateShotA2(ObjMove_GetX(obj),ObjMove_GetY(obj),0,a+60,0.05,1.5,g+1,0);}

if(t==d+60){ObjMove_SetAngle(obj,a+k);}
if(t>=d+60){ObjMove_SetSpeed(obj,(t-(d+60))*0.01);}

}
Obj_Delete(obj);
}
« Last Edit: December 26, 2011, 02:25:33 PM by Ginko »

Miplouf Saigyouki

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #164 on: December 26, 2011, 03:08:15 PM »
I have:

http://pastebin.com/9D7JzeZ6

And even with your task,there is still a problem!(thanks for explaining to me btw)
Is there something missing?^^"
« Last Edit: December 27, 2011, 12:14:11 PM by Helepolis »

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #165 on: December 26, 2011, 04:26:58 PM »
Is it possible to make an enemy shot from a player script ?

gtbot

  • Master of ScreenSplit
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #166 on: December 26, 2011, 06:46:59 PM »
And even with your task,there is still a problem!(thanks for explaining to me btw)
Is there something missing?^^"

The task is never called, so it never runs.
You also have an extra } right after the yield in @MainLoop.

Is it possible to make an enemy shot from a player script ?

I've tried to do so in the past with no success. I don't think it's possible.

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #167 on: December 26, 2011, 07:35:34 PM »
I've a problem with applocal herrrrr.
I put apploc.msi in my system32 folder and I ran cdm, and I wrote "apploc.msi" (without "" of course). But it's finally a fail ! >.< help me please I want to have ph3 on my computer >.<

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #168 on: December 26, 2011, 08:48:51 PM »
And, err, how should I do if i want to kill the player in the player script ?

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #169 on: December 26, 2011, 09:54:51 PM »
And, err, how should I do if i want to kill the player in the player script ?
You could probably use SetShotIntersectionCircle for one frame with a radius large enough to cover the entire screen. Haven't tested if it works in player scripts though.

Here's a link to the wiki documentation: http://dmf.shrinemaiden.org/wiki/index.php?title=Shot_Functions#SetShotIntersectionCircle

Drake

  • *
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #170 on: December 26, 2011, 09:57:11 PM »
I have:
[code]
And even with your task,there is still a problem!(thanks for explaining to me btw)
Is there something missing?^^"
Mismatching brackets. I would tell you to go figure out where but gtbot decided to be overly helpful instead lol

I've a problem with applocal herrrrr.
I put apploc.msi in my system32 folder and I ran cdm, and I wrote "apploc.msi" (without "" of course). But it's finally a fail ! >.< help me please I want to have ph3 on my computer >.<
Did you run the command line in administrator mode? Gotta right-click and select it.

And, err, how should I do if i want to kill the player in the player script ?
It isn't implemented yet, but you could always recreate the death sequence by forbidding shot and bomb, disappearing, setting lives down, waiting, repositioning, etc. Why would you want to do that anyways?

You could probably use SetShotIntersectionCircle for one frame with a radius large enough to cover the entire screen.
...They just went over that enemy shots don't work in player scripts. That was the first idea.

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

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #171 on: December 26, 2011, 11:17:51 PM »
Quote
It isn't implemented yet, but you could always recreate the death sequence by forbidding shot and bomb, disappearing, setting lives down, waiting, repositioning, etc. Why would you want to do that anyways?

I wanted to make a "Perfect Freeze" (of pofv, not gfw) bomb. For that I needed to create new bullets in the player script (just changing speed and angle of the bullets wouldn't work well). But in ph3, all bullets created in the player scripts are considered as shot by the player and therefore do not kill the player. And you can't start enemy scripts from the player script. So I just decided that freezing the bullet would transform its shape into a unique shape, and i'd just have to manually check for collisions with the player. Except that even if I detected the collision, I had no mean to kill the player.

Since this is for a peculiar game script, i just make the game script spawn and delete an invisible bullet when notified of a certain Event, and I make the player script notify other scripts about that Event when a collision is detected.

But this is not a solution for just any script, of course.

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #172 on: December 27, 2011, 03:04:57 PM »
Sorry but I found the solution to run danmakufu on my computer ^^'

But I have a new problem hurrrrrr, I want to create an explosion when my boss is defeated but nothing happen -_-' just a picture...

Code: [Select]


task Explode01(x,y,scalex,scaley,alpha)
{
                let frame = 1;
                let int = false;
let obj = ObjPrim_Create(OBJ_SPRITE_2D);
ObjRender_SetBlendType(obj, BLEND_ALPHA);
Obj_SetRenderPriority(obj, 1);
ObjPrim_SetTexture(obj, Explode1);
ObjSprite2D_SetSourceRect(obj, 0, 0, 63, 64);
ObjSprite2D_SetDestRect(obj, 0, 0, 63, 64);
ObjRender_SetPosition(obj, x, y, 0);
                ObjRender_SetScaleX(obj,scalex);
                ObjRender_SetScaleY(obj,scaley);
                ObjRender_SetAlpha(obj,alpha);
  while(Obj_IsDeleted(obj)==false)
{
if(frame == 5){int = true;}
frame++;
wait(1);

if (int==true)
{

loop(255)
{
alpha--;
ObjRender_SetAlpha(obj,alpha);
wait(0.5);
}

int = false;

}
}
yield;
}


Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #173 on: December 27, 2011, 03:11:17 PM »
Code: [Select]
wait(0.5);
 :ohdear: :ohdear: :ohdear:

Can you remind us what is the function "wait" ?


On a side note, did you notice your task will be going on forever ?
I kinda understand what you wanted to do, but here's what your task does :
It does nothing during the first four frames, and then your int==true stuff on the fifth, and then nothing, forever.( You won't get out of the loop since nothing will delete your "obj" object.)
And ... what is that "yield;" right before the task ends ?
« Last Edit: December 27, 2011, 03:19:16 PM by Ginko »

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #174 on: December 27, 2011, 03:49:21 PM »
function wait is wrote don't worry hurrrr.

But the yield.....I don't know why it's here u_u'.

I try with scale but the picture appear directly big --_--:

Code: [Select]


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

task Explode01(x,y,scalex,scaley,alpha)
{
let obj = ObjPrim_Create(OBJ_SPRITE_2D);
ObjRender_SetBlendType(obj, BLEND_ALPHA);
Obj_SetRenderPriority(obj, 1);
ObjPrim_SetTexture(obj, Explode1);
ObjSprite2D_SetSourceRect(obj, 0, 0, 32, 28);
ObjSprite2D_SetDestRect(obj, 0, 0, 32, 28);
ObjRender_SetPosition(obj, x, y, 0);
                ObjRender_SetScaleX(obj,scalex);
                ObjRender_SetScaley(obj,scaley);
                ObjRender_SetAlpha(obj,alpha);
wait(1);
loop(20)
{
scalex+=0.2;
ObjRender_SetScaleX(obj,scalex);
scaley+=0.2;
ObjRender_SetScaleY(obj,scaley);
}
}
I don't know what logic takes to program an explode like this ... help meee >.<

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #175 on: December 27, 2011, 04:03:14 PM »
Code: [Select]
loop(20)
{
scalex+=0.2;
ObjRender_SetScaleX(obj,scalex);
scaley+=0.2;
ObjRender_SetScaleY(obj,scaley);
}
Well, looping 20 times through this is just equivalent to

Code: [Select]
scalex+=4;
ObjRender_SetScaleX(obj,scalex);
scaley+=4;
ObjRender_SetScaleY(obj,scaley);

It's not because you make loops that things become fluid ...
I think it's time for you to understand what our little yield; means, as it's explained well enough in the tutorials, I'd suggest you read them once more.

Now,

Code: [Select]
function wait(w){loop(w){yield;}}So, what happens when you're doing this : 
Code: [Select]
wait(0.5);
Code: [Select]
loop(0.5){yield;}Is that really what you want to be done !?

So, in your first bit of code, replace that nonsensical wait(0.5) by a proper wait(1), and in your second bit of code, place the yield; where it fits.
« Last Edit: December 27, 2011, 04:06:13 PM by Ginko »

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #176 on: December 27, 2011, 07:08:48 PM »
And another question :

How would you make an auto-counterbomb ? More precisely, how can you detect a hit, and do you prevent it from killing the player ?

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #177 on: December 27, 2011, 07:37:09 PM »
And another question :

How would you make an auto-counterbomb ? More precisely, how can you detect a hit, and do you prevent it from killing the player ?

The EV_HIT and EV_PLAYER_SHOOTDOWN both detects the hit, i guess one of them is before the actual death and the other the hit itself. I'm unsure, but maybe making the player invincible in one of those events prevents the death.

Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #178 on: December 27, 2011, 07:47:08 PM »
I tried with both the events and the GetPlayerState function, but HIT fails and SHOOTDOWN is too late anyway.

gtbot

  • Master of ScreenSplit
Re: ※ Dnh Q&A/Problem ※ ONLY for NEWEST engine (ph3 beta)
« Reply #179 on: December 27, 2011, 10:06:54 PM »
How would you make an auto-counterbomb ? More precisely, how can you detect a hit, and do you prevent it from killing the player ?

EV_HIT detects when a player is hit by an enemy object. To prevent death, or in other words counterbomb automatically, simply put in CallSpell; in the event. CallSpell will then run EV_REQUEST_SPELL.