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

Uruwi

  • Nightmare of Torrential Precipitation
  • 478 million goober
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #150 on: May 01, 2016, 07:34:07 PM »
You're trying to create a primitive object but using it as if it were a sprite list. Those are different.
foo = foldl $ flip ($)
Highest difficulty 1CCed for each game, by shot type in the original order. (-: never 1CCed on any difficulty, or never used; E: easy, N: normal, H: hard, L / U: lunatic / unreal.)
EoSD [NNNE] PCB [EE--N-] IN [NEEE + Ex Border] PoFV [Mystia N, Mystia E no charge] MoF [EN--H- + Ex Marisa B] SA [N-----] UFO [----EN] TD [NENE] DDC [EE-EHE + Ex Marisa B & Sakuya A] LoLK [PD --N- Legacy ---N] EE [N- + Ex Yabusame] EMS [N-- + Ex Yabusame] RMI [NHN + Ex YaoSuku]
Avelantis (demo) Easy YuukiB 426,077,200

Random Sphere

  • It's been 3 years...
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #151 on: May 01, 2016, 07:53:28 PM »
Then what should I do?
Normal 1CCs : PCB, IN, PoFV, MoF, UFO, TD, DDC, HSiFS, WBaWC.
Extra Clears: IN, MoF, HSiFS, WBaWC.

Nefer007

  • Nefer007, Shinto God of Insects, Doctorate in Referralology
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #152 on: May 01, 2016, 07:53:56 PM »
This is just impossible...

Code: [Select]
#TouhouDanmakufu[Plural]
#ScriptVersion[3]
#Title["EX Rumia Plural Script"]
#Text["EX Rumia Spell Cards"]
#Image[".\stage/derp.png"]
#Background["script/default_system/Default_Background_IceMountain.txt"]

@Initialize
{
TPlural();
}

@MainLoop
{
yield;
}

@Finalize
{
}


task TPlural
{
let dir = GetCurrentScriptDirectory();

//Creates the boss scene
let obj = ObjEnemyBossScene_Create();
ObjEnemyBossScene_Add(obj, 0, dir ~ "boss1attack1.txt");
ObjEnemyBossScene_Add(obj, 0, dir ~ "boss1attack2hard.txt");
ObjEnemyBossScene_LoadInThread(obj);
ObjEnemyBossScene_Regist(obj);

//Stands by until the boss scene is finished
while(!Obj_IsDeleted(obj))
{
yield;
}

//The end of the script
CloseScript(GetOwnScriptID());
}

There's at least one error in this that is causing Danmakufu to crash, and I cannot find it. I need it to be fixed so I can have the workings of a finished game.

Can someone tell me why the ExRumia demo script works with a plural, but not this?
Looking for Desunoya music! Help me obtain these ill-gotten goods!

Random Sphere

  • It's been 3 years...
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #153 on: May 01, 2016, 08:18:42 PM »
Code: [Select]
#Image[".stage/derp.png"]
#Background["script/default_system/Default_Background_IceMountain.txt"]

Delete that code. Maybe that`s the problem.
Normal 1CCs : PCB, IN, PoFV, MoF, UFO, TD, DDC, HSiFS, WBaWC.
Extra Clears: IN, MoF, HSiFS, WBaWC.

Uruwi

  • Nightmare of Torrential Precipitation
  • 478 million goober
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #154 on: May 01, 2016, 08:41:47 PM »
Use a forward slash instead of a backslash.
foo = foldl $ flip ($)
Highest difficulty 1CCed for each game, by shot type in the original order. (-: never 1CCed on any difficulty, or never used; E: easy, N: normal, H: hard, L / U: lunatic / unreal.)
EoSD [NNNE] PCB [EE--N-] IN [NEEE + Ex Border] PoFV [Mystia N, Mystia E no charge] MoF [EN--H- + Ex Marisa B] SA [N-----] UFO [----EN] TD [NENE] DDC [EE-EHE + Ex Marisa B & Sakuya A] LoLK [PD --N- Legacy ---N] EE [N- + Ex Yabusame] EMS [N-- + Ex Yabusame] RMI [NHN + Ex YaoSuku]
Avelantis (demo) Easy YuukiB 426,077,200

Nefer007

  • Nefer007, Shinto God of Insects, Doctorate in Referralology
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #155 on: May 01, 2016, 11:15:21 PM »
Use a forward slash instead of a backslash.
Code: [Select]
#Image[".stage/derp.png"]
#Background["script/default_system/Default_Background_IceMountain.txt"]

Delete that code. Maybe that's the problem.

I can't delete the code. I managed to cobble together a working #SetScriptPath and it worked but the boss didn't spawn. What do?
Looking for Desunoya music! Help me obtain these ill-gotten goods!

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #156 on: May 01, 2016, 11:54:49 PM »
I repost it on the new page:
Hi!
Is there a way to manually open the pause script? Like a function when it called it open the pause menu without pressing any pause key?
I want to create a pseudo-continue system that occur before the actual danmakufu gameover by oppening a pause script but I don't know how to freeze the game during the pause menu and unfreeze it when the player leave the menu.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #157 on: May 02, 2016, 01:48:30 AM »
I can't delete the code. I managed to cobble together a working #SetScriptPath and it worked but the boss didn't spawn. What do?

Did you follow Fluffy8x's advice and use / instead of \ for the image path?

Also, what do you mean by 'a working #SetScriptPath'

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #158 on: May 02, 2016, 05:31:04 AM »
You do need to use a forward slash rather than a backslash in script, but it doesn't matter in the headers.


Honestly there must be something else to your problem since I can copypaste your code and have it run fine given I name files properly.

Hi!
Is there a way to manually open the pause script? Like a function when it called it open the pause menu without pressing any pause key?
I want to create a pseudo-continue system that occur before the actual danmakufu gameover by oppening a pause script but I don't know how to freeze the game during the pause menu and unfreeze it when the player leave the menu.
There is probably an acceptable way to accomplish what you're thinking of, so maybe you should describe it in more detail rather than asking for a particular kind of solution.
« Last Edit: May 02, 2016, 05:51:07 AM by Drake »

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #159 on: May 02, 2016, 08:23:20 AM »
Well. I just want to create a continue system without using the package script. So I thought to use a simple Pause menu with options like in a Game Over menu (but I still keep a true pause menu beside). And I want to call this menu when it remain one life (with this, I avoid the true danmakufu end menu).
But I have no idea how I can do this.
(I hope it's almost clear  :ohdear:)

edit: I think I actually found a way to do that by using a common data in my main script and opening pause script in package script with this. But I don't know if it's possible to do without a package script...
« Last Edit: May 02, 2016, 01:13:42 PM by Lefkada »

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #160 on: May 02, 2016, 02:39:28 PM »
Well. I just want to create a continue system without using the package script. So I thought to use a simple Pause menu with options like in a Game Over menu (but I still keep a true pause menu beside). And I want to call this menu when it remain one life (with this, I avoid the true danmakufu end menu).
But I have no idea how I can do this.
(I hope it's almost clear  :ohdear:)

edit: I think I actually found a way to do that by using a common data in my main script and opening pause script in package script with this. But I don't know if it's possible to do without a package script...

I think it's possible with any type of script (even Single), if you just mess around with the system files.
Lunatic 1CCs: PCB, IN, PoFV, HSiFS
Extra: All except PC-98.

Oh hey look I can do DNH scrips.

ExPorygon

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
    • Ephemeral Entertainment
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #161 on: May 02, 2016, 06:21:06 PM »
Well. I just want to create a continue system without using the package script. So I thought to use a simple Pause menu with options like in a Game Over menu (but I still keep a true pause menu beside). And I want to call this menu when it remain one life (with this, I avoid the true danmakufu end menu).
But I have no idea how I can do this.
(I hope it's almost clear  :ohdear:)

edit: I think I actually found a way to do that by using a common data in my main script and opening pause script in package script with this. But I don't know if it's possible to do without a package script...
I have made this precise system you're looking for in my game, Ephemeral Unnatural Balance. You are correct in your thought process, however the only way to induce the game to pause outside of pressing the Pause key is to use this function: PauseStageScene

The only problem with this process is that PauseStageScene can only be called within a Package script, anywhere else will cause an error. This pretty much means a continue system in this manner REQUIRES a Package script unfortunately. If you want to know more about how precisely I made this system work, let me know and I'll be happy to elaborate on what I did.

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #162 on: May 02, 2016, 06:49:41 PM »
This is just impossible...

There's at least one error in this that is causing Danmakufu to crash, and I cannot find it. I need it to be fixed so I can have the workings of a finished game.

Can someone tell me why the ExRumia demo script works with a plural, but not this?

Try placing a few yields at the very start of the task. This seems to be a prevalent problem with Danmakufu.
Spoiler:
Unlike in my engine, which is coming along nicely...

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #163 on: May 03, 2016, 01:41:25 AM »
Try placing a few yields at the very start of the task. This seems to be a prevalent problem with Danmakufu.
Wat. I've never had this sort of problem, and it makes no sense to arbitrarily yield tasks for a frame. This was a problem in 0.12 if you wanted to start a task that tried to render image resources before @Initialize was finished (or something along those lines, it's been a while), but ph3 doesn't have this issue.

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #164 on: May 03, 2016, 09:25:36 AM »
Nefer> Try
Code: [Select]
let obj = ObjEnemyBossScene_Create(); out of any task or @ instead of in the TPlural. If you put it in TPlural, obj will exist only in this task and not in the entire script.
I'm not sure ti was the problem but It's a bit wreid for me.

ExPorygon> Thanks. That's what I thought. But since I'm trying to do a full game, I'll use package script. I just want to avoid any return to package script before the actual end of the script (by death with no continue remaining or by end of the game). If I have any question, I'll ask you :D

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #165 on: May 03, 2016, 09:56:08 AM »
Nefer> Try
Code: [Select]
let obj = ObjEnemyBossScene_Create(); out of any task or @ instead of in the TPlural. If you put it in TPlural, obj will exist only in this task and not in the entire script.
I'm not sure ti was the problem but It's a bit wreid for me.
It shouldn't matter, since the Scene object isn't referenced outside the task. Having it be undefined outside the task and trying to reference it would throw an error instead of crashing anyways.
Like I said, you can copypaste the code just fine and have it work. There's something else to the problem that they haven't described.

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #166 on: May 06, 2016, 08:09:20 PM »
Hi! It's not an actual question about danmakufu but more a question about organisation and project making. I ask this espacially to people who make actual full games.
How do you organize your work? What do you make first? Danmaku or all the menus and system? And about all graphics and sounds? And about scenario?
I start new full game project but I don't really know (or I actually know but I want others advinces and experiences) how to plan my task and I know how it's really hard to stay in the right way.


Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #167 on: May 07, 2016, 02:03:15 PM »
Hi, I needed some help with my spell background.
I've been trying to replicate Junko's background but there are some (lots of) problems.

http://imgur.com/a/5JhDp (I don't know how to attach images...)

In the first picture there's a line where the bg originate out from, I want it to originate from a specific point, not from a line.
In the second picture, as the time passes on, the bg becomes stretched out and more uniformed, I don't want this to happen.
Here's the code:
Code: [Select]
let path2 = current~ "cdbg06a.png";
let bg2 = ObjPrim_Create(OBJ_PRIMITIVE_2D);
ObjPrim_SetPrimitiveType(bg2,PRIMITIVE_TRIANGLEFAN);
ObjRender_SetBlendType(bg2, BLEND_SUBTRACT);
Obj_SetRenderPriority(bg2, 0.21);
ObjPrim_SetTexture(bg2, path2);
ObjSprite2D_SetDestRect(bg2,-0, 0, GetX, GetY);

let t = 0;
let ti = 10;
let alpha = 0;
loop{
determine;
if(isSpell){alpha=1;}
else{alpha=0;}
                let px = GetCenterX;
let py = GetCenterY-150;
let vc = 62;

ObjSprite2D_SetDestCenter(bg2);
ObjPrim_SetVertexCount(bg2,vc);

ObjPrim_SetVertexPosition(bg2,0,px,py,1);
ObjPrim_SetVertexUVT(bg2,0,512*(t/300),1048);

ascent(i in 0..vc){
ObjPrim_SetVertexPosition(bg2,i+1,px+ti*cos((360/(vc-3))*i-90),py+ti*sin((360/(vc-3))*i-90),1);
ObjPrim_SetVertexAlpha(bg2,i,alpha*200);
}

ascent(i in 0..vc){
ObjPrim_SetVertexUVT(bg2,i+1,0,(512/vc*5)*i);
}
ObjPrim_SetVertexPosition(bg2,vc-1,px+ti*cos(0-90),py+ti*sin(0-90),1);
ObjPrim_SetVertexUVT(bg2,vc-1,0,512);
ObjPrim_SetVertexAlpha(bg2,vc-1,alpha*200);
t++;
ti+=1;
yield;
}

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #168 on: May 07, 2016, 05:03:23 PM »
Hi! It's not an actual question about danmakufu but more a question about organisation and project making. I ask this espacially to people who make actual full games.
How do you organize your work? What do you make first? Danmaku or all the menus and system? And about all graphics and sounds? And about scenario?
I start new full game project but I don't really know (or I actually know but I want others advinces and experiences) how to plan my task and I know how it's really hard to stay in the right way.

It's really up to you. Personally, I built a stable in-game system over the course of a year or so, and then I only worked on the package when I began Digital Earth: Conquest. And of course, I started rather simple and gradually added new features (e.g. Spell card Practice, Continue System, etc.). This method is the least painful and most intuitive, though it results in ugly code when you retrofit older code to work with newer features.

As for the content itself, I personally cannot work on a stage without having the stage background, graphics, and music all complete beforehand. And for bosses, I need to have all of the assets ready.

This is because there's a flow and an aesthetic to each component of your game, and, for example, if your stage background scrolled fast but your music was slow and your enemies spawned at weird times and at weird places, that would feel 'off' to the player. So especially for stages, I highly recommend having all of your assets ready beforehand so that you can make the stage flow well with the music (i.e. have a distinct part of the song where the mid boss appears).

So for me, menus and systems are a gradual process, and graphics + sound need to come before the actual danmaku.

As for content, it is imperative that you know the entire plot, the characters and their interactions, etc. BEFORE starting your project. Otherwise you risk losing quite a lot - for me personally, I didn't solidify the main plots of either Pok?DigiDanmaku or Digital Earth: Conquest until late in the game, and the stories were pretty bad as a result. It's especially important to know your plot and how the characters interact with each other beforehand if you're making original characters - their actions, personality, and abilities will have a direct impact on the aesthetic they present, including the music, graphics, sprite animations, spell names, and most importantly, the type of danmaku they fire.

If a character is hyperactive and flamboyant and uses guns, then you make danmaku that represents that character, etc. It's very easy to overthink this, however, so I recommend planning the type of non spells a character has as well as general danmaku style before starting the first stage they appear in.

And another thing: In regards to organization, I *highly* recommend having one folder specifically for images that will hold EVERY image asset you use in your game. This way it's very easy to archive later on, and you always know where things are. The same goes for sound - have one folder specifically to hold sound effects, and label your bgm tracks in the filename (e.g. boss1.ogg instead of <Name of track>.ogg) I also highly discourage having libraries everywhere (it makes things hard to find), and always keep all of your fonts in one place.

Agent17

  • (Not a) Secret Agent
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #169 on: May 08, 2016, 12:38:35 PM »
Hi, i've got a little problem on a task, it shows me this error :

, and i don't really know what to do to fix it.

Heres the code used for the task if it can help you :
EDIT : i found a way to fix the first error, but now it shows me the "you are using a variable that has not been set yet." error, heres the updated task :
Code: [Select]
task DeleteShotToItem(x,y,radius,type,deltype) { //Deletes bullets and leaves a bullet break image
let iArray = GetShotIdInCircleA2(x,y,radius,TARGET_ENEMY);
ascent(i in 0..length(iArray)) {
let col = ObjShot_GetImageID(iArray[i]);
let color = GetShotDataInfoA1(col,TARGET_ENEMY,INFO_DELAY_COLOR); //Line where the error occurs
DelEffect(GetX(iArray[i]),GetY(iArray[i]),type,[color[0],color[1],color[2]]);
DeleteShotInCircle(TYPE_ALL,deltype,GetX(iArray[i]),GetY(iArray[i]),2);
}

task DelEffect(x,y,typ,Col) { //Bullet break image task
let obj = ObjPrim_Create(OBJ_SPRITE_2D);
let path = GetCurrentScriptDirectory~"./img/Effect/BulletBreak.png";
Obj_SetRenderPriorityI(obj,35);
ObjPrim_SetTexture(obj,path);
ObjRender_SetPosition(obj,x,y,0);
ObjSprite2D_SetSourceRect(obj,0,0,32,32);
ObjSprite2D_SetDestCenter(obj);
ObjRender_SetColor(obj,Col[0],Col[1],Col[2]);
ObjRender_SetAlpha(obj,200);
ObjRender_SetScaleXYZ(obj,0.5,0.5,0);
ObjRender_SetBlendType(obj,BLEND_ADD_ARGB);
ascent(i in 0..8) {
ObjSprite2D_SetSourceRect(obj,32*(i-1),0,32*i,32);
wait(5);
}
Obj_Delete(obj);
}
}
« Last Edit: May 08, 2016, 02:09:22 PM by Agent17 »
NMNB : IN (easy).
Normal 1CCs : EoSD, IN, MoF, SA, UFO, GFW, TD and DDC.
Hard 1CCs : TD.
Extra Clear : IN, GFW, TD and DDC.

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #170 on: May 08, 2016, 01:30:31 PM »
For one, color is already [color[0],color[1],color[2]] so you can just pass it directly. As for the problem, I am noticing a bit of potential variable name confusion but I'm not sure. You never specified on which line or variable the current error is about.

In any case, can I ask why you're making a function to do this delete-to-item effect? Are you only ever going to use this effect when using this function? Because this sounds like something you'd do a lot. Item scripts provide you with a way to have this sort of effect occur whenever bullets are deleted, as the engine will fire EV_DELETE_SHOT_* events and you can handle the effect behaviour in the item script. Then when you want to delete bullets you can just call the DeleteShotInCircle method as you usually would. It would be more efficient than your current method as well. (You would have to learn a bit on how to set this up, but you've already done most of the effect work already.)
« Last Edit: May 08, 2016, 01:32:55 PM by Drake »

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

Agent17

  • (Not a) Secret Agent
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #171 on: May 08, 2016, 02:24:24 PM »
Thanks for the reply, that function was basically made for overall shot deleting, with the deltype parameter being either TYPE_IMMEDIATE or TYPE_ITEM with a bullet break effect.
My problem was with getting the bullet's color, but i fixed it by deleting the bullet in a separate ascent loop after the one for making the break effect.
So, thank you anyway !
NMNB : IN (easy).
Normal 1CCs : EoSD, IN, MoF, SA, UFO, GFW, TD and DDC.
Hard 1CCs : TD.
Extra Clear : IN, GFW, TD and DDC.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #172 on: May 09, 2016, 06:02:43 PM »
Thanks Sparen.

Just about this:
Quote
I *highly* recommend having one folder specifically for images that will hold EVERY image asset you use in your game. This way it's very easy to archive later on, and you always know where things are.
Do you mean a separated file where you put every images used in any way in the project with .psd and all other layered stuff or an actual file of the game with all the images in?

So, now I need to found someone to make me cool musics before I can start stage and bosses making :(

If someone else have advices about full game making, don't hesitate ^^. I have almost my way to do but other point of view are always a good thing ;).

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #173 on: May 09, 2016, 08:36:15 PM »
Thanks Sparen.

Just about this:Do you mean a separated file where you put every images used in any way in the project with .psd and all other layered stuff or an actual file of the game with all the images in?

So, now I need to found someone to make me cool musics before I can start stage and bosses making :(

If someone else have advices about full game making, don't hesitate ^^. I have almost my way to do but other point of view are always a good thing ;).

I personally keep my .psd, .svg, and .xcf files in a separate folder elsewhere, and I only keep the exported .png and .jpg files directly used by the game in my script's img folder. It's up to you, of course.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #174 on: May 10, 2016, 06:50:18 PM »
That's exactly what I'm doing. Actually my ask is:
By this:
Quote
I *highly* recommend having one folder specifically for images that will hold EVERY image asset you use in your game. This way it's very easy to archive later on, and you always know where things are.
You mean "have every images used in the game in one unique picture folder in the game file" right? And not "keep every .psd and other in one unique folder out of the game folder".
I'm not sure if it's clear or not :(

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #175 on: May 10, 2016, 08:17:37 PM »
That's exactly what I'm doing. Actually my ask is:
By this: You mean "have every images used in the game in one unique picture folder in the game file" right? And not "keep every .psd and other in one unique folder out of the game folder".
I'm not sure if it's clear or not :(

That's what I meant, yes.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #176 on: May 11, 2016, 12:43:19 PM »
Code: [Select]
task TBossTimer
{
let objNum = ObjText_Create;
let objScene;

loop{
objScene = GetEnemyBossSceneObjectID();
while(objScene != ID_INVALID){
RenderTimer;
}
yield;
}

function RenderTimer{
while(objScene == ID_INVALID){yield;}
let timer = ObjEnemyBossScene_GetInfo(objScene, INFO_TIMER);
        ObjText_SetFontSize(objNum, 24);
        ObjText_SetText(objNum, rtos("00", timer));
        ObjText_SetFontType(objNum, "Russell Square Regular");
        ObjText_SetFontBold(objNum, true);
        ObjText_SetFontColorTop(objNum, 255, 255, 255);
        ObjText_SetFontColorBottom(objNum, 255, 255, 255);
        ObjText_SetFontBorderType(objNum, BORDER_FULL);
        ObjText_SetFontBorderColor(objNum, 0, 0, 0);
        ObjText_SetFontBorderWidth(objNum, 2);
        Obj_SetRenderPriority(objNum, 0.5);
        ObjRender_SetX(objNum, 395);
        ObjRender_SetY(objNum, 2);
        while(true){
                timer = ObjEnemyBossScene_GetInfo(objScene, INFO_TIMER);
                timer = min(timer, 999);
                ObjText_SetText(objNum, rtos("00", timer));
                yield;
        }
}
}

My timer works only during the midboss; It just stays at zero during the boss battle. Any reasons why? It works well when I use the default timer. (You might see some random useless garbage thrown in to the code, but that's just because I've been going crazy to fix it for like 3 days.)
Lunatic 1CCs: PCB, IN, PoFV, HSiFS
Extra: All except PC-98.

Oh hey look I can do DNH scrips.

Agent17

  • (Not a) Secret Agent
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #177 on: May 11, 2016, 02:25:40 PM »
My timer works only during the midboss; It just stays at zero during the boss battle. Any reasons why? It works well when I use the default timer. (You might see some random useless garbage thrown in to the code, but that's just because I've been going crazy to fix it for like 3 days.)
The issue might be because the timer doesn't delete after a single script is closed. Here's the code with not that issue when playing it in single scripts, i might test it with plurals later but i got to go right now :
Code: [Select]
task TBossTimer
{
let objNum = ObjText_Create;
let objScene;

loop{
objScene = GetEnemyBossSceneObjectID();
if(objScene != ID_INVALID){
RenderTimer;
}
yield;
}

function RenderTimer{

let timer = ObjEnemyBossScene_GetInfo(objScene, INFO_TIMER);
        ObjText_SetFontSize(objNum, 24);
        ObjText_SetText(objNum, rtos("00", min(timer,999)));
 
        ObjText_SetFontBold(objNum, true);
        ObjText_SetFontColorTop(objNum, 255, 255, 255);
        ObjText_SetFontColorBottom(objNum, 255, 255, 255);
        ObjText_SetFontBorderType(objNum, BORDER_FULL);
        ObjText_SetFontBorderColor(objNum, 0, 0, 0);
        ObjText_SetFontBorderWidth(objNum, 2);
        Obj_SetRenderPriority(objNum, 0.5);
ObjText_SetFontType(objNum, "Russell Square Regular");
        ObjRender_SetX(objNum, 395);
        ObjRender_SetY(objNum, 2);
        loop(ObjEnemyBossScene_GetInfo(objScene, INFO_TIMER)*60) { 
timer = ObjEnemyBossScene_GetInfo(objScene, INFO_TIMER);
ObjText_SetText(objNum, rtos("00", min(timer,999)));
yield;
}
Obj_Delete(objNum);
}
}
NMNB : IN (easy).
Normal 1CCs : EoSD, IN, MoF, SA, UFO, GFW, TD and DDC.
Hard 1CCs : TD.
Extra Clear : IN, GFW, TD and DDC.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #178 on: May 11, 2016, 04:43:15 PM »
It doesn't work. All it changed is that it now deletes the whole timer after the boss appears. Also, I specifically said it worked well with the midboss, but stopped working during the boss, meaning I'm making a Stage script, not a Single or Plural script. It works perfectly in Single.
Lunatic 1CCs: PCB, IN, PoFV, HSiFS
Extra: All except PC-98.

Oh hey look I can do DNH scrips.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #179 on: May 11, 2016, 07:09:57 PM »
Here, my timer code. If it can help you:
Code: [Select]
//----------------------------------------------------
//BOSS TIMER
//----------------------------------------------------
task TBossTimer {
let timer = -1;
let time01_path =  GetCurrentScriptDirectory() ~ "se/se_timeout.wav";
let time02_path = GetCurrentScriptDirectory() ~ "se/se_timeout2.wav";
let timer_end = false;
let f = 0;
let count = 5;
let num_id = [ObjText_Create,ObjText_Create,ObjText_Create,ObjText_Create,ObjText_Create,ObjText_Create];
let sep = "";
let sep_space = 6;
let size_min = -6;
let pulse = 0;
let r = 0;
let listNum = DigitToArray(timer, 5);
let objScene = ID_INVALID;
let taskOn = true;

ascent(iObj in 0 .. 5) {
if((4-iObj) == 2) {
sep_space = 0;
size_min = 0;
}
if((4-iObj) == 3) {
sep_space = 0;
}
let num = listNum[4-iObj];
Text(num_id[4-iObj], "",196-iObj*12+sep_space, 14-0.75*size_min, 18+size_min, 255, 255-r, 255-r, 255, 255-r, 255-r, 8+r, 8, 8, 0.70);
}


while(taskOn == true) {
objScene = GetEnemyBossSceneObjectID();
if(objScene == ID_INVALID) {
ascent(iObj in 0 .. 5) {
let num = listNum[4-iObj];
if((4-iObj) == 3) {
if((iObj) < count) {
sep = ",";
} else if((iObj) == count) {
sep = " ";
}
} else {
sep = "";
}
ObjText_SetText(num_id[4-iObj], "");
}
} else if(objScene != ID_INVALID) {
if(timer == -1) {timer = 100*ObjEnemyBossScene_GetInfo(objScene, INFO_TIMER);}
if(timer < 100*ObjEnemyBossScene_GetInfo(objScene, INFO_TIMER)) {timer = 100*ObjEnemyBossScene_GetInfo(objScene, INFO_TIMER);}
f += 1/0.6;
timer -= 1/0.6;
if(timer < 0) {timer = 0;}
if(timer > 1000) {r = 0;}
if(timer <= 1000) {r = 80;}
if(timer <= 500) {r = 120;}


if(timer <= 1000 && timer > 997) {
SE(time01_path);
timer_end = false;
}
if(timer <= 900 && timer > 897) {SE(time01_path);}
if(timer <= 800 && timer > 797) {SE(time01_path);}
if(timer <= 700 && timer > 697) {SE(time01_path);}
if(timer <= 600 && timer > 597) {SE(time01_path);}

if(timer <= 500 && timer > 495) {SE(time02_path);}
if(timer <= 400 && timer > 395) {SE(time02_path);}
if(timer <= 300 && timer > 295) {SE(time02_path);}
if(timer <= 200 && timer > 195) {SE(time02_path);}
if(timer <= 100 && timer > 95) {SE(time02_path);}
if(timer <= 0 && timer_end == false) {
SE(time02_path);
timer_end = true;
}

count = truncate(log10(1+timer));
if(count < 3) {count = 3;}
let listNum = DigitToArray(timer, 5);
ascent(iObj in 0 .. 5) {
let num = listNum[4-iObj];
if((4-iObj) == 3) {
if((iObj) < count) {
sep = ",";
} else if((iObj) == count) {
sep = " ";
}
} else {
sep = "";
}
if((iObj) > count) {
ObjText_SetText(num_id[4-iObj], "");
} else {
ObjText_SetText(num_id[4-iObj], sep ~IntToString(num));
}
ObjText_SetFontColorTop(num_id[4-iObj],  255, 255-r, 255-r);
ObjText_SetFontColorBottom(num_id[4-iObj],  255, 255-r, 255-r);
ObjText_SetFontBorderColor(num_id[4-iObj],8+r, 8, 8);
}
}
yield;
}
}
(don't mind about while(taskOn == true), I don't know loop{stuff} works when I wrote this).

If I remember correctly, when there is no boss, the timer is still here but invisible with space instead of numbers. And when there is a boss, it take the value of the actual boss timer.
I don't know if it's the best way to do but it works fine.