Author Topic: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry  (Read 242759 times)

Sage Ω (Ultima)

  • CEO at Team Eternal Desire
  • ??? X
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #60 on: May 22, 2014, 12:43:34 PM »
Generally what I do is use the log window, as well as WriteLog to make sure something is being ran or checking the returned result of a function (like if true or false).

Also, danmakufu will display an error if the graphic was not found in the Log tab and you won't see it in the Texture tab either. Pathing is usually the case with images not showing up other than render priorities.

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #61 on: May 22, 2014, 02:59:06 PM »
I figured out what my mistake was; I tried to call the script with #Background, but I guess that only works for 3D sprites or something, since this only worked with #include. Thanks for the help!
Normal 1cc's: LLS, MS, EoSD, PCB, IN, MoF, SA, UFO, TD, DDC
Hard 1cc's: EoSD, PCB, IN
Extra Clears: EoSD, PCB + Phantasm, IN, MoF, TD, DDC
Phantasmagoria Trues Clears: Standard Regular
Goals: Phantasmagoria Trues Unseen Standard 1cc, MoF XNM, MoF XNF

Sage Ω (Ultima)

  • CEO at Team Eternal Desire
  • ??? X
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #62 on: May 22, 2014, 08:55:32 PM »
The problem is that you were loading a file that wasn't a script in #Background. It works with #include because its a task/function.

A script file must contain atleast @Initialize{} to be considered a script.

MCXD

  • Test
  • Light Sign "Heaven Engine"
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #63 on: May 23, 2014, 03:50:51 AM »
Oh boy, so after a few years away from danmakufu I come back to find a new version. I've been playing around with it for a few days, but I have a couple of basic questions:

a) Here is the 'boss defeated' task in the example ExRumiaSpell01 that comes with ph3:
Code: [Select]
task TEnd
{
while(ObjEnemy_GetInfo(objEnemy, INFO_LIFE) > 0)
{
yield;
}

let ex = ObjMove_GetX(objEnemy);
let ey = ObjMove_GetY(objEnemy);
TExplosionA(ex, ey, 10, 0.6);
DeleteShotAll(TYPE_ALL, TYPE_ITEM);//敵弾を全て削除
Obj_Delete(objEnemy);

loop(30){yield;}

CloseScript(GetOwnScriptID());
}
The problem with it is, during the 30 frames of waiting before the script is closed, any loops that are running will continue running... which is an issue for some cards I've been playing around with to relearn the ropes, because it means that bullets will continue spawning for 30 frames after the boss dies (at 0,0 as it happens, because after the boss object is deleted I guess it defaults a GetX/Y for a non-existant object to 0). I can fix that by removing the 30 frames of waiting and closing the script immediately, but then the cool little explosion animation won't play, because that requires the script to be open. In general, how can you script it so that bullets cease being fired when the boss dies, but there is still time for death animations to occur, without adding an "If (ObjEnemy_GetInfo(objEnemy, INFO_LIFE) > 0)" to every single CreateShot?

If you want a specific example of what I'm talking about; consider the following scenario:
Code: [Select]
...

@Initialize {
int;
main;
close;
ObjMove_SetDestAtFrame(objBoss, cx, cy, 30);
}

...

task int {
//Boss drawing stuff
}

task main {
  loop{
    loop(30){yield;}
    CreateShotA1(ObjMove_GetX(objBoss),ObjMove_GetY(objBoss),3,90,1,10);
    }
}

task close {
 //What should I put here so that bullets cease being fired and an explosion animation plays in full when the boss is reduced to 0 life?
}


b) Is there any default/built-in functionality for spell card names and cutins in Ph3, or do you have to code it all yourself now? If you have to do it yourself, does anyone have any cool templates/snipets I can use for it?

c) Is there a good, balanced, generic player script available for ph3? The default one is a bit buggy (deals damage while not firing when holding down shift, for example).
« Last Edit: May 23, 2014, 04:10:58 AM by MCXD »

Sage Ω (Ultima)

  • CEO at Team Eternal Desire
  • ??? X
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #64 on: May 23, 2014, 04:12:10 AM »
To answer your first question, no however you can use while(){} instead of loop{}. Generally what I do is add if(ObjEnemyblahblhalblah){return;}  to any yielding loops which is easier than adding that line everytime you create a bullet.

As for your second, you have to create cutins and stuff on your own. Shouldn't be that hard to do. There are plenty of good player scripts out there, balanced is dependent on how the person who made them manages health for the bosses. Mr.Blue's players worked for me just fine until I created my own players.

MCXD

  • Test
  • Light Sign "Heaven Engine"
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #65 on: May 23, 2014, 04:31:03 AM »
To answer your first question, no however you can use while(){} instead of loop{}.

Like this?

Code: [Select]
task main {
  while(Obj_IsDeleted(objBoss)!=true){
    CreateShotA1(bx,by,3,45,1,10); wait(10);
    CreateShotA1(bx,by,3,45,2,10); wait(10);
    CreateShotA1(bx,by,3,45,3,10); wait(10);
    CreateShotA1(bx,by,3,45,4,10); wait(10);
    CreateShotA1(bx,by,3,45,5,10); wait(10);
  }
}

Because that didn't work. It only checks the while condition at the start of the loop, so if it's in-progress it keeps spawning bullets after the boss died until its conclusion.

Generally what I do is add if(ObjEnemyblahblhalblah){return;}  to any yielding loops which is easier than adding that line everytime you create a bullet.

Like this?

Code: [Select]
task main {
  loop{
    fire(1); wait(10);
    fire(2); wait(10);
    fire(3); wait(10);
    fire(4); wait(10);
    fire(5); wait(10);
  }
}

function fire(graphic) {
if (Obj_IsDeleted(objBoss)==true){return;}
CreateShotA1(bx,by,3,45,graphic,10);
}

Because that DID work, though I'm not sure it's what you meant.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #66 on: May 23, 2014, 05:42:55 AM »
The above works because it checks first if the boss is deleted before it continues to fire the bullet. You can shorten that up to just  if(Obj_IsDeleted(objBoss)) {}. The function Obj_IsDeleted() throws back a boolean in the first place, so comparing it with a == operator and boolean is redundant for writing out. The Obj_ and !Obj_ will save you some typing.

Additionally you can replace loop {}  with while(!Obj_IsDeleted(objBoss)) {} which also does the trick (and looks more tidy). Basically this roughly translates into:  As long as the boss object IS NOT deleted, perform this loop. When Obj_Delete(objBoss); is called somewhere, the loop will logically be executed if it was already running so potential bullets might be spawned at 0,0 if they had been delayed in some way. Only any other task which was about to start will be prevented from running. 0.12m used to kill all loops/threads/tasks itself but ph3 doesn't understand any of that, hence even if you deleted the boss the script remains alive until closed. You need to plan this careful.

For custom cutins and ideas or usable templates: http://www.shrinemaiden.org/forum/index.php/topic,2146.0.html



« Last Edit: May 23, 2014, 03:54:03 PM by Helepolis »

Sage Ω (Ultima)

  • CEO at Team Eternal Desire
  • ??? X
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #67 on: May 23, 2014, 12:32:50 PM »
Like this?

Code: [Select]
task main {
  loop{
    fire(1); wait(10);
    fire(2); wait(10);
    fire(3); wait(10);
    fire(4); wait(10);
    fire(5); wait(10);
  }
}

function fire(graphic) {
if (Obj_IsDeleted(objBoss)==true){return;}
CreateShotA1(bx,by,3,45,graphic,10);
}

Because that DID work, though I'm not sure it's what you meant.

No I meant, whenever you yield in script. In your case you use a wait function like a lot of other people do (I don't). So you may have trouble doing this. because return will only end the task/function it was used in.

I don't use a wait function for this exact reason.

What I do: loop(num){if(ObjEnemy_GetInfo(objEnemy,INFO_LIFE)<0){return;}yield;}.

loop(num){if(!Obj_IsDeleted(objEnemy)){return;}yield;} this also works too.

Drake

  • *
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #68 on: May 24, 2014, 07:32:26 PM »
Why not have the return condition after the yields only once rather than checking every frame.

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

Sage Ω (Ultima)

  • CEO at Team Eternal Desire
  • ??? X
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #69 on: May 25, 2014, 12:21:44 PM »
I guess that could work too, its just me wanting to be perfect in terms of when to end the task.

CK Crash

  • boozer
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #70 on: May 26, 2014, 01:18:42 PM »
IMHO it's easier to:

1) Make the yield in @MainLoop conditional based on boss life, closing the script as soon as the boss dies.
2) Use external scripts to handle death effects to compensate for the inability to use a "TEnd task", using LoadScript and StartScript in @Finalize.

There are pros and cons to both methods, but I find that this is less intrusive to your pattern code than putting break points for every possible time your boss could run out of life.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #71 on: May 31, 2014, 11:17:15 AM »
I had this interesting pattern/style for my noncard but as usual my Math-weakness kicks in hard to project my thoughts onto code. I have tried various things so please take the time to read into this.

I have 2 objects, a rectangle "floor" and a bullet Obj (presenting the balloon).  The floor is a simple 2D sprite with a while loop for behaviour purpose. The balloon obj bullet is just a simple bubble bullet for now. It has also a while loop in case required. The balloon object is defined globally, and thus can be mutated from any task/function. What I wanted as a gravity effect for the balloon that it keeps falling to the floor (Maximum Y of the field). However, if it interacts with the "floor" object, it will stop. The floor can move up/down.

Well the stopping part is easy to realise as I used the Intersected Line circle code (see below). I also did a test by simply making the bullet fall with direction 90 and speed 1. I had put ObjMove_Setspeed(balloonObj,0); next to the "yes" debug checking (used to check whether the obj is colliding). So far so good. Although what if I actually want to bounce the balloon back into the air? And preferable with an increased speed?

Not sure if anybody remembers Aniki script (yes, it is horrible one but the same mechanics were used there). See here www.youtube.com/watch?v=jLqmwnIW0ac#t=4m54s (nsfw possibility) Basically I'm seeking for the similar effect. The floor bounces the bullet back with a certain speed. The balloon will take a natural flight back into the air.

This is the part I cannot manage. I am to be honest clueless on how to get the direction and speed reversal in place. Or perhaps keep the speed but change the dir? Trying things like reversing the direction or speed didn't obviously help. Man I really wish my math was better orz

http://pastebin.com/UDjsPFsj

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #72 on: June 01, 2014, 08:12:30 AM »
IT'S OKAY I GOT THIS.
ON IRC.
WITH 0.12M EXAMPLES.

http://pastebin.com/TJK5xTp1
<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.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #73 on: June 01, 2014, 09:18:21 AM »
Works like a charm. Thanks Blargel. I added the bounce code statements result in the intersection line circle part and now my rectangle "floor" pushes the balloon back. It is not changing angles so that saves us the trouble I assume.


Some different problem I bumped in and it felt really odd.

During the sprite adjusting of my floor I noticed something weird. My sprite is 256 wide and 128. So logically I set this code:
Code: [Select]
ObjRender_SetScaleXYZ(obj,1.0,1.0,0);
ObjSprite2D_SetSourceRect(obj,0,1,256,128);
ObjSprite2D_SetDestCenter(obj);
Now comes the odd part. The floor logically doesn't covers the entire width of my field, so I simply increased the value to 512 for example, so the texture gets repeated, right? Wrong.

The texture is actually stretched instead of repeated as in 0.12m. I started fiddling with various of functions and parameters such as using ObjSprite2D_SetDestRect as well but none of them had effect. This is quite weird as 3D sprites do repeat themselves if I set them (at least, as far as I can remember when I building my 3D stages. So what is the deal with 2D sprites?

Edit
This is embarrassing that I never had encountered this issue. Using SpriteList2D instead of regular Sprite2D will fix this problem. Thanks Drake for pointing it out.

Edit 2:
Apparently SpriteList2D does not listen to any of the SetAngle functions. Not the render, not the Move and also not the XYZ one. The hell is wrong right now.

Edit3:
Posted on bbs of dnh to see what Mkm has to say about it.
« Last Edit: June 01, 2014, 01:00:44 PM by Helepolis »

Mahou Shoujo Nel!

  • Mahou shoujou
  • Well, let the Mahou begin Trinity!
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #74 on: June 05, 2014, 04:43:23 PM »
Well... She just does nothing....
http://pastebin.com/zWEGJgUd
I'm new to ph3 , switched from 12.m .... its a pain ;-;
I hope anyone can tell me what I'm doing wrong

Edit: About this one: Its my first attempt, I'm using helepolis tut. and  im not futher yet.
         I'm despairing...
« Last Edit: June 05, 2014, 04:56:02 PM by Mahou Shoujo Nel! »

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #75 on: June 05, 2014, 09:48:44 PM »
You have no shot script included. Please check the tutorials carefully. Exame scripts are also available to compare. :)

Drake

  • *
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #76 on: June 05, 2014, 10:00:23 PM »
I think more important is the misspelling of @MainLoop.

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

Mahou Shoujo Nel!

  • Mahou shoujou
  • Well, let the Mahou begin Trinity!
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #77 on: June 05, 2014, 10:21:19 PM »
I think more important is the misspelling of @MainLoop.
... :colonveeplusalpha:

PhantomSong

  • The Ghost Living through Everyday Life.
  • Eh, it doesn't matter.
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #78 on: June 09, 2014, 12:48:00 AM »
I think more important is the misspelling of @MainLoop.
That wouldn't be a spelling...  It's just a capitalization error...
Mainloop vs MianLoop the former is not a spelling error, the latter, is. (Just thought so you can know the difference).

But, yeah, just make sure you capitalize properly, Danmakufu is picky like that.

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #79 on: June 09, 2014, 02:24:13 AM »
I want to make a simple stage script with a few enemies, and I wanted to know if the CreateEnemyFromScript function exists in ph3 or has an equivalent.
Normal 1cc's: LLS, MS, EoSD, PCB, IN, MoF, SA, UFO, TD, DDC
Hard 1cc's: EoSD, PCB, IN
Extra Clears: EoSD, PCB + Phantasm, IN, MoF, TD, DDC
Phantasmagoria Trues Clears: Standard Regular
Goals: Phantasmagoria Trues Unseen Standard 1cc, MoF XNM, MoF XNF

Sage Ω (Ultima)

  • CEO at Team Eternal Desire
  • ??? X
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #80 on: June 09, 2014, 03:49:37 AM »
No, ph3 does not have that function. While you can make it yourself, I've found it easier to task enemies.

task Fairy{
let obj = ObjEnemy_Create(OBJ_ENEMY);
ObjEnemy_Regist(obj);
ObjEnemy_SetLife(obj,100);
ObjPrim_SetTexture(obj,);
ObjSprite2D functions go here
separate task to handle the enemy's hitbox would be called here or you can handle the enemy's hitbox directly in the task.
}
« Last Edit: June 09, 2014, 03:59:04 AM by Infinite Ultima Wave »

Drake

  • *
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #81 on: June 09, 2014, 03:57:38 AM »
You can use StartScript() to start a new Single script or Plural script or whatever else. If you want a wrapper around your enemy so it has its own @Initialize, @Event and so on, then you could use StartScript(). However, in ph3 an enemy isn't defined by a script it's in, so you don't really have to call a script in particular. For generic enemies you can simply create an Enemy object and do things with it just as you otherwise would from inside a Single script.

That wouldn't be a spelling...  It's just a capitalization error...
Mainloop vs MianLoop the former is not a spelling error, the latter, is. (Just thought so you can know the difference).
:|
It is a programming language. Any sort of syntactical error involving words could be called a spelling error; the interpreter doesn't care that it's lowercase, it's still an entirely different character. Why would you even need to point this out.

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

PhantomSong

  • The Ghost Living through Everyday Life.
  • Eh, it doesn't matter.
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #82 on: June 09, 2014, 05:36:43 AM »

:|
It is a programming language. Any sort of syntactical error involving words could be called a spelling error; the interpreter doesn't care that it's lowercase, it's still an entirely different character. Why would you even need to point this out.
But you're talking to humans, not a computer. A spelling error to a human means missing word, extra word, or misplaced words. Not capitalization.

Drake

  • *
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #83 on: June 09, 2014, 07:20:43 AM »
The dude clearly knew what I was talking about, and I'm pretty sure they're human. It should be immediately obvious to anyone looking at his code and my post that the problem was that he had typed @Mainloop instead of @MainLoop. Unless you intend to suggest that somebody would have read my post stating @MainLoop was misspelled, figured to themselves "but they are spelled the same" and didn't understand the problem despite the difference, then there really isn't an issue worth correcting here. It was a simple error, he got it. Again, why is this a big deal.

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

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #84 on: June 09, 2014, 11:49:29 AM »
No, ph3 does not have that function. While you can make it yourself, I've found it easier to task enemies.

task Fairy{
let obj = ObjEnemy_Create(OBJ_ENEMY);
ObjEnemy_Regist(obj);
ObjEnemy_SetLife(obj,100);
ObjPrim_SetTexture(obj,);
ObjSprite2D functions go here
separate task to handle the enemy's hitbox would be called here or you can handle the enemy's hitbox directly in the task.
}
No matter where I declare the hitbox functions, the enemy is untouchable and unshootable. Here's my script for reference: http://pastebin.com/DKjU9Hdd
Normal 1cc's: LLS, MS, EoSD, PCB, IN, MoF, SA, UFO, TD, DDC
Hard 1cc's: EoSD, PCB, IN
Extra Clears: EoSD, PCB + Phantasm, IN, MoF, TD, DDC
Phantasmagoria Trues Clears: Standard Regular
Goals: Phantasmagoria Trues Unseen Standard 1cc, MoF XNM, MoF XNF

Sage Ω (Ultima)

  • CEO at Team Eternal Desire
  • ??? X
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #85 on: June 09, 2014, 12:08:23 PM »
ObjEnemy_SetIntersectionCircleToShot(enemyObj,ObjMove_GetX(enemyObj),ObjMove_GetY(enemyObj),16);
ObjEnemy_SetIntersectionCircleToPlayer(enemyObj,ObjMove_GetX(enemyObj),ObjMove_GetY(enemyObj),10);

You have these outside of the while loop in that task. Therefore the enemy only had a hitbox for one frame, in order to keep the hitbox running place the two functions inside of the loop.

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #86 on: June 09, 2014, 07:10:53 PM »
This is really weird. My second enemy task doesn't spawn the hitboxes for the enemies, no matter which animation task I use. Here's the code: http://pastebin.com/H2ewGFPs
And here's how I'm using this task in case that makes a difference:
loop {
      spamFairy(+5,30);
      spamFairy(2*cx-5,150);
      wait(100);
}

(cx is the center x-value)
Normal 1cc's: LLS, MS, EoSD, PCB, IN, MoF, SA, UFO, TD, DDC
Hard 1cc's: EoSD, PCB, IN
Extra Clears: EoSD, PCB + Phantasm, IN, MoF, TD, DDC
Phantasmagoria Trues Clears: Standard Regular
Goals: Phantasmagoria Trues Unseen Standard 1cc, MoF XNM, MoF XNF

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #87 on: June 13, 2014, 07:23:01 AM »
Not sure about it, but you are using wait(8); functions inside the animation script where also the hitbox is handled. A hitbox needs to be updated every frame. If you delay such important threads then your hitbox will be poorly updated or not at all perhaps.


Drake

  • *
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #88 on: June 13, 2014, 09:22:50 AM »
Yeah that seems to be the case, but it's actually worse than that since those are performed inside an infinite loop. If the fairy ever gets to the sixth animation frame of moving left or right, it will just loop those three animation frames forever. The hitbox, zero life, and out-of-range handling never gets called after that point.

1) You should probably be putting the hitbox code and whatnot inside a separate task that loops every frame anyways, just as habit.
2) Restructure your drawing code on those (f2 >= 25) parts so it doesn't loop forever.

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

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #89 on: June 13, 2014, 08:33:05 PM »
That would certainly do it.  :V
Normal 1cc's: LLS, MS, EoSD, PCB, IN, MoF, SA, UFO, TD, DDC
Hard 1cc's: EoSD, PCB, IN
Extra Clears: EoSD, PCB + Phantasm, IN, MoF, TD, DDC
Phantasmagoria Trues Clears: Standard Regular
Goals: Phantasmagoria Trues Unseen Standard 1cc, MoF XNM, MoF XNF