-
Old thread. (http://www.shrinemaiden.org/forum/index.php/topic,6424.0.html)
-
this keeps happening:
-Play menu song
-Fade out menu song
-Play boss song
-Boss battle and shit
-Fade out boss song
-Try to play menu song again
-It plays but begins fading immediately?
what do
-
You tried deleting and reloading it after fading/stopping?
-
question
Try FadeOutMusic("menu music", -5000); or some really small/low number. I haven't tested, but it might actually work.
-
What does CreateEnemyBossFromSingleScriptFile(); do?
Found in stage0.txt
-
If there isn't a function with that name defined in the script, it might be a deprecated version of CreateEnemyBossFromFile. I'd imagine you could use it when you want a single pattern midboss or something?
-
What does CreateEnemyBossFromSingleScriptFile(); do?
Found in stage0.txt
If it isn't listed on the wiki, you can probably safely ignore it. It's probably 99% certain none of us would know either anyway. If you're truly curious, try it yourself in a stage script and see what happens.
Here's my theory though. First of all, correct me if I'm wrong, but stage0.txt is an internal script from the .dat file right? It sounds like it's used as the "stage" that Single and maybe Plural enemies would be spawned in. If that's the case, then CreateEnemyBossFromSingleScriptFile is likely a version of the CreateEnemyBossFromFile function that the average scripter isn't supposed to use because it would read from memory which script file was selected in the dnh menu and spawn it at a predetermined position. Judging from the naming, it looks like there might be a CreateEnemyBossFromPluralScriptFile as well.
-
Where are the tutorials to learn how to make menu screen and stage transitions :V
-
Where are the tutorials to learn how to make menu screen and stage transitions :V
There are none :V
-
Where are the tutorials to learn how to make menu screen and stage transitions :V
Menus aren't too hard to do. All you need is a variable to keep track of which selection you're on and something listening for the player pressing a direction. For example:
task MainMenu {
let selection = 0;
loop {
if(GetKeyState(VK_UP)==KEY_PUSH){ selection--;}
if(GetKeyState(VK_DOWN)==KEY_PUSH){ selection++;}
yield;
}
}
Of course, how it is now, if you have only, for example, 5 menu items, the selection can go beyond that so you need to make it wrap around:
let selection = 0;
task MainMenu {
let menuItems = 5; // how many menu items there should be.
loop {
if(GetKeyState(VK_UP)==KEY_PUSH){ selection--;}
if(GetKeyState(VK_DOWN)==KEY_PUSH){ selection++;}
if(selection >= menuItems){ selection = 0; }
if(selection < 0){ selection = menuItems-1; }
yield;
}
}
You might notice I made the items count from 0 to 4 instead of 1 to 5. That's cause I'm a silly programmer person that counts from 0, but you can count from 1 to 5 if you wanted. Anyways, now that you have the logic down for this basic menu, you have to draw it. You can use either DrawText in the @DrawLoop, or if you're feeling fancy, effect objects. Generally, the only thing you'll be doing with the drawing is checking what value selection is and highlighting the corresponding menu choice. This is why I put selection outside of the task; we want other functions to be able to read it.
Now that we're displaying and controlling the menu, we actually need to let the player be able to select the choices. We'll be using the shot key for this of course.
let selection = 0;
let location = "main";
task MainMenu {
let menuItems = 5; // how many menu items there should be.
loop {
if(GetKeyState(VK_UP)==KEY_PUSH){ selection--;}
if(GetKeyState(VK_DOWN)==KEY_PUSH){ selection++;}
if(selection >= menuItems){ selection = 0; }
if(selection < 0){ selection = menuItems-1; }
if(GetKeyState(VK_SHOT)==KEY_PUSH){
alternative(selection)
case(0){
StoryStart; // Of course you're going to have to write these functions
location = "story";
}
case(1){
StagePractice;
location = "stage practice";
}
case(2){
SpellcardPractice;
location = "spellcard practice";
}
case(3){
MusicRoom;
location = "music room"
}
case(4){
ClearStage; //generally the last choice is to quit the game so we'll exit out of the game
}
return; //now that the player chose something, we can let the main menu task end. If it's needed again, just call the task again.
}
yield;
}
}
These are just the basics of menu creation. You should also program things that happen when the player presses a cancel key so they can go backwards in menus. It should be fairly intuitive now how you add stuff to menus. Other things you can play around with is an options menu and unlockables. These might be a bit more complicated but possible to do with the information and examples I've given. For organization's sake, I believe it's better to have each separate menu as a separate task and to end each task as the player leaves that particular menu. It saves a lot of headache to do it that way instead of stuffing the whole menu system inside a single task (like I did my first time). Don't forget to update the location variable every time so that your menu drawing functions know what to draw.
As for stage transitions, just make a task that covers the screen with an effect object and draws whatever text you want on it while loading the textures and sounds for the next stage. After a while, make it wait until the player presses the shot key and fade the effect away and start the next stage task.
-
sooooo...as I remember before the danmakufu request thread expired, I remember someone requesting a yukari and yuyuko. there is already a yukari and reimu border team script and there isn't a yuyuko solo one so I decided to make one. and then I was visiting the player script tutorial that Stuffman made and I made yuyuko but there was an error
http://pastebin.com/zNnurp8G
-
Your spritesheet seems to be called img_yuyuko, not img_sprite.
-
sooooo...as I remember before the danmakufu request thread expired, I remember someone requesting a yukari and yuyuko. there is already a yukari and reimu border team script and there isn't a yuyuko solo one so I decided to make one. and then I was visiting the player script tutorial that Stuffman made and I made yuyuko but there was an error
Massive code that probably should've been pastebin'd
But and kept getting an error saying that this part was wrong:
ObjEffect_SetTexture(objoption,img_sprite);
ObjEffect_SetRenderState(objoption,ALPHA);
Also, Obj_SetAlpha doesn't work for for effect objects. You need to use ObjEffect_SetVertexColor(id, vertex, red, green, blue, alpha) after creating the vertices in order to change the alpha.
-
This one is killing me:
First I have this:
let arraysize=GetCommonDataDefault("SpellcardData",[0]);
loop(10){
arraysize=arraysize~[0];
SetCommonData("SpellcardData",arraysize);
}
Which is all okay and working.
It's an array that is supposed to keep track which spellcard has been cleared on which difficulty.
But then I do this:
if(GetCommonData("SpellcardData"[spellcardnumber])<spellcarddifficulty){
SetCommonData("SpellcardData"[spellcardnumber],4);
}
And it errors when it tries to compare the value of the array (spellcardnumber, which I set to 1 for testing) with a normal variable (spellcarddifficulty, an integer which ranges from 1-4).
How can I fix this?
-
"SpellcardData"[spellcardnumber] will give you characters of the string "SpellcardData", and then it will get that commondata, and etc you get the picture.
if(GetCommonData("SpellcardData")[spellcardnumber]<spellcarddifficulty){
is what you want, but you can't actually set individual indices of an array stored as commondata. You have to give it the entire array, which means you have to edit the index of a global array first, and then hand it to the commondata (as you did in your first snippet).
-
"SpellcardData"[spellcardnumber] will give you characters of the string "SpellcardData", and then it will get that commondata, and etc you get the picture.
if(GetCommonData("SpellcardData")[spellcardnumber]<spellcarddifficulty){
is what you want, but you can't actually set individual indices of an array stored as commondata. You have to give it the entire array, which means you have to edit the index of a global array first, and then hand it to the commondata (as you did in your first snippet).
Now it's no longer crashing, which is good. But I'm a little confused about the last part.
Since this spellcard is cleared, I want to change my CommonData from [0,0,0,0,0... to [0,3,0,0,0... (since it's spellcard 2 and it's cleared on Hard).
You just told me to, but I don't understand how I could match this together with the piece of code that creates the CommonData in the beginning.
All I can think of is this:
SetCommonData("SpellcardData"[spellcardnumber],spellcarddifficulty);But that's wrong.
-
I don't mean to be mean or anything, but I'm surprised yet again by how far you've gotten in your game despite the fact that you lack the knowledge of a lot of important computer science concepts.
Anyways, Drake said you cannot set the value of something directly inside an array if it's still stored in common data. Therefore, you have to take out the array, change it, and then pass in the whole array back to the SetCommonData. In code it looks like this:
let spellcardData = GetCommonData("SpellcardData");
spellcardData[1] = 3;
SetCommonData("SpellcardData", spellcardData);
-
I don't mean to be mean or anything, but I'm surprised yet again by how far you've gotten in your game despite the fact that you lack the knowledge of a lot of important computer science concepts.
:V
That's because I had 0 knowledge of such things even before I started! Ohohoho! (Blame Kanako for getting me into Danmakufu)
Though, Danmakufu doesn't need to get too complicated, most of the time, to make nice things in it. Luckily that has already been taken care of by the programmer of Danmakufu.
Anyway, thanks, that worked. Even though my code is everyone's nightmare, this should really be everything I need to know, unless I come up with more genious customization ideas...
After all, I keep learning new things and improvements as I go.
-
Common Data Ex problem
On a stage init, I have that to get the High Score, stored in a Score.dat
LoadCommonDataEx("Top_Score",GCSD~"PROJET\DATA\Score.dat");
if(!IsCommonDataAreaExists("Top_Score")){
CreateCommonDataArea("Top_Score");
SetCommonDataEx("Top_Score","MaxScore",200);
}
@MainLoop {
SaveCommonDataEx("Top_Score", GCSD~"PROJET\DATA\Score.dat"); //laggy, but for demo purpose.
}
Normally, it would get the category in the file, and if it doesn't exist, create it
However, it seems that it reset every time (at 200).
-
I've tried playing around with saving and loading common data with the Ex functions but with no real success. Have you gotten ex common data to save and load correctly before? If not, I suggest to just store the stuff you want saved in normal common data and use the ex functions to handle the common data that doesn't need to be saved (like intercommunication between scripts). Stuff stored with the ex functions won't be saved with the normal SaveCommonData function.
If you insist on using the ex functions, just keep playing around with it. Post discoveries and such 'cause I'm curious too. One suggestion I can think of is to create the common data area first before attempting to load. Perhaps Danmakufu needs a common data area to stick the data into and doesn't load the data if it can't find the area you specified.
-
Okay, so I just met a problem while messing with effect objects.
http://pastebin.com/rEBTW833 (http://pastebin.com/rEBTW833)
I'm trying to get this in the shape of a star. I have a picture file of a star shape, and that worked fine before, but the stars are supposed to spin, and I didn't like how it looked like they weren't centered, so I figured I'd try to mess with the number and positioning of the vertices to get the shape. Surprisingly, I actually got it on my first try. There's just one problem: for some reason, there's two points (it looks to be vertices 0, 2, and 8, top left and top right if you remove the "+rotangle" stuff) where there's a blob outside the star shape, as if it's trying to connect those vertices, for some reason. It doesn't really make much sense to me, since all the other vertices are working just fine. Could it be because of the values I gave for the UV stuff? I don't really know how I'd match those up "correctly" without using a power of four for the amount of vertices... I'd appreciate any help.
EDIT:
http://i244.photobucket.com/albums/gg13/MatthewPZC/snapshot023b.jpg (http://i244.photobucket.com/albums/gg13/MatthewPZC/snapshot023b.jpg) this is what I'm talking about
-
Well, you're really doing things the hard way, so there isn't that much I can do to help you. What I'd do is use objxpos and objypos as parameters for Obj_SetPosition, leave the XY vertices alone, and use ObjEffect_SetAngle. Then again, I'd also use four vertices, so...
I'm having a problem with common data. Relevant functions and subroutines: http://pastebin.com/ypmq5Ses
So BGD_Frame is used to draw the stage background. Oddly enough, selecting the stage works perfectly. It's the floor selection that's a problem. Door and Stairs each reset the player's location and, thanks to the structure of my task system, open a new wave of enemies. Upon ascending or descending Stairs, the common datum "floorNum" changes according to what I input for the function. That works, too; in the first new room, the background changes accordingly.
But when I go through a door on the new floor, it shows the background for the floor the player was just on. Id est, if I go from floor one to floor two and through another door, floor one's background shows. And if I go from floor two to floor one and through a door, floor two's background shows. What incredibly derpy thing could I be overlooking?
-
Well, you're really doing things the hard way, so there isn't that much I can do to help you. What I'd do is use objxpos and objypos as parameters for Obj_SetPosition, leave the XY vertices alone, and use ObjEffect_SetAngle. Then again, I'd also use four vertices, so...
Well, like I said, I'm using 10 just to ensure that the star rotates smoothly. I do NOT feel like spending hours, maybe days, trying to draw a star graphic that rotates perfectly so it looks the same no matter which of the points is pointing up. :/ Also, the objxpos/objypos stuff was taken from the player script tutorial. I've always done it like this...
EDIT: Agh, I figured it out. It's because of how the triangle fan works, so it's making triangles out of the top point and every other point on the star...ugh, how will I fix this without using too many vertices? I've already got it fixed, but it'll use 12 vertices... I've found a way to do 9, but I get the feeling that if I ever decide to try to put an actual texture on this, it'll look terrible...
-
I found this laser shot sheet somewhere. Then I realize that this is the laser sheet I've been looking for all over (the mini-lasers used at Shou's stage and Byakuren's 3rd spell)!
However, The problem is that I don't know how to use it in Danmakufu (or should I say, I don't know what to type in the shot.txt thingy). And also, I also like to use other shotsheets for spawning other bullets (Yuyuko Butterflies and other bullets, since I'm making a Yuyuko script), but doing so in the same script might cause a conflict in the bullet's image.
If anyone knows how to use 2 shotsheets in one script, or to include the lasersheet to the shotsheet, please do.
Please notify me if I'm violating any rules. ><
Here's the UFO laser image: http://i563.photobucket.com/albums/ss73/seannavarro_and_pikachu/etama9.png
And here's the shotsheet I'm using:
http://i563.photobucket.com/albums/ss73/seannavarro_and_pikachu/supershot.png
-
First, welcome to the forums and RikaNitori. Violation of rules, well. . . posting screens over 640x480 and/or 150kb is frowned up. So I fixed it this time for you.
About your question:
However, The problem is that I don't know how to use it in Danmakufu (or should I say, I don't know what to type in the shot.txt thingy).
As you said it yourself: You don't know how to use it.
I would advise you to first learn the tutorial about custom shotsheets. This simply makes you understand how those shotsheets (images which you posted), make sense and how they are used. What you want to do is possible, but requires the lasers to be put inside the image of the bullets (seeing there is enough space).
-
Yuyuko Butterflies and other bullets, since I'm making a Yuyuko script
Danmakufu has default bullets which you can use. and that including butterflies. check the bullets out here: http://en.touhouwiki.net/wiki/Touhou_Danmakufu:_Bullets
-
I'm having a problem with common data. Relevant functions and subroutines: http://pastebin.com/ypmq5Ses
So BGD_Frame is used to draw the stage background. Oddly enough, selecting the stage works perfectly. It's the floor selection that's a problem. Door and Stairs each reset the player's location and, thanks to the structure of my task system, open a new wave of enemies. Upon ascending or descending Stairs, the common datum "floorNum" changes according to what I input for the function. That works, too; in the first new room, the background changes accordingly.
But when I go through a door on the new floor, it shows the background for the floor the player was just on. Id est, if I go from floor one to floor two and through another door, floor one's background shows. And if I go from floor two to floor one and through a door, floor two's background shows. What incredibly derpy thing could I be overlooking?
I don't think there's enough info to debug this. What you have shown us doesn't really have any issues that I can see so the problem might be elsewhere.
-
NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO >_<
Well, at least I know where the problem isn't.
-
I'm trying to make a shot type with the 'options' or 'satelites' are spinning and the bullets are going in all directions, kinda like Reimu C's in SA, but are always spinning, not shooting where you last moved. is it possible, or am I just hoping for something impossible.
-
Been a long time since I've visited this place (or danmakufu, for that matter, so bear with me or don't, your choice).
I decided to start messing with danmakufu for the first time in months and still focusing on spell cards, so I am experimenting with object bullets some more. I had an idea after getting Yuyuko's graphic to function as a boss that involves setting up two different object bullets.
Idea: Fire a bunch of butterflies (obj/first object) randomly that soon come to a stop, have them change angle, then fire a ring of large bullets (obj2/second object). When collision detection is successfully performed between the two objects, the butterflies will begin to accelerate (like a wave [think of the Explosion[#, #, #, #] function] spreading outward and "reanimating" the butterflies).
Problem: The butterflies work fine, but I cannot figure out how to fire more than one obj2 bullet and have the code that permits the collision detection for obj1 at the same time.
E.X. 1:
script_enemy_main{
let count = 0;
let a = 0;
let s = 1;
let color = 223;
let reanimation = 0;
let obj2 = Obj_Create(OBJ_SHOT);
(then after @Finalize)
task reanimate(speed, angle) {
let obj = Obj_Create(OBJ_SHOT);
let a = rand(-5, 5);
let objreanimation = 0;
Obj_SetPosition(obj, GetX, GetY);
Obj_SetAngle(obj, angle);
Obj_SetSpeed(obj, speed);
ObjShot_SetGraphic(obj, 208);
ObjShot_SetDelay(obj, 5);
ObjShot_SetBombResist(obj, true);
Obj_SetCollisionToObject(obj, true);
Obj_SetCollisionToPlayer(obj, true);
Obj_SetAlpha(obj, 255);
while(Obj_BeDeleted(obj)==false){
let objspeed=Obj_GetSpeed(obj);
if(objspeed > 0){Obj_SetSpeed(obj, objspeed - 0.05);}
if(objspeed < 0){Obj_SetSpeed(obj, 0);}
if(reanimation == 1){
Obj_SetAngle(obj, Obj_GetAngle(obj) + a);
}
if(Collision_Obj_Obj(obj, obj2)){
objreanimation = 2;
}
if(objreanimation == 2 && objspeed < 2){
ObjShot_SetGraphic(obj, 209);
Obj_SetSpeed(obj, objspeed + 0.005);
}
yield;
}
}
task reanimateshot(speed, angle) {
let obj2 = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj2, GetX, GetY);
Obj_SetAngle(obj2, angle);
Obj_SetSpeed(obj2, speed);
ObjShot_SetGraphic(obj2, 236);
ObjShot_SetDelay(obj2, 5);
ObjShot_SetBombResist(obj2, true);
Obj_SetCollisionToObject(obj2, true);
Obj_SetCollisionToPlayer(obj2, false);
Obj_SetAlpha(obj2, 255);
while(Obj_BeDeleted(obj2)==false){
yield;
}
}
I have learned that adding let obj2 = Obj_Create(OBJ_SHOT); into the actual object's task (in this case, reanimateshot) just overwrites the original let obj2 = Obj_Create(OBJ_SHOT);. This lets the script continue normally, but the object collision between obj and obj2 does not happen because obj2 is redefined in its own task and no longer associated with obj1. This is fine, but then I try this:
E.X. 2:
let obj2 = Obj_Create(OBJ_SHOT);
(then after @Finalize)
task reanimateshot(speed, angle) {
Obj_SetPosition(obj2, GetX, GetY);
Obj_SetAngle(obj2, angle);
Obj_SetSpeed(obj2, speed);
ObjShot_SetGraphic(obj2, 236);
ObjShot_SetDelay(obj2, 5);
ObjShot_SetBombResist(obj2, true);
Obj_SetCollisionToObject(obj2, true);
Obj_SetCollisionToPlayer(obj2, false);
Obj_SetAlpha(obj2, 255);
while(Obj_BeDeleted(obj2)==false){
yield;
}
}
(then in the main task)
if(count == 360){
a = rand(0, 360);
loop(20){
reanimateshot(3, a);
a += 360/20;
}
}
So the task [reanimate] now recognizes obj2 properly which is half of what I want. The other half of the problem still unsolved is that obj2 does not loop more than once (the complete opposite of the previous example), so rather than having twenty bubbles moving and activating all of the butterflies, there is only one bubble that activates a single line of butterflies. How can I loop obj2 so that the twenty bubbles that I want all appear while retaining the collision detection with obj1? I do not want to end up having to create twenty separate object bullets (x20 more lines) just to complete that ring of bubbles and trigger the collision detection at the same time. It is probably right under my nose, but isn't there a simpler way to do it?
-
@Initialize
{
ascent(i in 0..4){Option(i*90);}
}
task Option(a)
{
yield;
let obj = Obj_Create(OBJ_EFFECT);
let x = GetPlayerX;
let y = GetPlayerY;
let r = 0;
blahblahblah; //Effect object stuff, you should know how to do this
loop{
x = (GetPlayerX+x*19)/20; //Gives option position a little "lag"
y = (GetPlayerY+y*19)/20;
a += 5; //Makes them spin
if(GetKeyState(VK_SLOWMOVE)==KEY_HOLD && r > 32){r--;} //Move the options in or out based on if focusing or not
if(GetKeyState(VK_SLOWMOVE)==KEY_FREE && r < 48){r++;}
Obj_SetPosition(obj, x+cos(a)*r, y+sin(a)*r); //Set option position
//Place the shot firing code here, and use 'a' as the angle
yield;
}
}
Typed this all right here, so some probably made a stupid error in there somewhere. Make sure you've got a yield; in @MainLoop as well.
-
Why not make an array of object bullets, and then ascent through it to check for collisions with each bullet? It's pretty tedious to code though, so if you can't figure it out, I'll look through my code for an example...
-
Just set for the butterflies to move at a certain time or when the wave bullets get to a certain radius from the boss. No need to perform collision checks as far as I can tell...
-
I made my yuyuko player but it turns out into a fail. I'm a failure. :fail:
download here and you'll know what I did: http://www.mediafire.com/?th4vtf73qhabf9q
-
I'm trying to make a shot type with the 'options' or 'satelites' are spinning and the bullets are going in all directions, kinda like Reimu C's in SA, but are always spinning, not shooting where you last moved. is it possible, or am I just hoping for something impossible.
If you're describing what I think you're describing, your idea is much easier than Reimu C. Why wouldn't it be possible? What's so code-breaking about it?
-
I made my yuyuko player but it turns out into a fail. I'm a failure. :fail:
download here and you'll know what I did: http://www.mediafire.com/?th4vtf73qhabf9q
Misplaced graphic rectangle. ;P Look up SetGraphicRect on the wiki.
And, yanno, add shots, a hitbox...
-
If it's Touhou, it's possible.
Let's see what's so bad, atfyntify
Oh, and Supreme Gamesmaster - stop randomly adding nonsense words into your sentences.
-
What do you mean nonsense words? It's yanno, you know?
Oh, and I fixed my earlier problem -- I forgot to check if the player was actually taking the stairs, so when the screen reset to accommodate the new room, the game would think the floor should change whether the stairs were used or not. :derp: Let this be a lesson to all who do such things (read: me).
-
How can you extract the files out of danmakufu's DAT files? I want to take a look at them, but I don't really have a way of doing so.
-
How can you extract the files out of danmakufu's DAT files? I want to take a look at them, but I don't really have a way of doing so.
Lymia released a Danmakufu DAT de-archiver. (http://www.shrinemaiden.org/forum/index.php/topic,4731.0.html)
-
Does anybody happens to have the config.txt of the "Embodiment of Scarlet Hair" script? No matter how many times I try it, I can't play it.
-
Does anybody happens to have the config.txt of the "Embodiment of Scarlet Hair" script? No matter how many times I try it, I can't play it.
I think you need to open the game with Applocale
http://www.shrinemaiden.org/forum/index.php/topic,4138.0.html
Why can't my Applocale play mp3. music :wat:
-
I have applocale installed, but when I run the script, it throws me an error and says that "config.txt" is missing.
---------------------------
ScriptError
---------------------------
#include_functionで置換するファイル[C:\Documents and Settings\ana.A\Mis documentos\Downloads\Danmakufu\th_dnh\script\output\config.txt]が見つかりません
---------------------------
Aceptar
---------------------------
-
How do you map keys to equal certain functions? Like, when I press "F" I want something to happen.
-
How do you map keys to equal certain functions? Like, when I press "F" I want something to happen.
Currently not possible to do. Maybe in ScriptVersion[3] whenever the hell that comes out. For now, you're stuck with only up, down, left, right, shift, z, x, c, and ctrl.
-
Dang. Well, that just ruined plans I had. >:I
-
I can't see where is this problem, is a "Script_main_error" or whatever is called, but all the braces match from what I can see
http://pastebin.com/fMKHN6d7
-
Okay... i?m trying to make my own shotsheet and have gotten a bit far. But the graphics look so ugly and sharp ingame, why is that? Also, i?m using the regular paint, am i supposed to be using a better program?
Heres the shotsheet: http://www.mediafire.com/?pzro6dt9c67rkgx (http://www.mediafire.com/?pzro6dt9c67rkgx)
EDIT: changed the link.
-
pastebin or I'll eat your soul
The error is at the very top - where it says "script_enemy main", it should be "script_enemy_main". Without that, it doesn't work whatsoever.
-
let ImgBoss = CSD ~ "\Pic\Jack.png"; should be inside script_enemy_main. I'm pretty sure you can't start functions, variables or any other memory reference with numbers (such as your 01).
Not sure how you even got to this point, though. Did you just script the entire thing without testing, or what?
Okay... i?m trying to make my own shotsheet and have gotten a bit far. But the graphics look so ugly and sharp ingame, why is that? Also, i?m using the regular paint, am i supposed to be using a better program?
Heres the shotsheet: http://www.mediafire.com/?i58n1c6mtay3y9y (http://www.mediafire.com/?i58n1c6mtay3y9y)
I haven't taken a look yet, but when you ask questions like these please provide a screenshot.
-
WHEN POSTING LARGE BLOCKS OF CODE, PLEASE USE PASTEBIN.COM (http://www.pastebin.com)
-
GG HELEPOLIS
-
I totally forgot to about pastebin, it won?t happen again.
someone call Keine to erase "that" history
-
I haven't taken a look yet, but when you ask questions like these please provide a screenshot.
okay here's a screenshot of it: (http://img651.imageshack.us/img651/3263/shotsheet.jpg)
Also, i updated the link in the last post. Nothing changed but the name of the folder.
EDIT: changed picture due to my laziness of not reading through the rules carefully. Bear with me.
Or see the first here: http://img863.imageshack.us/img863/3884/shotsheet.png (http://img863.imageshack.us/img863/3884/shotsheet.png)
-
Is it possible to loop songs with an intro? Like, the song plays the intro, but when it loops, it doesn't go back to it.
-
Make two separate music files (intro and loop) or make one really long music file that includes an actual clean loop, that's pretty much it.
-
I'm trying to run LibTest from the animation library folder. I make no adjustments, and I get the following error:
(http://img576.imageshack.us/img576/6703/awwerwae.png)
I figure it means something like file does not exist, but I triple-checked and it lines up correctly in the code.
-
So how exactly are we supposed to help you without any other information. Gotta post something besides the error!
However that is the generic error for "cannot find file" as you thought, yes.
-
Sorry! I just wanted to make sure that's the error I was getting first. The following is part of the LibTest.dnh and it's contained in my Scripts folder. The two images are also in the same location.
script_enemy_main {
#include_function ".\AnimationLib.dnh"
let imgNue = GetCurrentScriptDirectory ~ "Nue.png";
let imgNazrin = GetCurrentScriptDirectory ~ "Nazrin.png";
@Initialize {
SetLife(1);
SetY(120);
LoadGraphic(imgNue);
LoadGraphic(imgNazrin);
InitializeAnimationData;
Animate("nue", "idle", true);
Animate("nazrin", "idle", true);
ShowOffNueAnimation;
ShowOffNazrinAnimation;This is the only part that could possibly be affecting the error, unless it doesn't have to do with the script itself.
EDIT: Seemed to auto-fixed itself. All I had to do was reboot the computer. :derp:
-
Hi
I'm having a little problem with my simple code that is using a task.
Now, the boss shoot bullets and when those bullets touch the border of the screen, they explode into a circle of other bullets.
You see, that's simple, but something wrong happen : they only explode when they touch the bottom border of the screen.
This is my code
http://pastebin.com/Amq8j5qX
If someone can test my code and tell me what my problem is, it will be really but really appreciate
Thanks
-
Read stickies.
Move yield; out of if(frame==120) and into the main body of @MainLoop. You're going to have many bullets appearing.
-
I'm trying to run LibTest from the animation library folder. I make no adjustments, and I get the following error:
(http://img576.imageshack.us/img576/6703/awwerwae.png)
I figure it means something like file does not exist, but I triple-checked and it lines up correctly in the code.
I believe what happened is that you loaded the script, then maybe moved the folder containing the files to some other location and reloaded the script, causing Danmakufu to try to load a nonexistant file (because it's still looking for it in its original location).
Hi
I'm having a little problem with my simple code that is using a task.
Now, the boss shoot bullets and when those bullets touch the border of the screen, they explode into a circle of other bullets.
You see, that's simple, but something wrong happen : they only explode when they touch the bottom border of the screen.
This is my code
long code
}
If someone can test my code and tell me what my problem is, it will be really but really appreciate
Thanks
WHEN POSTING LARGE BLOCKS OF CODE, PLEASE USE PASTEBIN.COM (http://www.pastebin.com)
You should probably also read the information thread stickied at the top because it has rules you should be following and tutorials you can look at to help troubleshoot your stuff. For now, do what Naut said and move the yield out of the if block so that it runs every frame instead of every 120 frames. Your bullet task logic looks okay to do what you want except for one thing: you aren't deleting the bullet after it explodes so each bullet is going to explode every frame after they leave the screen. The bullets dont auto delete until they're at least 64 pixels outside of the playing field.
-
He originally posted it in its own thread, which got merged to this one.
-
He originally posted it in its own thread, which got merged to this one.
Still no excuse for not reading the rules, because that should have never happened.
I need to talk with TSO to see if I we can implement some popup for newbie members entering the garage.
-
This list thing I found today might help a lot of people :V
http://en.touhouwiki.net/wiki/Touhou_Danmakufu:_Functions
-
This list thing I found today might help a lot of people :V
http://en.touhouwiki.net/wiki/Touhou_Danmakufu:_Functions
http://dmf.shrinemaiden.org/wiki/index.php?title=Functions :wat:
-
Hi
I'm having a little problem with my simple code that is using a task.
Now, the boss shoot bullets and when those bullets touch the border of the screen, they explode into a circle of other bullets.
You see, that's simple, but something wrong happen : they only explode when they touch the bottom border of the screen.
This is my code
http://pastebin.com/Amq8j5qX
If someone can test my code and tell me what my problem is, it will be really but really appreciate
Thanks
The problem is that your yield is in the if(frame==120){space;. This means that the bullet only "activates" once per 120 frames. Instead put the yield; in the beginning or the end of the mainloop. Lol i was too slow already fixed.
Then just put Obj_Delete(obj); in the loop(nb) parts of the bullet task if you don't want massive circles.
-
This list thing I found today might help a lot of people :V
Read stickies.
-
http://www.mediafire.com/download.php?gg19aam5c4986xd
So, uh, I'm pretty new at arrays.
I'm trying to get bullets to bounce off of lasers, and it works sometimes... But bullets often bounce once, then pass other lasers before bouncing again.
-
Thanks a lot for the help guys, it worked!! :)
you just make my day!!
-
I have got little
impossible request:
Could somebody explain how to make custom score/graze/something else counter and bars?
-
I have got little impossible request:
Could somebody explain how to make custom score/graze/something else counter and bars?
First you need to know how to use effect objects. If you already know how, then great! Otherwise, you can try reading the Effect Object Tutorial (http://www.touhouwiki.net/wiki/Touhou_Danmakufu:_Nuclear_Cheese%27s_Effect_Object_Tutorial). It's one of the more difficult concepts in Danmakufu to understand so it might take a few read-throughs, experimentation, and a good chunk of time to understand fully.
After you learn effect objects, all you need to do is draw things on layer 8 over on the side after using SetRateScoreSystemEnable(false); to turn off the default scoring system and SetDefaultStatusVisible(false); to turn off the default counters. This is a pretty difficult subject so feel free to ask more questions on this thread as you learn.
-
Well... I tried do that, but this is too difficult. There is code script:
task ScoreNumber(x,y){
let numberarray=[];
let number0= Obj_Create(OBJ_EFFECT);
let number1 = Obj_Create(OBJ_EFFECT);
let number2 = Obj_Create(OBJ_EFFECT);
let number3 = Obj_Create(OBJ_EFFECT);
let number4 = Obj_Create(OBJ_EFFECT);
let number5 = Obj_Create(OBJ_EFFECT);
let number6 = Obj_Create(OBJ_EFFECT);
let number7 = Obj_Create(OBJ_EFFECT);
let number8 = Obj_Create(OBJ_EFFECT);
let number9 = Obj_Create(OBJ_EFFECT);
numberarray=numberarray~[number0];
numberarray=numberarray~[number1];
numberarray=numberarray~[number2];
numberarray=numberarray~[number3];
numberarray=numberarray~[number4];
numberarray=numberarray~[number5];
numberarray=numberarray~[number6];
numberarray=numberarray~[number7];
numberarray=numberarray~[number8];
numberarray=numberarray~[number9];
ascent(i in 1..10){
Obj_SetX(numberarray[i], x);
Obj_SetY(numberarray[i], y);
ObjEffect_SetTexture(numberarray[i], imgNumber);
ObjEffect_SetLayer(numberarray[i], 8);
ObjEffect_SetPrimitiveType(numberarray[i], PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(numberarray[i], 4);
ObjEffect_SetVertexUV(numberarray, 0, 0+16*numberarray[i], 0+16*numberarray[i]);
ObjEffect_SetVertexUV(numberarray, 1, 16+16*numberarray[i], 0+16*numberarray[i]);
ObjEffect_SetVertexUV(numberarray, 2, 16+16*numberarray[i], 16+16*numberarray[i]);
ObjEffect_SetVertexUV(numberarray, 3, 0+16*numberarray[i], 16+16*numberarray[i]);
ObjEffect_SetVertexXY(numberarray[i], 0, -8, -8);
ObjEffect_SetVertexXY(numberarray[i], 1, 8, -8);
ObjEffect_SetVertexXY(numberarray[i], 2, 8, 8);
ObjEffect_SetVertexXY(numberarray[i], 3, -8, 8);
}
yield;
}
I think it's completely bad. That why I asked.
After you learn effect objects, all you need to do is draw things on layer 8 over on the side after using SetRateScoreSystemEnable(false); to turn off the default scoring system and SetDefaultStatusVisible(false); to turn off the default counters
I have done it earlier.
-
Okay, well now that I have a more concrete idea of what you've been having trouble with, I can help more easily now. I'll try to write this in a tutorial kind of way instead of just giving you pure code in hopes that you learn instead of just coming here every time you need someone to write code for you. I'm also not testing the code as I write this so, lol.
First off, you need to create an effect object for each digit, so decide on how many digits you want to display first. For now, I'm going to go with the assumption that you want 10 digits with no decimal places.
task DisplayScore {
let digits = [];
loop(10){
digits = digits ~ [Obj_Create(OBJ_EFFECT)]; // Yes, this is allowed. :V
}
}
Now we need to make it set up all the initial values of the effects. They're all going to be the same except with different x values so I'll use an ascent for that.
task DisplayScore {
let digits = [];
loop(10){
digits = digits ~ [Obj_Create(OBJ_EFFECT)]; // Yes, this is allowed. :V
}
ascent(i in 0..10){
let obj = digits[i]
Obj_SetPosition(obj, GetClipMaxX+32+16*i, GetClipMinY+32); // I don't know if this is a good position or not. Fiddle around with it for a bit.
ObjEffect_SetTexture(obj, imgNumber); // Make sure imgNumber is actually defined and that you loaded it.
ObjEffect_SetLayer(obj, 8); // The rest of this is copied from your post.
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetVertexXY(obj, 0, -8, -8);
ObjEffect_SetVertexXY(obj, 1, 8, -8);
ObjEffect_SetVertexXY(obj, 2, 8, 8);
ObjEffect_SetVertexXY(obj, 3, -8, 8);
}
}
That's it for the initial set up of the effects. You might have noticed that I didn't set the UV vertices yet. That's because those need to change every time the score changes. We'll handle that in the loop in the task. However, first we need to get the score in a way where we can easily tell what each digit is, this isn't directly related to displaying the score, and since you might need to format other things that need to be displayed on the side screen, let's make a function for that.
function FormatNumberString(number, digits){
// number is the number you want to format, and digits is the number of digits you want to display
// In the case of the example score counter I'm building right now, I'd use FunctionNumberString(GetScore, 10);
let str = ToString(number);
loop(7){
str = erase(str, length(str)-1); // Erase the last 7 characters of the string because those are the decimals and the decimal point.
}
while(length(str) < digits){
str = "0" ~ str; // If the string is shorter than the amount of digits wanted, add some 0s in the beginning.
}
while(length(str) > digits){
str = erase(str, length(str)-1); // If the string is longer than the amount of digits wanted, remove the digits on the end until it fits. This is how ZUN actually handles this.
}
return str;
}
We can now use this function to get a string with digits that match up with the number of effects. The beauty about a string is that it behaves like an array of characters too, so you can do string[0] and it will give you the first character of the string. We can use this to our advantage to look at every digit in a number after converting it into a string like I just did with this function. Now let's get the basic logic out for updating the effects in the score counter.
task DisplayScore {
yield; // Yielding in the beginning because you can't create effect objects in @Initialize, yet I was expecting this task to be called in there.
let digits = [];
loop(10){
digits = digits ~ [Obj_Create(OBJ_EFFECT)]; // Yes, this is allowed. :V
}
ascent(i in 0..10){
let obj = digits[i];
Obj_SetPosition(obj, GetClipMaxX+32+16*i, GetClipMinY+32); // I don't know if this is a good position or not. Fiddle around with it for a bit.
ObjEffect_SetTexture(obj, imgNumber); // Make sure imgNumber is actually defined and that you loaded it.
ObjEffect_SetLayer(obj, 8); // The rest of this is copied from your post.
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetVertexXY(obj, 0, -8, -8);
ObjEffect_SetVertexXY(obj, 1, 8, -8);
ObjEffect_SetVertexXY(obj, 2, 8, 8);
ObjEffect_SetVertexXY(obj, 3, -8, 8);
}
loop {
let score = FormatNumberString(GetScore, 10); // The function I just wrote earlier.
ascent(i in 0..10){
let obj = digits[i];
let number = score[i]-48; // I'm exploiting a strange quirk of Danmakufu here. I'll explain it after this code block. All you need to know for now is that I'm changing the character into a number.
let offset = number*16;
ObjEffect_SetVertexUV(obj, 0, 0+offset, 0); // Add the offset to the x value of all the vertices.
ObjEffect_SetVertexUV(obj, 1, 16+offset, 0); // It wasn't necessary to add it to the y values as you did in the code in your post.
ObjEffect_SetVertexUV(obj, 2, 16+offset, 16);
ObjEffect_SetVertexUV(obj, 3, 0+offset, 16);
}
yield; // Don't forget the yield in @MainLoop either!
}
}
If you looked at the code, you'll definitely have noticed this line: let number = score[i]-48;. This is an exploitation of how Danmakufu stores characters. Let's say, for example, that score was the string "0123456789". In this case, score[0] will return the character '0' (notice the single quotes instead of double... that is how Danmakufu differentiates between strings and characters). However if you attempt to do a mathematical operation on a character, Danmakufu will turn it into its ascii value and use that in the mathematical operation. The ascii values for the characters '0' through '9' are stored as 48 through 57. Therefore, if you subtract 48 from the ascii value of a number's character, it will become the numerical equivalent.
Anyways, so what we have here should be a working score counter now (except for any silly errors I made :V). At this point, you can stop, but there actually are ways to optimize this. If you're interested in the optimization methods I'm thinking of, just let me know, but they probably aren't necessary.
-
Thank you very much. It works.
-
How do you get a #BackGround similar effect with @BackGround? What i mean is that I'm trying to make a spellcard-background that scrolls upward, but i can't get it to work right :ohdear:.
EDIT: Naut you're a freaking genius!
-
let y = 0;
@BackGround{
SetTexture("texture");
SetGraphicRect(0, 0 - y, 512, 512 - y);
DrawGraphic(GetCenterX, GetCenterY);
y++;
}
-
let y = 0;
@BackGround{
SetTexture("texture");
SetGraphicRect(0, 0 - y, 512, 512 - y);
DrawGraphic(GetCenterX, GetCenterY);
y++;
}
/me slaps Naut for putting logic inside a drawing loop.
-
Hi
Can someone tell me all the properties and function that we can use in an object in a task?
Because I want to know if we can change the width and height of a bullet in a task.
Thank you
-
http://dmf.shrinemaiden.org/wiki/index.php?title=Functions#Object_Control_Functions
-
Thank you so much, I didn't think that a page like that exist
It will help me a lot when I'm coding
Thanks again
-
Thank you so much, I didn't think that a page like that exist
It will help me a lot when I'm coding
Thanks again
Read stickies.
How many times.....
-
Posting again because my last post was drowned out by other posts.
I'm new to arrays. I wanted bullets to bounce off of lasers. This works about a third of the time. It will usually bounce once, pass one or two other lasers, then bounce off another, but I want it to be trapped between two lasers.
http://pastebin.com/4SkqwZbD
Any help?
-
I'm pretty sure you have your arrays correct but your bouncing logic incorrect. Changing the angle to 360-ang will only work correctly for bouncing off of horizontal lasers. You need to check the angle of the laser the bullet is bouncing off of and use some sort of math formula to get the new angle.
-
Even if I make all the lasers perfectly horizontal, many of the bullets still pass through them easily :/
I don't think it's hitbox detection either, because the same problem still occurs with 50-width lasers.
EDIT: Fixed!
-
Super-noob question, how am i supposed to use Iryan's GetLineBorderPoint function (when creating bullets)?
Function link - http://www.shrinemaiden.org/forum/index.php/topic,5164.60.html (http://www.shrinemaiden.org/forum/index.php/topic,5164.60.html)
-
Super-noob question, how am i supposed to use Iryan's GetLineBorderPoint function (when creating bullets)?
Function link - http://www.shrinemaiden.org/forum/index.php/topic,5164.60.html (http://www.shrinemaiden.org/forum/index.php/topic,5164.60.html)
I assume you want to make a laser that spawns bullets wherever it touches the playing field (as that is the main use for this function), yes?
What the function does is you put in the coordinates of the line base and the coordinates of a point it is directed towards, then it returns you the coordinates of where that line crosses the playing field. It returns it in form of an array with two values, [x, y].
The easiest way to handle this would be to create an array at the beginning of the script which you use for short-time storage of these coordinates. You can then call my function to store the values in that array and use the array directly as the parameters in your CreateShot functions.
Let's say the array is named "temparray". You would use the function like this:
temparray=GetLineBorderPoint(px, py, tx, ty);
CreateShotA(1, temparray[0], temparray[1], delay);
I hope this was helpful... :derp:
Edit: Derp, making typing mistakes from not having coded in a long while. :derp:
-
I assume you want to make a laser that spawns bullets wherever it touches the playing field (as that is the main use for this function), yes?
What the function does is you put in the coordinates of the line base and the coordinates of a point it is directed towards, then it returns you the coordinates of where that line crosses the playing field. It returns it in form of an array with two values, [x, y].
The easiest way to handle this would be to create an array at the beginning of the script which you use for short-time storage of these coordinates. You can then call my function to store the values in that array and use the array directly as the parameters in your CreateShot functions.
Let's say the array is named "temparray". You would use the function like this:
temparray=GetLineBorderPoint(px, py, tx, ty);
CreateShotA(1, temparray[0], temparray[1], delay);
I hope this was helpful... :derp:
Edit: Derp, making typing mistakes from not having coded in a long while. :derp:
This made my day. It actually works, even though i suck at arrays :P. Here's what i was trying to do http://pastebin.com/zUwk2Cqb (http://pastebin.com/zUwk2Cqb)
-
Well, I'm a recent user of Danmakufu (I've had it for two days.) :V Anyway. I keep getting horrific errors that won't go away. Ever. And if hey do go away, the code dosn't do anything.
So, here it is. Possible epic failure ahead.
#TouhouDanmakufu
#Title[Spawning Bullets in a Circle]
#Text[Using loop to spawn bullets in a circular pattern.]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
let imgExRumia="script\ExRumia\img\ExRumia.png";
let frame = 0;
let angle = 0;
let speedvar = 40;
@Initialize {
SetLife(1500);
SetTimer(60);
SetInvincibility(30);
LoadGraphic(imgExRumia); //Load the boss graphic.
SetMovePosition02(GetCenterX, GetCenterY - 100, 120);
}
@MainLoop{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
if(frame==120){
loop(36)
CreateShot01(GetX + 60*cos(angle), GetY + 60*sin(angle), 3, angle, WHITE22, 12);
angle += 360/36;
angle += 4;
speedvar += 5;
}
let frame = speedvar;
frame++
}
@DrawLoop{
//All this foolishness pertains to drawing the boss. Ignore everything in @Drawloop unless you have read and understand Nuclear Cheese's Drawing Tutorial.
SetColor(255,255,255);
SetRenderState(ALPHA);
SetTexture(imgExRumia);
SetGraphicRect(64,1,127,64);
DrawGraphic(GetX,GetY);
}
@Finalize
{
DeleteGraphic(imgExRumia);
}
}
So yeah, I did see the tutorials and I... didn't really get anything that helped aside from what terms to use, I didn't really find a solution. My error message is weird,
---------------------------
ScriptError「C:\Users\Power One\Desktop\th_dnh\th_dnh\script\Loop1-Tutorial(Refuses to work).txt」
---------------------------
一回も代入していない変数を使おうとしました(26行目)
↓
if(frame==120){
loop(36) {
CreateShot01(GetX + 60*cos(angle), GetY + 60*sin(angle), 3, angle, WHITE22, 12);
angle
~~~
---------------------------
OK
---------------------------
and I have no clue what it means. Moving brackets didn't help. Basically what I want is for the boss to fire circular shots progressively faster and faster.
There's also an intentional logic failure, when frame gets too fast and starts at 120+. I think I put the greater than, but that may have glitched up too. I'm officially stuck, and need some help from people who have done Danmakufu before.
Also, hi people, I'm new here.
-
You forgot to put { after loop(36) and } after angle+=360/36;. Loops need to be contained in curly brackets, too
-
In addition, frame++ needs a semicolon at the end.
Next time, don't spoiler your code either. You should host large excerpts at pastebin.com.
-
Tsuchigumo...?? Are you who I think you are?
Ah well. Requesting merge or lock - this guy clearly didn't read the sticky - that popup better be possible soon.
-
Game still hates me, and returns Wait, which sticky?
---------------------------
ScriptError「C:\Users\Power One\Desktop\th_dnh\th_dnh\script\Loop1-Tutorial(Refuses to work).txt」
---------------------------
一回も代入していない変数を使おうとしました(26行目)
↓
if(frame==120){
loop(36){
CreateShot01(GetX + 60*cos(angle), GetY + 60*sin(angle), 3, angle, WHITE22, 12);
angle +
~~~
---------------------------
OK
---------------------------
... Isn't that the same thing?
Anyway, brackets and lone semicolon addition didn't seem to do anything. The code seems really finicky. Trying to build another that spreads, but for some reason the @Initilization { line errors. It wants a semicolon somewhere, I think, so I'll hunt it down later.
But yeah, no dice. And yes, I am who you think I am. More than likely.
Also, lets say the code is to work. I think I noticed that because the loop dosen't hit, it will set frame to 40, add one, then set it back over and over. Guess I need to re-arrange some things.
-
Wait, which sticky?
READ THEM ALL.
-
Oh crap, not good. I already angered someone in a higher position than me on the totem pole.
Ok, well, what I meant was if there was something I missed or accidentally passed over.
Most of that code is an amalgam of tutorial code anyway. Even so, I can't stop getting random errors. I have ONE working code that was a PAIN to code. (This was before I knew that math could create circles.) So, I need lots of help. Even reading the beginner tutorial (Which is a lifesaver, BTW) over and over is not pounding it in. Code + Me usually = The game explodes, but still.
Something tells me I have a long, long road ahead of me.
At least I'm getting a new error.
---------------------------
ScriptError「C:\Users\Power One\Desktop\th_dnh\th_dnh\script\Loop1-Tutorial(Refuses to work).txt」
---------------------------
項として無効な式があります(26行目)
↓
if(frame>=:120){
loop(36){
CreateShot01(GetX + 60*cos(angle), GetY + 60*sin(angle), 3, angle, WHITE22, 12);
Didn't see that on translated errors, but it's, literally, a different language so I may have missed it too. I'm going to go sticky-reading now.
-
How can I switch Backgrounds in a Stage script?
Like in Stage 4 of PCB, that has multiple Backgrounds through all the stage.
-
Why is there a random colon in that line what are you doing take it out.
Assuming this is what you now have.
@MainLoop{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
if(frame==120){
loop(36){
CreateShot01(GetX + 60*cos(angle), GetY + 60*sin(angle), 3, angle, WHITE22, 12);
angle += 360/36;
}
angle += 4;
speedvar += 5;
}
let frame = speedvar;
frame++;
}
First of all, you should not be redefining frame every frame, and you should not be using let here either. This will give frame a value of 40, then it will increment, then it'll reset the next frame to 40 again and so on.
If frame did hit 120, after firing bullets and the angle increase, speedvar increases and then you assign it right away to frame. Why don't you just have frame increase faster or decrease the frames needed (120) or something if you want the bullets to fire faster? This is super roundabout and you don't even need the speedvar variable. And once again, even if it did go through the loop once, it would just have frame set to 45 every frame again.
What tutorial are you even following here, and what do you even want your final product to do?
-
Define another image and draw it like anything else...? Not too sure what you mean.
-
Just some general tips to avoid a lot of random errors. Whenever you have a loop, if, while, ascent, descent, function, sub, task, and probably some stuff I forgot, it will need curly braces. Put both the opening and the closing braces in before writing what goes inside them so that you don't forget them later. This is an important habit to have because it'll prevent you from having mismatched braces later. Same goes for functions and their parentheses and arrays with their square brackets. If you type an opening anything type the matching closing one immediately. Develop this habit and a lot of syntax errors will magically stop appearing in future things you write. Another common error is missing semicolons. If there's a missing semicolon, the error will actually point at the line after that, so always check the line before as well, just in case.
Lastly, don't get discouraged with the errors. If you read the beginner tutorial, you should have read that if you can't deal with errors, you shouldn't be a programmer. When writing stuff, the computer will yell at you and explode more times than it won't. Just keep at it and eventually you'll be able to know what's wrong just by glancing at the line the error tells you to look at.
Also, if you want faster answers, the irc channel (http://webchat.ppirc.net/?channels=danmakufu) is always available to answer your questions. It has some international people and a lot of them are good at Danmakufu so there's a good chance that someone that can answer your question might be awake to talk to you no matter what time it is.
-
Sounds like he's just having trouble getting the logic to change from one scene to another or something. Make a global variable called bgstate or something and make it hold a value. Change the value in the stage task and read it in the BackGround loop. If it's one value, draw the background one way, and if it's another value, draw it the other way.
-
Well, it worked, but now, I'm having a little issue, and is that the BG appears suddenly, and I don't know how to make it appear slowly from the center of the screen and expanding it .
Sorry if the above is too confusing...
-
Well, thanks guys (or girls, lets not offend anyone) for the help. I wasn't really following any tutorial, just shoving stuff together is a way that seemed logical. Looking at it again, I wonder just what I was thinking. The errors don't bug me, it's that when i get around code, I break stuff. Irreversibly.
Like, on EVERY ACTION REPLAY EV- Ok, back to topic. I'll try to increase frame addition every time, but I don't exactly know how to do anything aforementioned. I guess I'll figure it out though, since my learning style is to bash it till it works. Well, again, thanks for helping the resident newb. And, I don't exactly know how an irc works. Is it like a torrent, in the sence I need additional software to run it? Just wondering.
-
I wasn't really following any tutorial, just shoving stuff together is a way that seemed logical.
READ A TUTORIAL HOLY CRAP
I guess I'll figure it out though, since my learning style is to bash it till it works.
YOU DO NOT NEED TO GO THROUGH THIS THE WAY I DID :colonveeplusalpha:
And, I don't exactly know how an irc works. Is it like a torrent, in the sence I need additional software to run it? Just wondering.
You could just click the link in my last post, put in a nickname, and click connect.
Edit: Seriously, read the tutorials. If you're just going to bash on code and then ask for help on things that are already explained in a nicely documented tutorial, you're going to piss off some people. Also, spoiler tags on code = annoying and we have a Q&A thread for future questions if you don't feel like going on IRC. (inb4 merge with the Q&A thread anyway)
-
Well, it worked, but now, I'm having a little issue, and is that the BG appears suddenly, and I don't know how to make it appear slowly from the center of the screen and expanding it .
Sorry if the above is too confusing...
Make another variable that the @BackGround loop can read that counts upward and use that to slowly make things bigger.
-
Ah well. Requesting merge or lock
report posts
-
I'm back, this time with 35% less failure!
No, seriously. My shotgun danmaky finally came through, after giving up on the complicated circle thing.
But yeah, now I have more circular problems.
loop(24){
CreateShot02(GetX*cos(60), GetY*sin(60), 1, angle, -0.1, -3/1, BLUE12, 0);
angle += 360/24;
That's the general gist of it. When I use it, the bullets don't spawn even near the boss, and honestly, tinkering around didn't work too good. So, what I'm asking is...
I want bullets that spawn in a cirlce AWAY from the boss. Like, a 100px radius away. I have the acceleration part down, and an alternative to bullet rotation. One problem though-
Through all my time hunting through tutorials, I can't figure out how to get my bullets to spiral. My bullets, like me, apparently hate circles. I haven't had too many errors with this one, just the script written wrong.I'm kinda unsure of how to do it right. So, I came for help. Once I get the basics down, I should be able to take elements and get them together.
Also, I'm kind of uneducated. I haven't a clue what (sin) and (cos) even are, tangents included, except for one thing-
They involve the dreaded no-sided one.
So, I'm basically asking for this:
How to get bullets to spawn in a radius away from the boss but still centered on said boss
How to curve bullets in a uniform way to produce spirals
A crash course in circle logic (As in, what is a (sin), and what is a (cos)?
I can has cheeseburger? :derp:
Oh yeah. If I missed a tutorial with this in it, just give me that. Also, feel free to slap me if that's the case. :V
-
All you really need to know about sin and cos is that they're used for a circle. Cos returns the horizontal component of the angle, and sin returns the vertical component. In other words, cos(0) returns 1 and sin(0) returns 0, because angle 0 is directly right (full horizontal component, no vertical component). Cos(90) returns 1 and sin(90) returns 0, because 90 is straight down, which is all vertical and no horizontal, etc.
What you're looking for would be something like this:
CreateShot02(GetX+cos(angle)*60, GetY+sin(angle)*60, 1, angle, -0.1, -3/1, BLUE12, 0);
That would spawn the bullet 60 pixels away from the boss in the same direction that the bullet will travel (the angle variable). Play around with it until you get it - sin and cos are extremely useful. (For a nice exercise, try making it cos(angle+90) and sin(angle+90) instead to see what happens!)
As for spirals, you can use pretty much the exact same code, but put it in a task, and yield; after each shot. If you don't know what tasks are, look up that tutorial too, since they're very useful.
-
What exactly are effect objects? I've seen the tutorial on it and I've seen people use it in scripts, but I don't know what its exact function is.
-
Effect objects do what the name implies - they're effects. Most of the time, they're just used for visual effects, like explosions. You get much more control over an effect object than if you used DrawLoop, so for example, you can take an image that's just a line and make it into a spell circle, which can distort and wave. Or you can use it to draw on other layers than the default one that DrawLoop does, such as drawing an overlay across the entire screen (Mystia's darkness) or drawing something onto the frame.
-
I owe ya one. Thanks, and mabye soon I`ll upload the final code. 2 of the three elements are now ready to be placed in the code. Again, thanks!
-
Hullo,
How are the hitboxes for custom bullets determined ? When I create a bullet, I do specify a rectangle for the graphics, but not the hitbox. Can I specify it (how ?) or is it automatically calculated (then how?) ?
For example, how come the butterfly bullet hits at its center but not its wings ?
Thanks !
-
I don't think anyone knows exactly how the hitbox is determined, but it's definitely based off of the size of the graphic. If, for example you had a 16x16 pixel graphic for a bullet, the hitbox is probably something like 8x8 on the center. By this logic, if you wanted a larger hitbox but same graphic, you can add transparent space around the graphic and redefine the graphic rectangle to be 32x32 and it'll look the same but have a hitbox of 16x16. The hitbox isn't necessarily half the size of the graphic though as no one that I know of actually did any detailed tests about this.
If you really want to have control over the size of your bullet's hitbox, you can use shot scripts (http://dmf.shrinemaiden.org/wiki/index.php?title=Bullet_Script_Functions), but almost no one uses those and there aren't any tutorials on them. Another way is to use effect objects and the boss's SetCollisionB (http://dmf.shrinemaiden.org/wiki/index.php?title=Enemy_Script_Functions#SetCollisionB) function on the same position as the effect.
-
I estimate the automatic hitboxes are around 1/3 of the bullet's size. Someone should lab this though :V
-
Also note that the hitbox depends on whichever of the sides (height or width) is smaller. A 20x20 bullet has the same hitbox as a 20x40 bullet.
-
From my testing it eventually seems that the hitbox diameter is 60% (well it could be more precise but it'd seem arbitrary, eh ;) ) of the smaller side of the defining rectangle.
Thanks for your help !
-
Any advice on how much HP a Non-Spell must have? and a Spellcard?
-
Any advice on how much HP a Non-Spell must have? and a Spellcard?
That is extremely subjective and for everybody different. You might want to check out official games and see how ZUN does it.
"For example does using a bomb kill the non-card? Or does it leave some health? What about spell cards? What about the player type and shottype?"
Using this mindset, you set certain damage rate and life and test out if it feels 'good' to you. Remember, if someone is boring or too long for your own taste, it will most likely be to anybody else. The biggest foolish mistake people make with life/dmg rate is thinking: "Oh, to make it difficult, I'll just increase life / drop dmg rate".
As long as you don't make that foolish mistake, you are fine.
-
This is how I handle health and spell armor:
For nonspells, I usually give them 60 frames of invincibility, and 2000-4000 health, depending on how long the pattern takes to reach the player.
For spells, I give them 800-1400 health, but I use a task to make them start with SetDamageRate(10,10), and change to (50,50) after about 800 frames. This means they tend to have less variability in how long they last.
-
I don't know if this is suppose to be posted in this topic (sorry if it isn't) but doesn anyone know where I can get danmakufu fuujinroku MoF cutins? like these type of images: http://imageshack.us/photo/my-images/863/rumiacutin.png/
-
Using this mindset, you set certain damage rate and life and test out if it feels 'good' to you. Remember, if someone is boring or too long for your own taste, it will most likely be to anybody else. The biggest foolish mistake people make with life/dmg rate is thinking: "Oh, to make it difficult, I'll just increase life / drop dmg rate".
Another mistake that is even more common I would say, is that people love their patterns so much that they leave it with huge amounts of HP for the player to play it for a long time. It isn't always something that the programmer realizes, but really long noncards and spellcards are common even in full scripts. It isn't a difficulty thing, but probably more of "you have to witness the whole card!", and people try too hard to get the player to play it.
If I were to name an example from ZUN's work himself, I would nominate Shou. Her cards are very long. Not unnecessarily, but they are really long. In this case it's more of overall card design than elongation.
-
Random question: what is the main difference between tasks, functions and subs?
-
A function is a piece of code that you can basically shortcut to, and it accepts parameters. A very basic example:
@MainLoop{
NewShot(GetAngleToPlayer);
}
function NewShot(angle){
CreateShot01(GetX,GetY,3,angle,RED01,0);
}
Since NewShot is called with GetAngleToPlayer as the first parameter, that's where the shot will be fired. You can make the function as long as you want and with as many parameters as you want, so they can serve as a great shortcut. Functions can also return values, like this:
function BossAngleToPoint(x,y){
return atan2(y-GetY,x-GetX);
}
which would return the angle from the boss to point x,y, which you would call with, for example, BossToPoint(GetPlayerX,GetPlayerY) and it would return the same thing as GetAngleToPlayer (and would be used in the same way).
A sub is the exact same thing as a function, but it can't accept parameters and can't return values. Its only purpose is that it's slightly faster.
A task is also like a function, but it can be delayed for a frame with the yield; command (assuming there's also a yield; in MainLoop). It can't return values, though. It's the most powerful of the three, and lets you do lots of things that the others can't do easily. For examples, there's several tutorials on tasks, so I won't get into too much detail here.
-
I used to have a hard time understanding that stuff too. Here's my attempt at simplifying things.
Sub : Does one thing.
Like "Do the laundry for your dark clothes."
Function : Does one thing, with parameters.
"Do the laundry. Which type of clothing?"
Functions are useful because they can return results to your code. For example, if you had to add 12 to variables x, y, and z all the time, you could just make a function called PlusTwelve. Tell the function to add 12 to whatever you put in its parameters - Then you could call PlusTwelve(x), PlusTwelve(y), and PlusTwelve(z) wherever necessary!
Of course, functions can do a lot more than simple addition. The things some people around here can do with functions are crazy.
Task : Does something, but through things like 'Yield,' you can make it act like a loop that works alongside MainLoop.
"Do the laundry while listening to radio."
You can still keep parameters.
If you wanted to shoot three different patterns at the same time, you could just make three tasks. This makes the code easier to understand, less cluttered, and less likely for the different attacks' scriptings to get in the way of each other.
Tasks are probably more versatile than this, but I find this is the most common use.
-
Task : Does something, but through things like 'Yield,' you can make it act like a loop that works alongside MainLoop.
"Do the laundry while listening to radio."
You can still keep parameters.
If you wanted to shoot three different patterns at the same time, you could just make three tasks. This makes the code easier to understand, less cluttered, and less likely for the different attacks' scriptings to get in the way of each other.
Tasks are probably more versatile than this, but I find this is the most common use.
This is pretty misleading, actually. Generally, a task is a function with the ability to pause at any time for a frame with yield. Here's a more practical example related to danmaku.
Sub: "Shoot a ring of 20 bullets when I tell you to."
It will always be 20 bullets at the same speed, angles, graphic, etc. Nothing will change at all (unless you're using rand somewhere in your sub but that's beside the point).
sub ShootRing {
ascent(i in 0..20){
CreateShot01(GetX, GetY, 3, i*18, RED01, 0);
}
}
Function: "Shoot a ring of bullets when I tell you to. I'm going to tell you how many bullets are in the ring when I tell you to shoot them."
It will shoot however many bullets you tell it to shoot. If you wanted, you could add more things to change angle, speed, and/or graphic too.
function ShootRing(num){
ascent(i in 0..num){
CreateShot01(GetX, GetY, 3, i*(360/num), RED01, 0);
}
}
Function: "Add two numbers together when I tell you to. I'm going to tell you what the numbers are when I tell you to add them. Also, tell me what the result is."
The other feature of a function is that it can return things. In this case you could put let something = AddNumbers(1, 2); and it would run the function with those two inputs and return result which is 3.
function AddNumbers(a, b){
let result = a + b;
return result;
}
Task: "Wait a second and then shoot a ring of bullets when I tell you to. I'm going to tell you how many bullets are in the ring when I tell you to shoot them."
The only thing unique about a task is that, unlike functions, it can wait between any of its commands. Otherwise, it behaves just like a function without the ability to return stuff. By the way, make sure @MainLoop has a single yield that is run every frame if you plan to use tasks. Otherwise the yields in tasks will not work properly.
task ShootRing(num){
loop(60){ yield; } // Every yield makes it wait 1 frame so 60 frames of waiting is 1 second.
ascent(i in 0..num){
CreateShot01(GetX, GetY, 3, i*(360/num), RED01, 0);
}
}
-
I figured I was wrong when it came to the technical definition, it's just that for the sake of a beginner, I was trying to focus on using it like some sort of loop.
But yeah, it definitely wasn't a very complete or correct view of things now that you mention it. I think your explanation's the best one.
-
Excuse me, could somebody explain how to make Sanae's stars pattern?
Something like this (http://www.youtube.com/watch?v=cUFAbTDqt3w) or stars like in Takeminataka Invocation.
-
Hi everyone,
I'm having a little problem here with a task again.
I just want to change the size of my bullet, so I use ObjLaser_SetLength and ObjLaser_SetWidth.
But I had to change my object to a OBJ_LASER, so my bullet isn't moving anymore. Because a laser isn't supposed to move I think.
I tried to to put a Obj_SetPosition and changing the size manually in my while(Obj_BeDeleted(obj)==false), but it kinds of failed.
My code is
let obj=Obj_Create(OBJ_LASER);
let nb = 30;
let nbframe = 0;
Obj_SetPosition(obj, x, y);
Obj_SetSpeed(obj, v);
Obj_SetAngle(obj, angle);
ObjLaser_SetLength(obj,100);
ObjLaser_SetWidth(obj,50);
ObjLaser_SetSource(obj,true);
ObjShot_SetGraphic(obj, WHITE03);
ObjShot_SetDelay(obj, 1);
ObjShot_SetBombResist(obj, true);Can some help me to make my bullet with the size I want move, please?
-
Obj_SetPosition(obj, Obj_GetX(obj)+cos(angle)*v, Obj_GetY(obj)+sin(angle)*v));
Probably what you're looking for.
-
Obj_SetPosition(obj, Obj_GetX(obj)+cos(angle)*v, Obj_GetY(obj)+sin(angle)*v);
Probably what you're looking for.
I think you had an extra parenthesis. To elaborate further, laser objects ignore the object-specific speed parameter, so you must set the position manually each frame using the above line. Basically, put it in the while(!Obj_BeDeleted(obj)){} part of the task. If you want to use the speed parameter in the same way as an object bullet, then use:
Obj_SetPosition(obj, Obj_GetX(obj)+cos(angle)*Obj_GetSpeed(obj), Obj_GetY(obj)+sin(angle)*Obj_GetSpeed(obj));
If your laser's movement angle and actual angle are the same, then you may also want to use the angle parameter instead of a variable to simplify things. In this case:
Obj_SetPosition(obj, Obj_GetX(obj)+cos(Obj_GetAngle(obj))*Obj_GetSpeed(obj), Obj_GetY(obj)+sin(Obj_GetAngle(obj))*Obj_GetSpeed(obj));
(on a side note I edited this post like 4 times because I mixed up the code woopsies)
-
I followed Helepolis video tutorials on how to animate bosses, and that's how i do it now.
Like:
If GetSpeedX>0{//A bunch of SetGraphicRect codes}
But what if i want to animate attack sprites, and animate through them only when the boss does a certain move/attack? How would a task (or something else) for that look like?
-
But what if i want to animate attack sprites, and animate through them only when the boss does a certain move/attack? How would a task (or something else) for that look like?
Something like this:
let attacking = false;
let frame = 0;
@MainLoop{
frame++;
if(frame==50){
attacking = true;
}else if(frame==60){
ascent(i in 0..36){
CreateShot01(GetX, GetY, 3, i*10 + GetAngleToPlayer, RED01, 0);
}
attacking = false;
frame = 0;
}
}
@DrawLoop{
SetTexture(boss);
if(attacking){
SetGraphicRect(192, 0, 255, 63);
}else if(GetSpeedX>0){
SetGraphicRect(64, 0, 127, 63);
}else if(GetSpeedX<0){
SetGraphicRect(128, 0, 191, 63);
}else{
SetGraphicRect(0, 0, 63, 63);
}
DrawGraphic(GetX, GetY);
}
-
I followed Helepolis video tutorials on how to animate bosses, and that's how i do it now.
Like:
If GetSpeedX>0{//A bunch of SetGraphicRect codes}
But what if i want to animate attack sprites, and animate through them only when the boss does a certain move/attack? How would a task (or something else) for that look like?
Or you can save yourself some headache and use my animation library (http://www.shrinemaiden.org/forum/index.php/topic,4711.0.html)[/self-plug]. Just take a look at the comments in the library itself and how the example file that is included uses the functions. You can always ask questions about it here or send a PM if you want help using it.
Excuse me, could somebody explain how to make Sanae's stars pattern?
Something like this (http://www.youtube.com/watch?v=cUFAbTDqt3w) or stars like in Takeminataka Invocation.
This is a bit much to explain but in general, to make a 5 pointed star, you need to make 5 points equally spaced in a circle around the center point and then connect them. I don't know how much trigonometry you're comfortable with so I'm not sure where to start explaining. For now, let's say you chose the point (cx, cy) as the center of the star and a size of s. The top point of the star would be (cx+cos(-90)*s, cy+sin(-90)*s). If you add 144 to the angle in the sin and cos functions, you will find one of the two points that the top point needs to draw a line to. Keep adding 144 to that angle until you reach the top again while connecting the points in the order you find them and you'll find that you created a star.
-
I'm trying to make a single effect object to appear, and when I run the script, it runs normally but the effect doesn't shows up even when I called for it.
Maybe I'm doing something wrong with the vertex or something? I followed Helepolis Tutorial strictly and I didn't managed to make an effect object. Here's the code:
task effect{
let obj = Obj_Create(OBJ_EFFECT);
let counter = 0;
ObjEffect_SetRenderState(obj,ALPHA);
ObjEffect_SetTexture(obj, Eff);
Obj_SetPosition(obj, GetCenterX,100);
ObjEffect_SetScale(obj, 1, 1);
ObjEffect_SetLayer(obj, 8);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetVertexXY(obj, 0, -276, -31);
ObjEffect_SetVertexXY(obj, 1, 276, -31);
ObjEffect_SetVertexXY(obj, 2, -276, 31);
ObjEffect_SetVertexXY(obj, 3, 276, 31);
ObjEffect_SetVertexUV(obj, 0, 0, 0);
ObjEffect_SetVertexUV(obj, 1, 552, 0);
ObjEffect_SetVertexUV(obj, 2, 0, 62);
ObjEffect_SetVertexUV(obj, 3, 552, 62);
while(!Obj_BeDeleted(obj)){
if(counter==120){ Obj_Delete(obj); }
counter++;
yield;
}
}
-
Thank you so much Lucas!! :)
It worked the first time I execute the script and that's beautiful!
-
This is a bit much to explain but in general, to make a 5 pointed star, you need to make 5 points equally spaced in a circle around the center point and then connect them. I don't know how much trigonometry you're comfortable with so I'm not sure where to start explaining. For now, let's say you chose the point (cx, cy) as the center of the star and a size of s. The top point of the star would be (cx+cos(-90)*s, cy+sin(-90)*s). If you add 144 to the angle in the sin and cos functions, you will find one of the two points that the top point needs to draw a line to. Keep adding 144 to that angle until you reach the top again while connecting the points in the order you find them and you'll find that you created a star.
Thanks.
But is it for lasers or bullets?
Is it need angle?
-
I'm trying to make a single effect object to appear, and when I run the script, it runs normally but the effect doesn't shows up even when I called for it.
Maybe I'm doing something wrong with the vertex or something? I followed Helepolis Tutorial strictly and I didn't managed to make an effect object. Here's the code:
task effect{
let obj = Obj_Create(OBJ_EFFECT);
let counter = 0;
ObjEffect_SetRenderState(obj,ALPHA);
ObjEffect_SetTexture(obj, Eff);
Obj_SetPosition(obj, GetCenterX,100);
ObjEffect_SetScale(obj, 1, 1);
ObjEffect_SetLayer(obj, 8);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetVertexXY(obj, 0, -276, -31);
ObjEffect_SetVertexXY(obj, 1, 276, -31);
ObjEffect_SetVertexXY(obj, 2, -276, 31);
ObjEffect_SetVertexXY(obj, 3, 276, 31);
ObjEffect_SetVertexUV(obj, 0, 0, 0);
ObjEffect_SetVertexUV(obj, 1, 552, 0);
ObjEffect_SetVertexUV(obj, 2, 0, 62);
ObjEffect_SetVertexUV(obj, 3, 552, 62);
while(!Obj_BeDeleted(obj)){
if(counter==120){ Obj_Delete(obj); }
counter++;
yield;
}
}
I'm going to take a wild guess and say that you didn't load the graphic, because I see nothing wrong with your code. :wat:
-
I did load the graphic, but the image doesn't shows up.
http://pastebin.com/cGbFnffK
There's the whole code
-
You're missing a yield; in your @MainLoop - therefore your code will never run the effect object task! No wonder.
Edit: if you've done that and it still doesn't work, check your file name and pathing.
-
Or you can save yourself some headache and use my animation library (http://www.shrinemaiden.org/forum/index.php/topic,4711.0.html)[/self-plug]. Just take a look at the comments in the library itself and how the example file that is included uses the functions. You can always ask questions about it here or send a PM if you want help using it.
Wow thanks, this must be the most handy thing for danmakufu I've ever seen!
EDIT: gotta thank OnTheNet too for the Obj_Laser script, really handy.
-
Hi everyone
I'm having a little headache trying to make something.
What I want to do is to shoot a bullet (RED03) and other bullets that would be always behind this bullet even if the angle of the bullet(RED03) is different.
I'm trying to make Math that I learned many years ago : the triangle with a^2 + b^2 = c^2 and also sin(angle) = opp. / hyp. or tan(angle) = opp. / adj. . You know math from high scool.
All this to try making bullets always behind my big bullet that the boss is shooting. The result is not really working but I sense that I'm not so far from the real answer to my problem.
But does anyone can help me figure this out?
Please
-
Gonna need to head into simple circle trig if you want to do this stuff!
In any case, do you mean making like a snake of bullets? I'm not entirely understanding what you want to do.
-
For my problem to make a "snake" of bullets,
After several times, I have this code for my Mainloop
@MainLoop
{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
if(frame == 100)
{
frame = 0;
CreateShot02(GetX,GetY,2,GetAngleToPlayer,0.05,vitessemax,RED03,0);
CreateShot02(GetX + (sin(GetAngleToPlayer - 180) * 20),GetY + (cos(GetAngleToPlayer - 180) * 20), vitessemin, GetAngleToPlayer, 0.05, vitessemax, RED01, 0);
}
frame++;
}
It doesn't do what I want. My little bullet isn't always behind my big bullet, only when I'm at a certain spot on the screen.
Can anyone help me with that?
-
Where do i get the graphics for rumias StB darkness? Or do i create it's look in another way?
-
(http://img64.imageshack.us/img64/6071/boss2.png)
-
For my problem to make a "snake" of bullets,
After several times, I have this code for my Mainloop
@MainLoop
{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
if(frame == 100)
{
frame = 0;
CreateShot02(GetX,GetY,2,GetAngleToPlayer,0.05,vitessemax,RED03,0);
CreateShot02(GetX + (sin(GetAngleToPlayer - 180) * 20),GetY + (cos(GetAngleToPlayer - 180) * 20), vitessemin, GetAngleToPlayer, 0.05, vitessemax, RED01, 0);
}
frame++;
}
It doesn't do what I want. My little bullet isn't always behind my big bullet, only when I'm at a certain spot on the screen.
Can anyone help me with that?
Switch your sin and cos. Cos goes with x and sin goes with y.
-
Thanks a lot Blargel!!
I can't believe that I was so close to resolve my problem myself.
-
Ok, so recently i watched a video showing how to make good spell cards. I copied his stuff and found it doesnt work on my end for some reason...i keep getting a script error that says somewhere here, i have an error:
task mainTask{
wait(120);
yield;
movement;
}
task movement{
loop{
SetMovePositionRandom01(60,30,10,GetCenterX-120,GetCenterY-100,GetCenterX+120,GetCenterY-40);
wait(30);
SetColor(128,128,255);
Concentration01(80);
SetColor(255,255,255);
wait(30);
fire;
wait(180);
yield;
}
}
Im not sure if giving just this is enough though...if anyone could fix my script, that would be great! Just message me if you need my script! Thanks!
-Rogus
-
We need to know the error you got. Screenshot or copy/paste it.
-
How do i put an image? (sorry, new here. xD)
-
How do i put an image? (sorry, new here. xD)
First off, welcome to Rika's Garage!
Judging from your question you might be new to forums in general as well so just in case let me give you a quick pointer. Read the stickies. They're at the top for a reason. The one most of us hope new people like yourself notice is the one that says "※ The GREAT information thread ※ READ THIS OR SCIENCE WILL END YOU" (http://www.shrinemaiden.org/forum/index.php/topic,6181.0.html). In it, you'll find a bunch of resources related to Danmakufu as well as some general rules to follow while posting here to keep things nice and tidy. This includes some links to various tutorials for commonly asked questions such as drawing an image (http://www.touhouwiki.net/wiki/Touhou_Danmakufu:_Nuclear_Cheese%27s_Drawing_Tutorial) or making specific patterns of bullets (http://www.shrinemaiden.org/forum/index.php/topic,865.0.html). In my opinion, newbies should start by reading the basic tutorial (http://www.shrinemaiden.org/forum/index.php/topic,30.0.html) unless you have some experience in programming or scripting in another language.
-
http://dreamnovels.webs.com/apps/photos/photo?photoid=127757187 (http://dreamnovels.webs.com/apps/photos/photo?photoid=127757187)
Go here, and go to Photos. Theres a section called Error messages. Thats where you'll find it!
-
You didn't define the "wait" function. It's not built-in to Danmakufu; scripters just define it basically as a shortcut. wait(x) just yields x times, so it looks like this:
function wait(frames){
loop(frames){yield;}
}
Put that anywhere in your script - probably right above MainTask.
-
But it worked for the other ones...im confused. :(
-
The best thing for you to do is start by reading some actual tutorials and scripting basic patterns yourself, not just copying other people. If you don't understand how danmakufu works at all, you won't be able to script. Period.
Blargel's Beginner Tutorial (start here): http://www.shrinemaiden.org/forum/index.php/topic,30.0.html
Helepolis' video Tutorials (here after you understand the concepts in the first link): http://www.shrinemaiden.org/forum/index.php/topic,2852.0.html
Then after you learn everything solidly from the beginner tutorials (and only after)...
Nuclear Cheese's DrawLoop tutorial: http://dmf.shrinemaiden.org/wiki/index.php?title=Nuclear_Cheese%27s_Drawing_Tutorial
Naut/Iryan's Intermediate Tutorial: http://www.shrinemaiden.org/forum/index.php/topic,865.0.html
-
In @Initialize, does danmakufu wait to finish loading something before continuing in a script? Say I had:
LoadMusic(bgm);
SetMovePosition01(blah,blah);
PlayMusic(bgm);
Would it load the music before moving?
-
It's all within the same frame, so it wouldn't really matter if you put one before the other.
-
It's all within the same frame, so it wouldn't really matter if you put one before the other.
Problem:
Say you wanna destroy every bullet in a certain area then spawn a few bullets there - you'd have to delete the bullets then spawn the new ones:
DeleteEnemyShotImmediatelyInCircle(stuff) then CreateShotawejfp(jaeofjwsio)
-
Bullet delay? Wait one/a few frame/s?
-
The following stage script goes straight to clear without playing the boss...
@Initialize {
LoadGraphic (GCSD~"LoadingScreen.png");
LoadMusic (GetCurrentScriptDirectory~"Cirno's Perfect Math Class.mp3");
Wait(150);
CreateEnemyBossFromFile(GetCurrentScriptDirectory~"cpmcmain.txt", 0, 0, 0, 0, 0);
WaitForZeroEnemy;
Wait(30);
Clear;
}
-
You don't yield during @Initialize. Ever.
1. Create a random task and put the lines from Wait(150); to Clear; into it.
2. Put a yield; in @MainLoop for the task to link to.
3. Start the task in @Initialize.
-
The following stage script goes straight to clear without playing the boss...
@Initialize {
LoadGraphic (GCSD~"LoadingScreen.png");
LoadMusic (GetCurrentScriptDirectory~"Cirno's Perfect Math Class.mp3");
Wait(150);
CreateEnemyBossFromFile(GetCurrentScriptDirectory~"cpmcmain.txt", 0, 0, 0, 0, 0);
WaitForZeroEnemy;
Wait(30);
Clear;
}
There's a difference between using yield in a task and using yield in the rest of the script. If you yield in a task, it will pause that task until yield is called in the main part of the script. By main part of the script I mean stuff like @Initialize, @MainLoop and @Finalize -- though normally it would only be found in @MainLoop. The Wait function that most people use is just a loop of yields to tell a task how many frames to wait, but you're using it in the main part of the script which means you're telling the game to continue all unfinished tasks 150 times before creating a boss, telling the game to continue all unfinished tasks at least another 30 times (I'm actually surprised that didn't cause an infinite loop) and then ending the stage, all on the very first frame of the game.
What you're looking for is this:
@Initialize {
LoadGraphic (GCSD~"LoadingScreen.png");
LoadMusic (GetCurrentScriptDirectory~"Cirno's Perfect Math Class.mp3");
StartStage;
}
@MainLoop {
yield;
}
task StartStage {
Wait(150);
CreateEnemyBossFromFile(GetCurrentScriptDirectory~"cpmcmain.txt", 0, 0, 0, 0, 0);
WaitForZeroEnemy;
Wait(30);
Clear;
}
@Initialize will start the task which immediately pauses. It won't go past the Wait(150) until the rest of the script (outside of any other task) hits a yield 150 times. That will happen in @MainLoop which is run every frame, so it'll take 150 frames to make the StartStage task to go past the Wait(150) command into creating the boss. Then you have the task yielding until there are no more enemies, then yielding for an extra 30 frames, and then ending the stage.
-
I am doing my first ever script for Danmkafu for a Yuyuko player, please tell me if there is any mistake in the coding. I followed DoubleVla's youtube tutorials to some extent, of course giving some custom content for Yuyuko, as for the last part I beilive it is a added code for a more flourished bomb
http://pastebin.com/etiNY12h
<Naut> Please use pastebin when posting large blocks of code.
-
Why you do this. So many errors. Everywhere. Oh god.
-
well this is my first time scripting sheesh >.> give me a break
-
No, I will not give you a break. In fact, if this is truly your first time scripting it's all the more reason for me not to give you a break. You start at the beginning of scriptmaking, not at creating a player. You did all this without checking for errors or actually regarding any syntax or how anything works or anything. If you're watching Helepolis' tutorials, you should have gone through twelve tutorials and scripts already before this.
These are your errors.
Things you missed are in BLUE
Things you screwed up are in RED
#TouhouDanmakufu[Player]
#Menu[Lady Yuyuko]
#Text[
Ready to shoot butterflies
]
#ReplayName[Lady Yuyuko]
#Image[.\yuyukoselect.png]
#ScriptVersion[2]
script_player_main{
let CSD = GetCurrentScriptDirrectory;
let maritex = CSD ` "yuyukodoll.png";
let f = 0;
let f2 = 0;
let count = 01;
@Initialize{
SetSpeed(4,2);
SetPlayerLifeImage(maritex, 0, 0, 23, 48);
LoadGraphic(maritex);
LoadPlayerShotData(CSD ~ "ShotData.txt");
{
@DrawLoop{
SetTexture(maritex);
SetAlpha(255);
Set GraphicScale(1, 1);
if(GetKeyState(VK_LEFT)==KEY_PUSH || GetKeyState(VK_LEFT)==KEY_HOLD) {
SetGraphicAngel(0, 0, 0);
if(f2<5) { setGraphicRect(0, 0, 32, 48); }
if(f2>=5 && f2<10) { setGraphicRect(32, 48, 64, 96); }
if(f2>=10 && f2<15) { setGraphicRect(64, 48, 96, 96); }
if(f2>=15) { setGraphicRect(96, 48, 128, 96); }
f2++;
}
else if(GetKeyState(VK_RIGHT)==KEY_PUSH || GetKeyState(VK_RIGHT)==KEY_HOLD) {
SetGraphicAngel(0, 0, 0);
if(f2<5) { setGraphicRect(0, 0, 32, 48); }
if(f2>=5 && f2<10) { setGraphicRect(32, 48, 64, 96); }
if(f2>=10 && f2<15) { setGraphicRect(64, 48, 96, 96); }
if(f2>=15) { setGraphicRect(96, 48, 128, 96); }
f2++;
}
else {
if(f<15) { setGraphicRect(0, 0, 32, 48); }
if(f>=15 && f<30) { setGraphicRect(32, 0, 64, 48); }
if(f>=30 && f<45) { setGraphicRect(64, 0, 96, 48); }
if(f>=45 && f<60) { setGraphicRect(96, 0, 128, 48); }
f2 = 0;
}
{
@Missed{
yield;
{
@SpellCard{
UseSpellCard("DeathSign", NULL);
{
@Finallize{
{
@MainLoop{
if((GetKeyState(VK_SHOT)==Key_Push || GetKeyState(VK_SHOT) == KEY_HOLD) && count == -1){
count = 0;
}
//when focused
if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE) == KEY_HOLD){
if(count == 5){
mainShot(GetPlayerX, GetPlayerY-16, 20, 270, 1, 5);
mainShot(GetPlayerX, GetPlayerY-18, 20, 265, 1, 5);
mainShot(GetPlayerX, GetPlayerY-20, 20, 265, 1, 5);
mainShot(GetPlayerX, GetPlayerY-22, 20, 270, 1, 5);
count = -1;
}
}
//when normal
else {
if(count == 5){
mainShot(GetPlayerX, GetPlayerY-18, 20, 265, 1, 5);
mainShot(GetPlayerX, GetPlayerY-20, 20, 265, 1, 5);
count = -1;
}
}
if(count >=0) {
count++;
}
SetIntersectionCircle(GetPlayerX, GetPlayerY, 0);
yield;
}
task mainshot(MISSING ALL YOUR PARAMETERS WHAT IS THIS I DON'T EVEN) {
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, x, y);
Obj_SetSpeed(obj, speed);
Obj_SetAngel(obj, dir);
OBj_SetAlpha(obj, 155);
ObjShot_SetGraphic(obj,graphic);
ObjShot_SetDamage(obj, dmg);
ObjShot_SetPenetration(obj, 1);
}
function wait(w) { loop(w) {yield;} }
}
//spell card coding
script_spell DeathSign {
let CSD = GetCurrentScriptDirectory;
let textdata = CSD ~ ".\spellcardanm.png";
let special1 = CSD ~ ".\spellblade.png";
let special2 = CSD ~ ".\spelltag.png";
let special3 = CSD ~ ".\spellblast.png";
let cut = CSD ~ ".\yuyukospellcard.png";
@Initialize{
SetSpeed(2,2);
Load Graphic(special3);
LoadGraphic(cut);
CutIn(KOAMA, "Death Sign: Reaper's Defense", cut 0,0, 512, 512);
SetPlayerInvincibility(240);
SpellTask;
@MainLoop {
yield;
CollectItems;
}
@Finalize {
}
task SpellTask{
wait(60);
Scythe(GetPlayerX, GetPLayerY);
wait(180);
End;
}
task Scythe(x, y){
let obj = obj_Create(OBJ_CREATE);
let blade = 0;
let c = 0;
let scale = 0.5;
obj_SetPosition(obj, GetPlayerX, GetPlayerY);
obj_SetAngle(obj, 0);
objEffect_SetTexture(obj, special2);
objEffect_SetLayer(obj,3);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetVertexXY(obj, 0, -32, -32);
ObjEffect_SetVertexUV(obj, 0, 0, 0);
ObjEffect_SetVertexXY(obj, 1, 32, -32);
ObjEffect_SetVertexUV(obj, 1, 64, 0);
ObjEffect_SetVertexXY(obj, 2, -32, 32);
ObjEffect_SetVertexUV(obj, 2, 0, 64);
ObjEffect_SetVertexXY(obj, 3, 32, 32);
ObjEffect_SetVertexUV(obj, 3, 64, 64);
while(!Obj_BeDeleted(obj)) {
ObjEffect_SetAngle(obj, 0, 0, blade);
ObjEffect_SetScale(obj, scale, scale);
Obj_SetPosition(obj, GetPlayerX, GetPlayerY);
if(c > 120){
ObjSpell_SetIntersecrionCircle(obj,obj_GetX(obj), Obj_GetY(obj), 512, 700, true);
}
task CutIn{
task hexagontext(x,y,v,draai,sx,sy) {
let obj = Obj_Create(OBJ_EFFECT);
let alphret = 0;
let as = 0;
let c = 0;
let angle = draai;
let speed = v;
Obj_SetPosition(obj,x,y);
ObjEffect_SetRenderState(obj,ADD);
ObjEffect_SetTexture(obj,textdata);
ObjEffect_SetScale(obj, sx, sy);
ObjEffect_SetLayer(obj,2);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(obj, 4);
ObjEffect_SetVertexXY(obj, 0, -48, -128);
ObjEffect_SetVertexUV(obj, 0, 0, 0);
ObjEffect_SetVertexXY(obj, 1, 48, -128);
ObjEffect_SetVertexUV(obj, 1, 128, 0);
ObjEffect_SetVertexXY(obj, 2, -48, -104);
ObjEffect_SetVertexUV(obj, 2, 0, 32);
ObjEffect_SetVertexXY(obj, 3, 48, -104);
ObjEffect_SetVertexUV(obj, 3, 128, 32);
while(! Obj_BeDeleted(obj)){
ObjEffect_SetAngle(obj,0,0,angle);
ObjEffect_SetVertexColor(obj,0,alphret,255,255,255);
ObjEffect_SetVertexColor(obj,1,alphret,255,255,255);
ObjEffect_SetVertexColor(obj,2,alphret,255,255,255);
ObjEffect_SetVertexColor(obj,3,alphret,255,255,255);
if(as==0){alphret+=20; if(alphret>185){as=1;} }
if(as==1){c++; if(c==90){as=2;} }
if(as==2){alphret-=10; if(alphret<0){ Obj_Delete(obj); } }
angle += speed;
yield;
function wait(w) { loop(w) {yield;} }
}
http://www.shrinemaiden.org/forum/index.php/topic,6181.0.html
This is the great information thread. It contains tutorials galore and lots of other useful stuff. PLEASE READ THEM.
-
Erm- I hope you don't mind that I change the topic.
Well, I think I've got a flaw in understanding how 3D-drawing works.
As far as I know, drawing in 3D is only possible in stage scripts. And if you make a full game with Danmakufu, you have to start up everything in a stage script. Does this also mean that you have to do all the drawing commands for all stages, menus, etc... in one stage script?
So I thought that it could be a bit easier if I put the drawing commands in tasks, e.g. task DrawStage1 or DrawMenu.
I tested it by putting some commands from @BackGround into a task, but it looked very weird (but it showed something at all...).
http://imageshack.us/g/828/24072391.png/ (http://imageshack.us/g/828/24072391.png/)
(Left image - Drawing in @BackGround,
right image - drawing in a task) The background looks weird, but also interesting.
I think I'm just approaching this problem the wrong way. Are there other ways or should I avoid 3D-drawing at all?
-
Let's see some code on those task drawans, yo. Also, typically, draw everything in the @BackGround of your stage script. Use conditional statements to switch between stages...
if(StageOne){
}else if(StageTwo){
}
etc.
-
http://pastebin.com/DXraNi97 (http://pastebin.com/DXraNi97)
I switch between @BackGround-drawing and task drawing by commenting out Draw; or by misspelling @BackGround.
-
Well first of all your @BackGround is spelled BackgGround :V oh that was on purpose
The problem is you've associated 'tasks' to go in @Initialize. Notice how your task is entirely just a per-frame loop? Notice how when you yield it shortcuts back to @MainLoop instead of any real drawing loop? Instead, you want that task to be a function or a subroutine, that is called inside @BackGround. That way when you call it, you're running the drawing code inside the drawing loop.
Here. (http://pastebin.com/2jDu9b1M)
You run the stage through tasks as you normally would. When it gets to a point in the stage where you want to change the background behaviour, you change variables in the stage task, not the BackGround. These variables are then used as flags of sorts to tell the BackGround loop to "do this next thing now". I suppose you could run the whole logic in BackGround, but it's a dumb idea and Blargel will murder you.
-
It works! I didn't consider that the drawing stuff still should be in @BackGround because it also showed something in @MainLoop (which actually surprised me). Thanks a lot!
-
I'm gonna be asking so many questions in here, I can tell. :V
I'm using SetShotDataA and I want to change the direction of the bullet after 60 frames. All I want to do is add 90 degrees to the bullet's current angle. But how do I get the value of the bullet's current angle (if it was, say, determined randomly at first)?
-
let derp = rand(0,360);
createshotA(id blablabla)
setshotdataA(id, 0, blablablabla, derp, blablabla)
setshotdataA(id, 60, blablablabla, derp+90, blablabla)
fireshot(id)
-
This also works, but requires more SetShotDataA coding:
turn = 90;
angle = rand(0,360);
SetShotDataA(id, 60, speed, angle, turn, acceleration, min/max speed, graphic);
turn=0;
SetShotDataA(id, 61, speed, NULL, turn, acceleration, min/max speed, graphic);
Adds 90 to the angle of the bullet for one frame. So, if the frame for the second SetShotDataA is 62, then the bullet will turn around completely.
-
ok....here i go again with more questions! yay! :D
Now recently, i read the basic tutorial (which was very nice :3) and i wanted to create my first script. Basically, i wanted to put in 2 CreateShotA's, both opposites for the spell card........but everytime i put in the second one, it doesnt shoot in the game. The script will still run, but the shot wont appear. What do i have to use? Do i use like a...task fire 2, or something else...?
my script: http://pastebin.com/2Pk3jGuU (http://pastebin.com/2Pk3jGuU)
-
I can't see the script because I'm posting from my DS right now, but I assume you forgot the second FireShot(). That function is what tells Danmakufu to actually fire the shot you created with CreateShotA, so you need one copy of it after each CreateShotA/SetShotDataA system.
-
oh. So if i create another task fire and ShotA, i have to put FireShot(2)?
-
Just for the future as a nitpick, wait is a function that loops a yield. You don't need to put a yield after or before a wait function.
Secondly, as long as you aren't waiting any extra frames or modifying the A bullet at any point, just move the FireShot(1); to right after the SetShotData.
Thirdly, there isn't even a second CreateShotA in there, so I can't really tell what the problem is. What this is currently doing is making 36 of each bullet in that while loop, on the same frame, doing the exact same thing. The CreateShotA bullets in particular should have four 03 bullets overlapped onto each other in a circle of nine bullets around the boss. It waits 16 frames, and then loops through the 36 times again, and so on.
-
kk....so say if i wanted to add another CreateShotA thats the opposite of the one i have now. Would i put it in the same task fore, or in a new one? I remember reading somewhere that other variable shots like ShotA need to be put into another task fire...
-
It's really up to you. Also, it's usually better to name your functions a little more descriptively than just "fire". I dunno what you're making so I can't help you name it, though.
Anyways to answer your question a bit better, depending on what "opposite" means to you for a bullet, you may or may not want to separate it into a different function. Consider this example:
function CurveShot(startAng, angVel){
CreateShotA(0, GetX, GetY, 10);
SetShotDataA(0, 0, 3, startAng, angVel, 0, 3, RED01);
SetShotData(0, 60, 3, NULL, 0, 0, 3, RED01);
FireShot(0);
}
If by opposite you mean you want the bullet to just curve in the opposite way, you can safely just use the same function like this. For example, you can put this somewhere:
CurveShot(45, 1);
CurveShot(135, -1);
This would make two bullets with "opposite" curves that can be controlled with the same function, just with different parameters. However, if the differences between the two bullets are more complicated, you might want to consider splitting them into two functions instead.
EDIT: I just noticed you had a pastebin up there. I posted this from work and if no one answers this question by the time I get home, I'll edit this post to address your problem more specifically after reading the code.
-
Alright! Also, heres my script that didnt work.
http://pastebin.com/R59sdyMK (http://pastebin.com/R59sdyMK)
Im not sure why the task fire2 didnt work but...im gonna keep trying! i wanna get better at this and finally stop being lazy! i gotta make this game by the end of summer!!! xD
-
Okay my last post was completely irrelevant but whatever, it's still good advice :V .
Your second fire task isn't working because you never tell it to start anywhere. Try adding this in your mainTask:
task mainTask{
wait(60);
yield;
fire;
fire2;
}
-
omg thank you! i forgot you had to set it there! Ok, and question 3/4 for today is.........how do you make bullets go in a circular motion around the boss? Like for example, how do i make a couple of bullets spawn from my boss, and comtinue to move arould like a pinwheel? I know the code involes something with the whole 360 degress thing, but how does it work?
And last thing, how do you spawn lazers from points on the map? Like, I want 2 lazers, one on each side of my boss, firing, and spreading bullets? (I know this is a little complicated, cause it has to do with obj. shots...so feel free to skip this question if you cant explain it well xD)
-
I can explain anything about Danmakufu that you want, but the problem is that I have to get you understanding the basics of it first before you start building upon those basics to learn the more complex things. For your first question, the easiest way is with shot objects. I'd try to explain it for you right now, but I don't think you're quite ready for it yet, judging from the code you had in your pastebin. For your other question, you can try using CreateLaserA (http://dmf.shrinemaiden.org/wiki/index.php?title=Bullet_Control_Functions#CreateLaserA) and it's corresponding functions. To delete a laser that never leaves the screen, you'll need to use SetShotKillTime before firing it, which is also on the same page as that link. To make bullets appear from the laser, you can try using AddShot, though that's a little complicated when you try adding shots to lasers.
Fool around with the functions on that page and see if you can figure out how they work. There's too much to explain that you could probably figure out with experimentation.
-
Blargel, you are AMAZING! Thanks so much for your help! I got my first spell card up and running! Its really cool too! Check it out if you want peoples! :D
http://pastebin.com/gXNTvHzx (http://pastebin.com/gXNTvHzx)
Not sure about the image or music...oh well! :D
-
/me slaps rogus247 across the face
Never pull the "kill while still on the cut-in" trick again! Replay!
-
0_0 huh?
-
Isn't a big deal at your level, but generally most patterns wait a while after the script starts, to start firing bullets. Pay it little mind, though.
-
oh im sorry...ok here, i made it wait a little while. hope this is better!
http://pastebin.com/zq64mJps (http://pastebin.com/zq64mJps)
Also, can someone give me an example of CreateLaserB and such? I almost have it working, but im making mistakes a lot...
-
Hi everyone, danmakufu noob reporting in :)
I've only had one basic programming class and it didn't really get into tasks and functions, so a lot of this stuff is new to me. As such, when I started messing around with some of the concepts from the intermediate and advanced tutorials I'm pretty sure I managed to make an infinite loop even in a relatively simple code - danmakufu freezes and requires a forcequit any time I play this card:
http://pastebin.com/Fb1is7ZH
If anyone happens to be able to take a quick look at this and see where it went wrong, and unless it's something really stupid I should already know better than to do, perhaps impart some CompSci knowledge as well, I'd appreciate it!
(major thanks to Blargel, Naut, Iryan, and Stuffman for the tutorials by the way - they've been super helpful thus far!)
-
Wave should be a task, not a function. You use yield in it, and you want that yield to pause it for a frame - that only works in a task.
I'll give more detail tomorrow if you want (and if nobody else does). It's a pain to type on this touch-screen keyboard...
-
oh im sorry...ok here, i made it wait a little while. hope this is better!
http://pastebin.com/zq64mJps (http://pastebin.com/zq64mJps)
Also, can someone give me an example of CreateLaserB and such? I almost have it working, but im making mistakes a lot...
CreateLaserB(id, length, width, graphic, delay);
SetLaserDataB(id, frame, lengthening speed, distance from enemy to laser,distance change,angle from enemy to laser,angle change,laser angle,laser angle turn speed);
example:
ascent(i in 0..30){
CreateLaserB(i, 100, 20, RED03, 60);
SetLaserDataB(i, 0, 0, 100, 0, 0+i*12, 1, 180+i*12, 1);
FireShot(i);}
Sets up 30 lasers around the boss, pointing towards the boss, as well as spinning.
Hope i didn't make anything wrong...
-
Wave should be a task, not a function. You use yield in it, and you want that yield to pause it for a frame - that only works in a task.
I'll give more detail tomorrow if you want (and if nobody else does). It's a pain to type on this touch-screen keyboard...
Thanks - changed this and it worked (just gotta play with the settings to get the card to work like I want it to). I think I misinterpreted the difference between a task and a function (assumed tasks could not be called with variable inputs). Was the problem that when the Wave function was called in MainLoop, it got stuck waiting for a return value, which it wouldn't get due to the yield statements?
Also quick question offhand - what is the size of the Danmakufu screen in pixels? I estimated it at about 400 x 480, but knowing for sure would be helpful.
-
384x448 pixels.
(224, 240) is the center point of the field.
(32, 16) is the top left.
(416, 16) is the top right.
(32, 464) is the bottom left.
(416, 464) is the bottom right.
All these values can be substituted with...
(GetCenterX, GetCenterY) as the center point.
(GetClipMinX, GetClipMinY) as the top left.
(GetClipMaxX, GetClipMinY) as the top right.
(GetClipMinX, GetClipMaxY) as the bottom left.
(GetClipMaxX, GetClipMinY) as the bottom right.
-
Hi everyone, danmakufu noob reporting in :)
I've only had one basic programming class and it didn't really get into tasks and functions, so a lot of this stuff is new to me. As such, when I started messing around with some of the concepts from the intermediate and advanced tutorials I'm pretty sure I managed to make an infinite loop even in a relatively simple code - danmakufu freezes and requires a forcequit any time I play this card:
http://pastebin.com/Fb1is7ZH
If anyone happens to be able to take a quick look at this and see where it went wrong, and unless it's something really stupid I should already know better than to do, perhaps impart some CompSci knowledge as well, I'd appreciate it!
(major thanks to Blargel, Naut, Iryan, and Stuffman for the tutorials by the way - they've been super helpful thus far!)
To clarify it a bit more, only Danmakufu has something called tasks, but most other programming/scripting languages have functions. Some languages have something called coroutines which are pretty much what tasks are in Danmakufu. Interestingly, some languages allow coroutines to yield values, which would be interesting, but I'm honestly not sure how often I'd use that in a Danmakufu script if it were allowed.
The difference between functions and tasks is how they deal with yield and return. A function can use return value; to exit the function and spit out a value in place of where it was called. For example, GetCenterX is a function that always returns 224. You can put let cx = GetCenterX and it's the same as replacing the function with 224. This makes functions ideal for mathematical functions that are used very often, such as the distance formula:
function GetDistance(x1, y1, x2, y2){
return ((x1-x2)^2+(y1-y2)^2)^0.5;
}
Of course, you can also use functions that fire a pattern of bullets in different ways as well.
Lastly, the behavior of yield in a function depends entirely on whether you are calling the function in a task or in any other part of the script. This is because the behavior yield itself depends on where it is. Yielding in a task will cause that task to pause until a yield is called in a nontask environment (e.g. @MainLoop). Remember the wait function that a lot of people use? It's just a function that places a given amount of yields where you called it. This function obviously is for use in tasks, but if you were to put it in @MainLoop, it wouldn't cause any syntax or runtime errors; it would just cause any tasks you're using to run much faster, assuming you put a value more than 1 into the function.
A task is basically the same thing as a function except that it cannot return a value, and yield behaves differently in one than anywhere else in a script. I've already mentioned that yield will pause a task until yield is called again elsewhere in a nontask environment, usually @MainLoop. In 99.99% of the cases, you'll be having yield in @MainLoop at the very end so that it is being called once every frame, effectively causing each yield in a task to pause that task for a single frame. As for using return, since it might be running over a period of time, it doesn't make sense for it to be able to return a value. However you may still use return without a value to end a task prematurely.
-
Thanks for the LaserB thing! ...only one problem. It makes too many lasers, and it lags the game...how do i reduce the number of lasers in this?
http://pastebin.com/dgZmGRcv (http://pastebin.com/dgZmGRcv)
Also, can someone explain why SetShotKillTime doesnt work with letters...is it because in this situation, there not the id it needs?
-
You need to declare, SetShotKillTime(x, y); before you call FireShot(x);
And it's lagging a lot because you are waiting 1 frame to respawn 30 more lasers when they are being deleted at a rate of after 120 frames of waiting. So you essentially have 3600 lasers on the field on top of each other when you could be using your wait(x); function to delay when your lasers will spawn in place of your yield; Use that to make only those 30 appear and be deleted then spawned again.
-
Small breakdown.
ascent(i in 0..30){
In one frame, the following code loops thirty times, incrementing a local variable i.
CreateLaserB(i, 100, 10, RED03, 60);
SetLaserDataB(i, 0, 0, 100, 0, 0+i*12, 1, 180+i*12, 1);
Creates and sets up a laser, with an incrementing id from 0 to 29.
FireShot(i);
Fires the laser you set up, as its id is also the same.
}
Loops back to the ascent and increments i. This happens 30 times.
As a result, there are 30 individual lasers being fired every frame.
SetShotKillTime(i,120);
Sets the shot deletion time of undefined bullet i. There is no bullet with the id of i as it is outside the ascent loop, and in addition it's set up after a shot would be fired and thus would be useless anyways.
yield;
Cut to the next appropriate open yield statement. (i.e. wait a frame)
I'd like you to try and figure out how to fix this yourself first.
-
384x448 pixels.
...
deja vu
-
deja vu
It was very helpful to me, thank you.
-
Thanks Azure, Blargel, and Schezo! I'm pretty amazed at how helpful / responsive people are in this thread.
Got my first ever spell card working pretty much as intended - it's quite simple and not particularly pretty, but it fulfills the idea I had and is a reasonable difficulty, so I'm happy with it. I might open up a thread in a couple days (internet is way too slow here to upload stuff to youtube) so everyone can make fun of me and/or give constructive criticism; we'll see if I've got anything else to show by then.
-
It's a lot easier to critique and help people when they understand what we're talking about right away and can somewhat come to conclusions by themselves instead of us forcefeeding people answers, so reading your posts is like a breath of fresh air. As you've seemingly just started out and you're already getting the hang of things with even just a bit of a programming background, I look forward to see what you can dish out.
-
OK PEOPLE! Im finished with 3 of my first spell cards! If you wanna check em out, please do!
Blind sign - Possessed iris of death -
http://pastebin.com/bTV6aSKj (http://pastebin.com/bTV6aSKj)
Hell - Edge of the fire blade -
http://pastebin.com/nbCx9MGv (http://pastebin.com/nbCx9MGv)
WARNING! THIS ONE WILL MAKE YOU CRY! You have been warned...xD
Blind sign "4 fans of light"
http://pastebin.com/a9gB5jyu (http://pastebin.com/a9gB5jyu)
Thanks to: Blargel, Drake,Naut,Schezo,and Darkness1 for the LaserB help!
You guys are the best! Oh, and AzureLove, thanks for your help too!
-
Please watch this post, making replays...
EDIT: Am I supposed to not be able to hit the boss 90% of the time?
-
2 things:
1) lol did you use reimu A? xD Its suppose to be a shoot and dodge thing...i guess cause im more skilled, i made em hard...lol im sorry if you failed. Just practice! :3
2) cant see the replay...
-
2 things:
1) lol did you use reimu A? xD Its suppose to be a shoot and dodge thing...i guess cause im more skilled, i made em hard...lol im sorry if you failed. Just practice! :3
2) cant see the replay...
How skilled are you?
As a Lunatic (for seriousness. I usually play Hard) player I should be able to capture many newbies' first spell cards.....
... Wait, Are you mocking me?!
I will make sure you pay for that!
/me rants on for fifteen more minutes before running out of shit to say
EDIT: I actually did capture that spell card...! It was really hard, but I captured it in 3 tries! What the fuck do you want now?
-
Hey, I got AppLocale and tried to use it with Danmakufu, but I'm still getting an instant error message even when I set the language to Japanese. I'm on Windows Seven, 64-bit.
-
If the language is set then the error message won't display in garbage text. Please screencap or copy it, we aren't magic.
-
How skilled are you?
As a Lunatic (for seriousness. I usually play Hard) player I should be able to capture many newbies' first spell cards.....
... Wait, Are you mocking me?!
I will make sure you pay for that!
/me rants on for fifteen more minutes before running out of shit to say
EDIT: I actually did capture that spell card...! It was really hard, but I captured it in 3 tries! What the fuck do you want now?
Mewkyuu, don't get pissed at him for not knowing...
YES, I'M NOT DEAD :V
-
Can someone help me?
I keep getting this error message whenever I play my script.
---------------------------
ScriptError「yadayadayadayadaydayady.....]
---------------------------
Bullet1は未定義の識別子です(20行目)
↓
Bullet1(a, b, c);
}
if(frame==20){
Sinuate Laser}
~~~
---------------------------
OK
---------------------------
Here is the code I have.
#TouhouDanmakufu
#Title[wkbcvjvhbd]
#Text[Boss Initialization with almost everything you could possibly need stuck in @Initialize]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main {
let frame = 0;
@Initialize {
SetLife(1000);
SetTimer(50);
SetEffectForZeroLife(180, 100, 1);
SetMovePosition02(GetCenterX, GetCenterY, 3);
}
@MainLoop {
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 24);
frame++;
if(frame==10){
Bullet1(a, b, c);
}
if(frame==20){
Sinuate Laser}
frame = 0;
yield;
}
}
@DrawLoop {
}
@Finalize {
}
task Bullet1(a, b, c){
let timer=30;
while(timer>0){
let 1=Obj_Create(OBJ_SHOT);
Obj_SetPosition(1, GetX, GetY);
Obj_SetAngle(1, rand(0, 359));
Obj_SetSpeed(1, rand(1, 5));
ObjShot_SetGraphic(1, RED01);
while(Obj_BeDeleted(1)==false) {
yield;
}
}
}
task Sinuate Laser{
let obj1=Obj_Create(OBJ_SINUATE_LASER);
Obj_SetPosition(obj1, GetX, GetY);
Obj_SetAngle(obj1, GetAngleToPlayer);
Obj-SetSpeed(obj1, rand(1, 5));
ObjSinuateLaser_SetLength(obj1, 40);
ObjSinuateLaser_SetWidth(obj1, 10);
yield;
}
}
I would really like some help on this as this has really been annoying me for the past few hours.
-
in your @MainLoop
Sinuate Laser}
you better fix that :V
EDIT: also, I don't think you can use multiple words to name tasks... try using something like Sinuate_Laser or SinuateLaser instead
-
you better fix that :V
Danmakufu actually raised an error and then I put that in and the error went to the one I posted before.
-
the error message danmakufu's giving you is because it's not recognizing any task named "Bullet1" which happens when you accidentally close the text file before it encounters the declaration (aka you have an extra closing bracket / '}')
also, I just noticed now, you declared your object bullet in the task as '1', you can't use numbers as the start of your variables' names... you can use obj1, obj_2 or whatever, but don't start with numbers like 1obj or 2_obj... and don't make it only a number...
-
Yay it's finally working now:D
Thanks for the help.
And btw, I did have my Bullet1 variable as object originally but I changed it since I thought it might make a difference.
-
Quick CompSci question after reading through the 'Useful Misc. Code' thread. When, if ever, is it necessary to declare variables in the declaration of the function or task. Along with that, what, if any, difference does it make? I've found that variables showing up in the function declaration line work fine even if never explicitly declared at a higher level or within the function before being used.
In short, what is the difference between:
function derp (let herp, let dedurp) {
do stuff;
}
function derp (herp, dedurp) {
do stuff;
}
-
Style difference. I don't think it changes anything. In most languages, you need to specify the type of variable (int counter = 0, string name = "Reimu", etc), even in function declarations. In Danmakufu, it assigns types automatically, and all you need is "let" - so the designers let you use standard programming syntax for functions by allowing you to declare the "type" of a variable in the declaration. But since it's always the same, they also let you skip it if you want.
-
If the language is set then the error message won't display in garbage text. Please screencap or copy it, we aren't magic.
Wording that better: It still crashes instantaneously when I launch it via AppLocale. The error message is just the usual "program has stopped working" (thanks Windows vagueness!)
-
I got another question...
When i create a bullet pattern that circles like laserB, what would the shot be named? I cant tell by the vagueness of the touhou wiki's descriptions of the shots. :derp:
-
I assume you're looking for something like CreateLaserB that let's you control a bullet based on the position of the boss except as a bullet instead of a laser? If so, there's no such thing. You'll have to use ObjShots and trigonometry. If you're confident in your Danmakufu abilities, go take a look at the shot object tutorial (http://dmf.shrinemaiden.org/wiki/index.php?title=Nuclear_Cheese%27s_Shot_Object_Tutorial). If you understand how to use shot objects and get good with trigonometry, you pretty much have Danmakufu bullet pattern creation mastered.
-
Ok! i got a basic pattern to work for obj bullets...but i cant get them to go in a circular pattern (like shotA).
http://pastebin.com/EqUmtSJu (http://pastebin.com/EqUmtSJu)
Did i put the superbullet name in wrong? Or did i just misplace something?
-
SetShotDatasuperbullet(2,60,4,dir,2,0,3,PURPLE21);
what
http://www.youtube.com/watch?v=fMBudAKGSlE
http://www.shrinemaiden.org/forum/index.php/topic,865.0.html
-
Ok im gonna fix that! In the meantime, yet another one of my things is wrong. Its telling me the wait function is wrong, but i have it defined...
http://pastebin.com/TNPEGYTe (http://pastebin.com/TNPEGYTe)
-
It isn't your yield that's wrong, it's that your brackets aren't matched up. When you open your loop(8) you're using a ( instead of { .
-
Ok im gonna fix that! In the meantime, yet another one of my things is wrong. Its telling me the wait function is wrong, but i have it defined...
http://pastebin.com/TNPEGYTe (http://pastebin.com/TNPEGYTe)
Line 99:
loop(8){CreateLaser01(Obj_GetX(obj),Obj_GetY(obj),2,dir,100,10,RED04,0); dir+=360/8;}
It can't find the wait function because it think it's being defined in a weird place because of that missing bracket.
-
0_0' oh...umm...i knew that!
...yeah, as you can see, i dont have a good eye....kinda watching the video you posted, and trying to follow along.
Thanks! ...But its been bugging me for the longest time that when i usually get an error, it goes back up to the wait function...kinda strange. :/ Oh well. Thanks again!
(Dont be suprised if you see me more often. xD)
-
Computers are notorious for being bad at figuring out your intentions. They do exactly what you tell them to do and that's it. When it doesn't understand what you're trying to do, it tries its best to tell you why it can't understand you, but quite often, especially with syntax errors, it'll fail to point you to the real problem. Syntax errors are best solved through good habits so that they don't even appear. Syntax highlighters are also helpful. I suggest that you download Notepad++ which will highlight your opening and closing brackets more clearly even without a custom syntax highlighter. Of course, you can also try installing the Danmakufu syntax highlighter for Notepad++ (http://www.shrinemaiden.org/forum/index.php/topic,4906.msg241303.html#msg241303) which might help you identify errors more easily.
-
Thanks for the thing Blargel! One last thing before i go on to experimenting with obj.shots.
http://pastebin.com/CvHW1rjT (http://pastebin.com/CvHW1rjT)
THIS error is funny cause its all japanese except for a bracket...
-
http://www.shrinemaiden.org/forum/index.php/topic,4155.0.html
You don't read stickies, don't you?
You're a bad, bad boy.
-
dir+=180/8
-
Ok so im getting use to using obj.shots and such. My latest one includes the bouncing of MANY bullets and such. I thank DoubleVla from youtube, and Drake for showing me! (How many times can i thank you guys in one week?)
So recently, my newest try is being....strange. Its an arc shot where the bullets follow you after like...a second. There being strange and not even shooting, They just spawn and move a centimeter! Why is that?
http://pastebin.com/fAqgMEi6 (http://pastebin.com/fAqgMEi6)
-
while(!Obj_BeDeleted(obj)){
Obj_SetSpeed(obj,0);
wait(30);
Obj_SetAngle(obj,atan2(GetPlayerY - Obj_GetY(obj), GetPlayerX - Obj_GetX(obj)));
ObjShot_SetGraphic(obj,RED04);
Obj_SetSpeed(obj,4);
yield;
}
there's your problem... every time the loop runs, you're setting its speed to 0, then telling it to wait for 30 frames... after that you set the speed to 4, but remember that it's a while loop so after that last yield, it goes back to the start of the loop and resets the speed of the bullet to 0... basically you're getting a teeny-tiny movement every 31 frames :V
-
OMG YOU SEE? IM BAD AT THIS! lol thanks! your awesome! Im not good at spoting errors......mainly cause i have eye problems so...thanks again! :V :V :V
-
I don't know if I can ask this here, it's a pretty weird question: I can't handle tasks very well, but MainLoop scripting works great for me. Is there anything that only tasks can do? Things that you can't do using the MainLoop? Thanks!
-
Everything is possible using either method. Some things become much easier using one or the other, but nothing is impossible. For example, something tasks are commonly used for is to make object shots with custom movement patterns - this can be done in MainLoop scripting by having an array that holds the object IDs, and ascenting through it each frame to apply the movement (with another array or two if the shots have other variables).
-
I'm trying to make the final spellcard for an extra boss, and i got stuck with this:
task SpellPhases{
loop{
if(GetEnemyLife==750){
Phase2=true;}
if(GetEnemyLife==500){
Phase3=true;}
if(GetEnemyLife==250 || GetTimer==30){
Phase4=true;}
yield;
}
}
The GetTimer part works for changing phase, but the GetEnemyLife parts does nothing.
-
I don't know if I can ask this here, it's a pretty weird question: I can't handle tasks very well, but MainLoop scripting works great for me. Is there anything that only tasks can do? Things that you can't do using the MainLoop? Thanks!
Learn to use tasks too and broaden your knowledge. ;)
It's good to know both methods, but Azure is right, either method works for anything, though it is my opinion that more things are easier with tasks than with MainLoop.
I'm trying to make the final spellcard for an extra boss, and i got stuck with this:
task SpellPhases{
loop{
if(GetEnemyLife==750){
Phase2=true;}
if(GetEnemyLife==500){
Phase3=true;}
if(GetEnemyLife==250 || GetTimer==30){
Phase4=true;}
yield;
}
}
The GetTimer part works for changing phase, but the GetEnemyLife parts does nothing.
The life may not be exactly 250, 500, or 750 because the player doesn't necessarily deal 1 damage per frame. I would code it like this:
task SpellPhases {
while(GetEnemyLife>750 && GetTimer>30){ yield; }
phase2=true;
while(GetEnemyLife>500 && GetTimer>30){ yield; }
phase3=true;
while(GetEnemyLife>250 && GetTimer>30){ yield;}
phase4=true;
}
}
-
I'm trying to make the final spellcard for an extra boss, and i got stuck with this:
task SpellPhases{
loop{
if(GetEnemyLife==750){
Phase2=true;}
if(GetEnemyLife==500){
Phase3=true;}
if(GetEnemyLife==250 || GetTimer==30){
Phase4=true;}
yield;
}
}
The GetTimer part works for changing phase, but the GetEnemyLife parts does nothing.
Alternate solution:
Y'see, this line of code only calls if the boss's life is EXACTLY 250, 500, or 750. Otherwise it doesn't work at all.
To counter this just replace == with <= which means less than or equal to (the boss's life goes below 750, etc).
-
That won't work. If the HP drops under 500 it will trigger Phase 2 and Phase 3 both. You need to add dual statements.
If > 500 && <= 750 { phase }
if > 250 && <= 500 { phase2 }
etc
-
It might be he only has while loops in other tasks. This one might only check for the life so the attack tasks can stop waiting and start spawning bullets.
Is that the case?
-
It might be he only has while loops in other tasks. This one might only check for the life so the attack tasks can stop waiting and start spawning bullets.
Is that the case?
Hardly doubt it. Look at the code. It has a loop { } in there, it seems to loop forever as a checker. Thus, he needs dual statements
-
I followed Blargels example and it worked just fine. But thanks a lot for all the helpful replies ;)!
-
Thank you very much, guys! That's great, I'm trying to use tasks too, but at least I'm sure I can do cool stuff with MainLoop :3
-
Hardly doubt it. Look at the code. It has a loop { } in there, it seems to loop forever as a checker. Thus, he needs dual statements
It loops forever, but it never resets any of the variables back to false after turning them true so actually, after everything is set to true, it no longer even needs to run. Thus, why I suggested my solution. It also saves a few CPU clock cycles per frame by only checking one condition per frame instead of all 3. :V
-
Back again! :P
I'm wondering if there is a good way to have stuff happen when bullets of different types intersect (without predetermining locations where this will happen). Here's a pseudo-code attempt at it, but I imagine there's a better way to go about it than this:
function GetDistance(x1,x2,y1,y2) {return distance}
mainloop{
ascent(i in a..b){
CreateShotA(i, 'parameters for A-type bullet')
CreateShotA(-i, 'parameters for B-type bullet')
}
a = b+1
b = 2b-a+1
ascent(g in 1..b)
ascent(h in 1..b)
if (GetDistance of shot g and -h < 'too close') {
do stuff;
}
}
}
Particularly since this doesn't stop checking bullets even when they don't exist anymore, and the number of calcs is on the order of b^2, I'd guess that this would cause noticeable slowdown once b gets high enough.
-
you'll have to use object bullets and their Obj_GetX and Obj_GetY functions (or alternately, use Obj_Obj_Collision)... so I suggest you get more familiar with objects first, before you attempt this... :3
-
You're thinking along the right lines, but you have no way of determining a bullet's position without using object bullets (go learn object bullets lol). Aside from that you're pretty much right. The best method is probably storing the objects in two global arrays for A bullets and B bullets (if your intention is to have something done when A and B collide).
let position_A = [];
let position_B = [];
//code
task objbulletA{ //similar for B, obviously
position_A = position_A ~ [Obj_Create(OBJ_SHOT)]; //creates an object and concats into array
let id = length(position_A) - 1; //to track id in array if needed
//code
}
And then you run distance checks between each A bullet to B bullet.
I guess you clean up garbage entries if the bullets are deleted but that might be a tad advanced lol. There are actually a lot of optimizations you can do with things like this but that isn't really an issue either.
-
I am actually familiar with object shots, and in my scripts tasks and object shots are my preferred way of creating bullets. The reason I didn't use a similar style here was because I was worried about how to call on individual shots outside of the task in which they were created (I actually just realized how to do this though - in the past I either passed nothing or shot data into the task to create an object shot named 'obj', but if I pass an object name variable down I should be able call individual shots from anywhere in the program).
I wasn't aware of an Obj_Obj_Collision function - how does this one work, or is it something I have to write?
Even using object shots, I'm not sure how to avoid having to test every bullet against every other in every frame to get my intended result.
Edit (after seeing previous post): Oh I see, haha. I'm so used to object shots I assumed I could use GetX on any bullets I spawned. ^^'
Hmm, that many calcs every frame won't slow the program down?
-
Well if the detection radius is large enough you can stand to only calculate distances once every two frames, or you can divide the work up 50/50, stuff like that.
Are you talking garbage collection?
-
Didn't know what garbage collection is - now know about what 3 minutes on wikipedia tells me. xD
I guess garbage collection isn't really my concern, though if I end up having problems with slowdown on the card I'll look into it (and actually it would probably be an interesting problem to think about as well even if it isn't necessary in this case - half the reason I'm doing danmakufu is to improve my programming skills).
I don't really have a concept for what the card will look like, but one of the things I'm planning on doing when I start mixing elements in my extra boss is having 'water' and 'fire' bullets either annihilate each other or spawn some bullets in an explosion when they meet (same with 'earth' and 'air').
Yeah, I'm sure I'd be able to check for collisions less frequently than every frame - I generally stay away from pellets and high speeds, so any overlaps should last a number of frames.
-
Is someone able to make a tutorial about the nitpicky fussy things in Danmakufu?
Things such as where certain functions/tasks/variables go.
When you should put curly braces and parenthesis.
And other things like that fact that task names can't have spaces in them.
If someone were to make a tutorial for those things then it'll be greatly appreciated.
-
Is someone able to make a tutorial about the nitpicky fussy things in Danmakufu?
http://www.shrinemaiden.org/forum/index.php/topic,4155.0.html
http://www.shrinemaiden.org/forum/index.php/topic,4762.0.html
http://www.shrinemaiden.org/forum/index.php/topic,4752.0.html
Things such as where certain functions/tasks/variables go.
When you should put curly braces and parenthesis.
And other things like that fact that task names can't have spaces in them.
If someone were to make a tutorial for those things then it'll be greatly appreciated.
Uhhhhhh no. Basic syntax should be very easy to follow, and at the very least you'll learn what not to do yourself as you script and read other tutorials. These are not "nitpicky", it's being not lazy with your punctuation, grammar, etc. Nobody should have to make a tutorial going MAKE SURE YOU MATCH UP YOUR CURLY BRACKETS!!!!!1
-
I'm sorry then if I find that most times examples aren't enough.
Sometimes the worfing is confusing for me and I end up putting things in the wrong place.
-
It'll fix itself as you get more experienced and such.
-
Two Questions:
1.- CreateLaserB has lengthening speed which allows the lenght of the laser to extend in "n" each frames, but what do I do if I want to change the width of the laser?
2.- Can somebody explain me how ascent/descent works in an example script? the FAQ example isn't that useful.
EDITED: Changed "CreateShotB" with "CreateLaserB"
-
Two Questions:
1.- CreateShotB has lengthening speed which allows the lenght of the laser to extend in "n" each frames, but what do I do if I want to change the width of the laser?
CreateShotB doesn't exist.
if you mean CreateLaserB, then it doesn't work that way - you have to use object lasers and ObjLaser_SetWidth(objectid, widthinpixels);
-
2.- Can somebody explain me how ascent/descent works in an example script? the FAQ example isn't that useful.
ascent(i in 0..20){
CreateShot01(GetX, GetY, 3, i*18, RED01, 5);
}
is the same as
let i = 0;
while(i < 20){
CreateShot01(GetX, GetY, 3, i*18, RED01, 5);
i++;
}
except that in the ascent example, the variable i no longer exists after the ascent is over, but will still exist in the while example. In both cases, it's just a type of loop with a variable called i that starts at 0 and counts up by one until it reaches 20. Note that i will never actually be used when it hits 20 in the while loop. The same is true for ascents so it'll count from 0 to 19, not 0 to 20.
Descent makes i, go through the same numbers but in reverse order, so in the previous example, if we replaced ascent with descent, it'll count backwards from 19 to 0.
-
Ok, im gonna make this one a quickie. I know the command to stop obj,bullets and hold them in place. How would i spawn like...3 bullets from that one bullet? And say if i wanted to stop THOSE bullets and make more? Would that be a Spawn command?
-
That's possible with CreateShotA, but it seems you wanna use object bullets.
You'd have to make a totally new object bullet, spawned by the first object bullet.
That's all I can give - the rest anyone can figure out.
-
Ok, im gonna make this one a quickie. I know the command to stop obj,bullets and hold them in place. How would i spawn like...3 bullets from that one bullet? And say if i wanted to stop THOSE bullets and make more? Would that be a Spawn command?
task bullet(x,y,a){
//code
Obj_SetPosition(obj,x,y);
Obj_SetAngle(obj,a);
//code
//slow down/stop
bullet(Obj_GetX(obj),Obj_GetY(obj), a+something);
bullet(Obj_GetX(obj),Obj_GetY(obj), a+somethingelse);
bullet(Obj_GetX(obj),Obj_GetY(obj), a+somethingelseelse);
//probably Obj_Delete(obj); unless you want to do something else with the stopped bullet
}
-
http://pastebin.com/rsTUMkH0 (http://pastebin.com/rsTUMkH0)
Im...doing something wrong here...xD
Do you have to set the variables next to the bullet task?
-
task bullet(x,y,a){
//code
Obj_SetPosition(obj,GetEnemyX,GetEnemyY);
Obj_SetAngle(obj,dir);
//code
//slow down/stop
bullet(Obj_GetX(obj),Obj_GetY(obj), a+3);
bullet(Obj_GetX(obj),Obj_GetY(obj), a+6);
bullet(Obj_GetX(obj),Obj_GetY(obj), a+9);
//probably Obj_Delete(obj); unless you want to do something else with the stopped bullet
}
is this seriously what's in your code? the thing drake posted was just a general outline :V you have to fix it and make it fit whatever you want it to do...
EDIT: Given what you have in your pastebin
bullet(GetEnemyX,GetEnemyY,1,dir,ORANGE32,0);
I'm guessing you'll want something like this:
task bullet(x,y,v,a,g,d){
let counter=0;
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj,x,y);
Obj_SetAngle(obj,dir);
Obj_SetSpeed(obj,v);
ObjShot_SetGraphic(obj,g);
ObjShot_SetDelay(obj,d);
while(!Obj_BeDeleted(obj){
counter++;
if(counter==*insert whatever value you want*){Obj_SetSpeed(obj,0);}
if(counter==*insert whatever other value you want*){
bullet(Obj_GetX(obj),Obj_GetY(obj),1,a+3,ORANGE32,0); //Change values to whatever you want
bullet(Obj_GetX(obj),Obj_GetY(obj),1,a+6,ORANGE32,0);
bullet(Obj_GetX(obj),Obj_GetY(obj),1,a+9,ORANGE32,0);
Obj_Delete(obj);
}
}
}
-
why
-
Two questions:
1.) In one of my scripts I'm looking to use a couple global shot id's on object shots, as I need to compare their location to other object shots created by a different task. These shots are being created by a task called in MainLoop.
Is there a good way to pass a variable down to this task such that I don't need to break the task by cases? i.e. can I pass a variable to the task that lets me reference one of two shot id's
2.) With Object Shots not moving straight up or down, is there a simple way to apply a constant downward acceleration, or will I need to write some trigonometric functions to adjust the angle and speed based on the current angle and speed? (answered on IRC - thanks Ginko)
-
http://pastebin.com/LWq0bZSn (http://pastebin.com/LWq0bZSn)
yeah...i got the same error with the whole (wait) thing again....i think i should get some new eyes, cause i sure as hell cant! DX I should get a professional pro to come over to my house, and just...give me a 20 hour lecture on danmakufu.....
But yeah, all variables are set, but like most my problems, the thing comes up by the wait command, so...what has rogus done wrong this time? xD
-
I actually read over this a few times too. Didn't catch it for a while.
while(!Obj_BeDeleted(obj)){
-
that solved the (wait problem...) but now i get a (dir) problem...i need to set it to 0, right?
-
task bullet(x,y,v,a,g,d){
let counter=0;
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj,GetEnemyX,GetEnemyY);
Obj_SetAngle(obj,dir);
Obj_SetSpeed(obj,3);
ObjShot_SetGraphic(obj,ORANGE32);
ObjShot_SetDelay(obj,20);
while(!Obj_BeDeleted(obj){
counter++;
if(counter==2){Obj_SetSpeed(obj,0);}
if(counter==4){
bullet(Obj_GetX(obj),Obj_GetY(obj),1,a+3,ORANGE32,0); //Change values to whatever you want
bullet(Obj_GetX(obj),Obj_GetY(obj),2,a+6,ORANGE32,0);
bullet(Obj_GetX(obj),Obj_GetY(obj),3,a+9,ORANGE32,0);
Obj_Delete(obj);
}
}
}
Two things :
- 'dir' doesn't even exist, how exactly did you expect the script to work ? You have to initialize if you want to use a string as a variable. Then again, if you want the angle to be 0, why exactly don't you just put 0 ?
- What are those x,y,v,g and d arguments doing in your task ? They don't intervene anywhere ... it will work correctly but that's just pointless :O
-
He wants the x and y, only his initial call is supposed to spawn on the enemy. In which case,
bullet(GetEnemyX,GetEnemyY,1,anactualnumber,ORANGE32,0);
//...
task bullet(x,y,v,a,g,d){
let counter=0;
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj,x,y);
Obj_SetAngle(obj,a);
Obj_SetSpeed(obj,3);
ObjShot_SetGraphic(obj,ORANGE32);
ObjShot_SetDelay(obj,20);
while(!Obj_BeDeleted(obj){
counter++;
if(counter==2){Obj_SetSpeed(obj,0);}
if(counter==4){
bullet(Obj_GetX(obj),Obj_GetY(obj),1,a+3,ORANGE32,0); //Change values to whatever you want
bullet(Obj_GetX(obj),Obj_GetY(obj),2,a+6,ORANGE32,0);
bullet(Obj_GetX(obj),Obj_GetY(obj),3,a+9,ORANGE32,0);
Obj_Delete(obj);
}
}
-
http://pastebin.com/2a6nqdjb (http://pastebin.com/2a6nqdjb)
ok...it would work, but it freezes my Comp. I have yields in all places...but it still freezes. Why?
-
task bullet(x,y,v,a,g,d){
let counter=0;
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj,GetEnemyX,GetEnemyY);
Obj_SetAngle(obj,a);
Obj_SetSpeed(obj,3);
ObjShot_SetGraphic(obj,ORANGE32);
ObjShot_SetDelay(obj,20);
while(!Obj_BeDeleted(obj)){
counter++;
if(counter==2){Obj_SetSpeed(obj,0);}
if(counter==4){
bullet(Obj_GetX(obj),Obj_GetY(obj),1,a+3,ORANGE32,0); //Change values to whatever you want
bullet(Obj_GetX(obj),Obj_GetY(obj),2,a+6,ORANGE32,0);
bullet(Obj_GetX(obj),Obj_GetY(obj),3,a+9,ORANGE32,0);
Obj_Delete(obj);
yield;
}
}
}
change to
task bullet(x,y,v,a,g,d){
let counter=0;
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj,GetEnemyX,GetEnemyY);
Obj_SetAngle(obj,a);
Obj_SetSpeed(obj,3);
ObjShot_SetGraphic(obj,ORANGE32);
ObjShot_SetDelay(obj,20);
while(!Obj_BeDeleted(obj)){
counter++;
if(counter==2){Obj_SetSpeed(obj,0);}
if(counter==4){
bullet(Obj_GetX(obj),Obj_GetY(obj),1,a+3,ORANGE32,0); //Change values to whatever you want
bullet(Obj_GetX(obj),Obj_GetY(obj),2,a+6,ORANGE32,0);
bullet(Obj_GetX(obj),Obj_GetY(obj),3,a+9,ORANGE32,0);
Obj_Delete(obj);
}
yield;
}
}
-
In addition, even once that's fixed: Every bullet waits 4 frames, then creates 3 new bullets. Each of those waits 4 frames, then creates 3 new bullets. Each of those waits 4 frames, then creates 3 new bullets. Do you see the problem here? You need to have some limit on how many times they can split. Give the bullet task another parameter called "maxsplit" or something, and every time you create a child bullet, create it with maxsplit-1 instead. If it's zero, don't create any more bullets, so your processor will stop screaming.
-
umm...wheres is that happening? Can you show me so i know how to it next time so i dont have to bug you about it? xD
-
That's simply what your script currently does. If you get it working you'll notice.
-
Oh boy, I must be retarded.
if (Obj_GetX(bala) > GetClipMaxX){
Obj_SetAngle (bala, 140);
ObjShot_SetGraphic (bala, 53);}
Why my bullet isn't bouncing and changing color? ;_; It just goes and disappears offscreen.
-
kk it works! The knives do fire...but they arent firing from the knife. They fire from the boss after a certain time. How do i make it so that it comes from the knife?
-
Oh boy, I must be retarded.
Why my bullet isn't bouncing and changing color? ;_; It just goes and disappears offscreen.
Are you running that code in a while(!Obj_BeDeleted(obj) ){yield;} loop? Are you sure that 140 is a valid id in the shot data?
-
Are you running that code in a while(!Obj_BeDeleted(obj) ){yield;} loop? Are you sure that 140 is a valid id in the shot data?
Well, I'm using the MainLoop.... so no yield, right? I tried to put the while and now Danmakufu freezes. The IDs are valid. Thanks anyway!
-
kk it works! The knives do fire...but they arent firing from the knife. They fire from the boss after a certain time. How do i make it so that it comes from the knife?
Even if you fire them using Obj_GetX(obj), it won't work cause this code is the one that places the bullet:
Obj_SetPosition(obj,GetEnemyX,GetEnemyY);
There's the problem. But actually, Drake already said this as well.
He wants the x and y, only his initial call is supposed to spawn on the enemy. In which case,
bullet(GetEnemyX,GetEnemyY,1,anactualnumber,ORANGE32,0);
//...
task bullet(x,y,v,a,g,d){
Obj_SetPosition(obj,x,y);
-
*Raises hand*
Is there a way to disable saving replays? I'm making it possible to save/quit after each stage because my game is rather long, and naturally replays don't like that. So I want to disable saving a replay if you continue from a saved game.
Making an error message pop up during a replay would be a bit crude, so I'd rather disable replays instead. If that's possible.
Fixing the syncing of the replay is out of the question by the way. :X
-
I recall AzureLove saying something about a maxsplit command? how does that work?
-
It isn't a command. She was telling you that as your script was, it would just continuously spawn and stop and spawn three bullets from every bullet every four frames. That is 15 times every second. You're not going to do the math, so it's 3x3x3x3x3x3x3x3x3x3x3x3x3x3x3 bullets in one second minus the deleted bullets. Or 3^15 = 14348907 bullets. Azure was telling you to fix it.
Figure out how to not do this. This isn't rocket science.
-
lol "azurelove"
[/s][/sub][/size]
Is there a different way to tile only part of an image, other than using loops/ascents?
-
Cropping it in an image editor and saving it as a new image is pretty much the only way.
-
you could draw it in a render target and use that, though cropping it would probably work better...
-
ok, after all this time, i finally figured out (Im stupid, as you can tell xD) After fixing it up to work, i realized that it keeps making more and more knives because the variable that created the knife wont reset! so it will go on forever creating knives. The question is, how do i reset the variable after some time? Something like this i would assume:
If(counter==1200){let x = 0;}
or
if(counter==1200){reset x}
I know thats wrong, but im trying to think of an example...
-
If(counter==1200){x = 0;}
Fixed, even though I have a feeling I won't be able to take a liking to you.
(I'm sorry! It's just because you've somehow been mean to me (or I took it the wrong way) and I can't forget it...)
/me bows
-
2 things:
1: Im sorry for whatever i did! :ohdear: (I cant recall...but i bet i did do something)
2: The command i put in...it doesnt work. I think it doesnt want to reset the number of (x knives) i create.
http://pastebin.com/iJnH9erD (http://pastebin.com/iJnH9erD)
-
Ahem (http://www.shrinemaiden.org/forum/index.php/topic,9281.msg650963.html#msg650963)
Ah, there we go!
/me goes to check
It seems d (the last parameter of bullet) is unused.
Also, what are you actually trying to accomplish?
-
O THAT? I wasnt mocking you! I was just experianced is all! xD No need to take it like that! And im glad you got it on your third try! :D
EDIT: Im trying to make it stop making infinite bullets. Like, reset it to firing just the 3, not making like...400 at once.
-
O THAT? I wasnt mocking you! I was just experianced is all! xD No need to take it like that! And im glad you got it on your third try! :D
I will fight you :V PoFV LUNATIC BEST 2 OF 3 TONIGHT
Anyways, http://pastebin.com/Y5hJUJKs
-
I will fight you PoFV LUNATIC BEST 2 OF 3 TONIGHT
CHALLENGE ACCEPTED...BUT YOU HAVE TO SHOW ME HOW FIRST............... :derp:
-
CHALLENGE ACCEPTED...BUT YOU HAVE TO SHOW ME HOW FIRST............... :derp:
MEET YOU ON #danmakufu TONIGHT.
NOW BACK ON TOPIC
I changed a few things in the text file from mainTask downwards. It seems I gave some use to d, which stops every bullet from continuously spawning 3 bullets each time - you won't want too much lag!
-
and suddenly, script enemy main! Now ill be on the hunt for that missing bracket! xD
-
and suddenly, script enemy main! Now ill be on the hunt for that missing bracket! xD
Add the closing bracket after the last one. Did you accidentally delete it when you replaced your code with mine?
-
wow....thats...really cool! xD
Oh, and btw, what if i didnt want them to home? Do i just set an angle for the knives?
-
wow....thats...really cool! xD
Oh, and btw, what if i didnt want them to home? Do i just set an angle for the knives?
I made it so that they home in on the player. Just take out the atan2 and everything around its parantheses, then replace it with other angles if you want.
-
Ok, the obj shots working great! Say if i want to make it so they bounce off the walls...where would i put it?
http://pastebin.com/wBwSew62 (http://pastebin.com/wBwSew62)
-
You'd put it after
while(!Obj_BeDeleted(obj)){
So the checking for the object bouncing is always performed every frame while the object exists.
-
#TouhouDanmakufu
#Title[Hell "- Edge of the fire blade -"]
#Text[Not everyone can see...]
#Player[FREE]
#ScriptVersion[2]
#BGM[bgm\Medicine.mp3]
script_enemy_main{
let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "system\Kora.png";
let cut = CSD ~ "system\Koracut.png";
let bg = CSD ~ "system\Temple.png";
@Initialize{
SetLife(5000);
SetTimer(100);
SetScore(100000);
SetMovePosition01(GetCenterX,GetCenterY,5);
LoadGraphic(imgBoss);
LoadGraphic(cut);
LoadGraphic(bg);
CutIn(YOUMU,"Hell - Edge of the fire blade -",cut,0,0,300,384);
mainTask;
}
@MainLoop{
SetCollisionA(GetX,GetY,32);
SetCollisionB(GetX,GetY,16);
yield;
}
@DrawLoop{
// data for the boss
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(225);
SetGraphicRect(0,0,110,110);
SetGraphicScale(0.5,0.5);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);
}
@BackGround{
SetTexture(bg);
SetRenderState(ALPHA);
SetAlpha(225);
SetGraphicRect(0,0,512,512);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetCenterX,GetCenterY);
}
@Finalize{
// delete the image from memory
DeleteGraphic(imgBoss);
DeleteGraphic(cut);
DeleteGraphic(bg);
}
task mainTask{
wait(120);
yield;
fire;
}
task fire{
//loop{
bullet(GetEnemyX,GetEnemyY,0.5,270,ORANGE32,0);
wait(240);
yield;
//}
}
task bullet(x,y,v,a,g,d){
let counter=0;
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj,x,y);
Obj_SetAngle(obj,a);
Obj_SetSpeed(obj,0.9);
ObjShot_SetGraphic(obj,ORANGE32);
ObjShot_SetDelay(obj,20);
while(!Obj_BeDeleted(obj)){
if(Obj_GetY(obj) > GetClipMaxY) {
Obj_SetAngle(obj,-dir);
}
counter++;
if(counter==140){Obj_SetAngle(obj, atan2(GetPlayerY-Obj_GetY(obj),GetPlayerX-Obj_GetX(obj)));}
if(counter==180){Obj_SetSpeed(obj,2);}
if(counter==260&&d<=5){
bullet(Obj_GetX(obj),Obj_GetY(obj),1,Obj_GetAngle(obj)+35+180,ORANGE32,d+1);
bullet(Obj_GetX(obj),Obj_GetY(obj),2,Obj_GetAngle(obj)+0+180,ORANGE32,d+1);
bullet(Obj_GetX(obj),Obj_GetY(obj),3,Obj_GetAngle(obj)-35+180,ORANGE32,d+1);
}
//if(counter==300){d = 0;}
yield;
}
}
// wait function
function wait(w){
loop(w){yield;}
}
}
Theres apparently a problem with my -dir command...it wont work...do i have to define direction? :V
EDIT: Also, do i have to add a loop to make it loop?
-
You forgot to put a let statement for dir.
No, the while already does that.
Meet me on #danmakufu. Right now.
EDIT: PASTEBIN PLEASE
-
2 things:
1) well..............that explains a lot.
2).....................im gonna get slapped for this, but whats #danmakufu? *hides face*
http://pastebin.com/0HyYRG8K (http://pastebin.com/0HyYRG8K)
-
rogus247, I don't mean this in an insulting way, but from the questions you've been asking, it's very clear that you are lacking in the very fundamentals of programming/scripting. Take the time to learn how variables, conditionals, functions, and programming logic REALLY work, and most of the questions you ask could easily be answered by yourself with just a little bit of thinking. If you keep coming to the Q&A thread for every little problem you have, you won't really learn.
#danmakufu (http://webchat.ppirc.net/?channels=#danmakufu)
-
Actually....your not insulting me at all. When it comes to math and stuff, im really good (top of my class btw). Danmakufu is the only thing that actually gives me trouble. I always miss the smallest of mistakes and dont see them. Also, your really right. I kinda learn, but i cant always depend on you guys...so yeah, sorry if i bombed you guys with like...40 questions already. Ill try to do more things on my own. (and also, i feel like theres an age requirement for danmakufu....and by that, i mean having more general knowlage and stuff...sucks when your young and dependent...xD)
EDIT: that last sentence....yeeeeeeah, i was kinda born to a family where i was just given everything! I never learned much on my own...:(
-
I'm wondering how to replicate the hover effect in ZUN's games. Is it like:
if(GetSpeedX==0){SetY(GetY+sin(wave)*1)} or: DrawGraphic(GetX,GetY+sin(wave)*1)
if(GetSpeedX==0){wave++;}
if(GetSpeedX<0 && GetSpeedX>0){wave=0;} Doesn't look so smooth to me. :wat:
-
Second option.
1 pixel of difference isn't that much. Also, I don't think you'll have to have that last line.
-
Never ever set the enemy's position in the float. You're supposed to draw them floating.
float += (1/((|GetSpeedX|)+1))*3;
DrawGraphic(GetEnemyX,GetEnemyY+sin(float)*8);
This is what I used in some script. Standing still, float increases by 3; moving increases it by 1.5.
-
Worked perfectly fine Drake, thanks!
And yeah, one pixel was too little, when i tested the codes i needed at least four.
-
Warning: Incoming "Guy with noticeably less experience than those around him"
Okay, this has me stuck. I began scripting in Danmakufu yesterday, and so far things have been going smooth enough.
I want my boss to, during nonspells, dart around the top area of the screen (similarly to actual Touhou bosses). This is my latest attempt:
@Initialize {
here be irrelevant code
...
loop{
wait(180);
SetMovePositionRandom01(48, 48, 3, GetClipMinX, 32, GetClipMaxX, 128);
}
...defining the following at the bottom, under @Finalize but before the end of script_enemy_main (taken from another thread):
function wait(t){
loop(t){ yield; }
}
In theory, the boss should make a movement every three seconds, moving at 3 frames/second (as I understand it). Obviously, without wait() or some delayer, the boss just has what I'd call a seizure at the top of the screen. In the unfortunate reality, running the script causes Danmakufu to stop responding and crash. I suspect something to do with an infinite loop of some sort, but I've yet to isolate the issue. Halp.
-
shut up
Alright, so let's explain this more carefully.
You don't put your loops in your @Initialize.
Instead, you call a task containing your "moving" functions, like so:
task MovingTask { loop{ wait(180); SetMovePositionRandom01(48, 48, 3, GetClipMinX, 32, GetClipMaxX, 128); } }
You then call MovingTask; in @Initialize, once only.
Is there something you missed out when you learned how to use tasks and yield (and not at all likely loops)?
-
This is not exactly a Danmakufu problem, but I recall to seeing a thread about menu making or something, does anybody knows the thread or can provide a link to a place where I can learn that?
-
http://dmf.shrinemaiden.org/wiki/index.php?title=Wonderful%E2%98%86Life%27s_Introduction_to_Menus
-
There's also this
http://www.shrinemaiden.org/forum/index.php/topic,9281.msg618739.html#msg618739
-
Hello , I have a question , or rather a "look at my script and see what is wrong" thing. :V
So It's giving me the errors about my mid boss and my boss. But I followed every thing I need to fill in.
http://pastebin.com/Cmct5cwN
I don't know what's wrong :wat: if the plural commands isn't working then why are the normal call out enemy commands don't have any problem ?
Edit : A little more information
CreateEnemyBossFromFile(GetCurrentScriptDirectory~"talk2.txt", 0, 0, 0, 0, 0);
This somehow worked :wat: it's a talk event. Now in the new script, it doesn't.
CreateEventFromScript(GetCurrentScriptDirectory~"talk2.txt");
There is no error message but nothing comes up on screen, the script doesn't continue
CreateEnemyBossFromFile(GetCurrentScriptDirectory~"mid boss.txt", 0, 0, 0, 0, 0);
CreateEnemyBossFromFile(GetCurrentScriptDirectory~"boss.txt", 0, 0, 0, 0, 0);
-
CreateEventFromScript(GetCurrentScriptDirectory~"talk2.txt");This says CreateEventFromScript, not CreateEventFromFile (which doesn't even exist by the way).
CreateEnemyBossFromFile(GetCurrentScriptDirectory~"mid boss.txt", 0, 0, 0, 0, 0);
CreateEnemyBossFromFile(GetCurrentScriptDirectory~"boss.txt", 0, 0, 0, 0, 0);Only one boss enemy will be existant at one time, so you'll have to put some kind of function that delays until the Midboss is defeated to spawn the boss.
-
CreateEventFromScript(GetCurrentScriptDirectory~"talk2.txt");This says CreateEventFromScript, not CreateEventFromFile (which doesn't even exist by the way).
Adding to this, what you need to do is something like this instead:
script_enemy_main {
@Initialize {
// blah blah blah....
CreateEventFromScript("talk2");
}
// blah blah blah...
}
script_event talk2 { // I honestly don't remember if you need to put talk2 in quotes or not... if this doesn't work, try it with quotes
// blah blah blah...
}
All of that is in the same file.
-
Something I've been stumped on for sometime about danmakufu...How does danmakufu determine appriopriate hitbox size of bullets? In the ShotReplaceScripts I see no mention of hitbox size.
ShotData{
id = 1
rect = ( 0, 0, 12, 12 )
delay_color = ( 255, 63, 63 )
}..which leads me to believe that all bullets are automatically given hitbox sizes from the sprite based on some sort of formula. Is that correct or is there some other explanation? :wat:
-
Pretty much rect/2 or rect/3 depending on who you ask.
-
Based off of what little testing has been done around here, it seems to be a circle with a diameter that's maybe half the length of the shorter side of the graphic rectangle that you define in the shot definitions.
-
Danmakufu does not let me assign numbers to a 2-dimensional array, while it can read those values. What brings error is any assignment of the kind
a[i][j]=n;
-
When dealing with 2d arrays Danmakufu is stupid and can't change a single value. IIRC your only option is to redefine the second array completely. I could use some confirmation, I don't have Danmakufu at hand to test this.
-
That's true about the arrays... IIRC, I think all, or most, real programming languages are like that also...
Well your only option is, like zengar said, to redefine the second array...
let temp=a[i];
temp[j]=n;
a[i]=temp;
-
That's true about the arrays... IIRC, I think all, or most, real programming languages are like that also...
If it were true for more programming languages, people wouldn't be so confused and annoyed when learning about this in Danmakufu. :V
Another thing about Danmakufu's arrays is that it can't store multiple data types when many programming languages can.
-
How can I define the value of a variable as "any integer"?
-
How can I define the value of a variable as "any integer"?
Uh.
You want a random integer?
rand_int(min, max)
Putting that into the let statement you have, you'd get
let variablename = rand_int(min,max);
-
Not necessarily. I was more going for "equals any and all real integers at all times". In other words, a variable that's ACTUALLY variable.
-
Not necessarily. I was more going for "equals any and all real integers at all times". In other words, a variable that's ACTUALLY variable.
You can't have a variable be ALL real integers at all times (like -100000 and 1006 at the same time)
That just isn't a function.
-
Not necessarily. I was more going for "equals any and all real integers at all times". In other words, a variable that's ACTUALLY variable.
wat
How can I define the value of a variable as "any integer"?
Danmakufu can only store numbers as floats. If you want to check that the value is an integer in the sense that all the decimals are 0s, you can do variable%1 == 0. If it's true, it's an integer. Otherwise it has nonzero decimal values.
EDIT: Perhaps we should be asking what you're trying to accomplish instead of answering your question directly. As it is now, your question is kind of nonsensical. No programming language let's you store ALL real integers in a single variable because there are an infinite amount of them...
-
Finally, i got what Lucas told me in Q&A thread 4 to work.
http://pastebin.com/PaLW9Qzj (http://pastebin.com/PaLW9Qzj)
But about this:
ascent(i in 0..length(objarr)){ //Go through all objects and remove self
if(objarr[i] == ID1){
objarr = erase(objarr,i);
break;
}
}
What does the command break do? And why does it have to be after the closing bracket of while(!Obj_BeDeleted(ID1)){?
-
Finally, i got what Lucas told me in Q&A thread 4 to work.
http://pastebin.com/PaLW9Qzj (http://pastebin.com/PaLW9Qzj)
But about this:
ascent(i in 0..length(objarr)){ //Go through all objects and remove self
if(objarr[i] == ID1){
objarr = erase(objarr,i);
break;
}
}
What does the command break do? And why does it have to be after the closing bracket of while(!Obj_BeDeleted(ID1)){?
break is used to break haha I'm so clever
out of a loop, while, ascent, or descent prematurely. In your first example, the code is searching through objarr to delete the value that ID1 matches from it. When it enters the if block, since it had accomplished what it was trying to do already, it just breaks out of the loop to avoid wasting processing time checking the rest of the array. It's not being used in the while loop because if you break out of the while loop, it won't wait for the bullet to be deleted before it removes the id from the array.
-
Before I ask for help, I'd just like to say that I started using Danmakufu yesterday and I have little to no idea as to what I'm doing...so bear with the stupidity :)
I'm looking to make bullets and lasers to wait before firing in this script:
CreateShotA(1, GetCenterX, GetCenterY-90, 10);
SetShotDataA(1, 0, 5, 0, 1.9, 0, 5, RED22);
ascent(i in 1..2){
CreateShotA(2, 0, 0, 10);
SetShotDataA_XY(2, 0, rand(-1, 1), rand(-1, 1), 0, 0.1, 0, 1, PURPLE31);
AddShot(i*0, 1, 2, 0);
i++;
}
CreateLaserB(3, 800, 12, BLUE01, 130);
SetLaserDataB(3, 0, 0, 0, 0, rand(0, 360), 0, rand(0, 360), 0);
SetShotKillTime(3, 190);
FireShot(1);
FireShot(3);
}
}
I did use Blargel's tutorial script as a basis for this, so if it looks familiar, that's why...I'd like to make both the Butterfly bullets and the lasers wait so they are not constantly being drawn...I'm unsure how to make use of a wait function, so any and all help would be appreciated so I don't end up dodging perpetually forming lasers! What I'd like to do in the end is create a few randomly angled lasers which delay for a few frames and then fire, a lot like Minoriko Aki's "Bumper Crop - Promise of the Wheat God" in MoF. Any help and a great deal of patience for my stupidity is appreciated!!!
Thanks,
Ace
-
I did use Blargel's tutorial script as a basis for this, so if it looks familiar, that's why...I'd like to make both the Butterfly bullets and the lasers wait so they are not constantly being drawn...I'm unsure how to make use of a wait function, so any and all help would be appreciated so I don't end up dodging perpetually forming lasers! What I'd like to do in the end is create a few randomly angled lasers which delay for a few frames and then fire, a lot like Minoriko Aki's "Bumper Crop - Promise of the Wheat God" in MoF. Any help and a great deal of patience for my stupidity is appreciated!!!
Thanks,
Ace
IF you are using tasks, just insert this in the script_enemy_main: function wait(t){loop(t){yield;}}
Then, after your FireShot part, just insert wait( t ), where t is a number of frames the task should pause for. Like this:
FireShot(1);
FireShot(3);
}
wait(120);This will stop the task from continuing for 120 frames.
-
I don't get the feeling he's using tasks.
Can you please post your entire script into a pastebin (http://pastebin.com/) and post it for us?
-
I'm looking to make bullets and lasers to wait before firing in this script:
I have no idea what you mean by this.
Also if all you looked at is my tutorial, then you are almost definitely not using tasks so don't bother with the wait function Darkness1 suggested.
Anyways, try to describe what you're trying to accomplish a little better. Did you want the bullets and lasers to be delayed for120 frames? Did you want to shoot bulletss first, wait 120 frames, and then fire lasers (or vice versa?)? Did you want your AddShot bullets to be added 120 frames later?
-
Some things I wanted to ask:
1,. No matter what I do, the Spell Score is always higher than the one I specified (say, I put 150000 and it starts aat 300000), does it multiply the score or something?
2.- The next script has no problem, but I wanted to get feedback about the scripting method(I know, not the thread to, but didn't want to open a thread just for this) http://pastebin.com/ASvXf1z7
-
1,. No matter what I do, the Spell Score is always higher than the one I specified (say, I put 150000 and it starts aat 300000), does it multiply the score or something?
Danmakufu's spellcard scoring system is bizarre. I do know that if you disable the rating system, the initial spellcard score in game will be 3x what you put in the script for some reason. I don't really know any good way to work around this besides making your own spellcard system...
2.- The next script has no problem, but I wanted to get feedback about the scripting method(I know, not the thread to, but didn't want to open a thread just for this) http://pastebin.com/ASvXf1z7
You want someone to yell at you for scripting stupidly? SOUNDS LIKE A PLAN! Honestly speaking though, it's not too bad. The fact that you have comments really helps with readability. The following points are just opinions -- don't take em as an absolute truth or anything:
1.) So yeah, first point, fix your tabbing. It's not hard to follow the code right now because it's relatively simple and there's a good amount of comments, but when it gets more complex, properly tabbed code makes a huge difference in how easy it is to understand or debug. Here's a Wikipedia article on indent styles (http://en.wikipedia.org/wiki/Indent_style). Most people use some variation of the first example, but what really matters is keeping your tabbing style consistent.
2.) I think you need better names for your variables at the top. Make it more easily identifiable what each thing is. For example, it's obvious that ImgBoss is an image because it's prefixed with Img. However, something like Cut is really vague. The last thing I would expect it to be is a cut-in, honestly, if none of your stuff was commented. These two lines are especially bizarre:
let Layer2 = CSD ~ "\Pic\JackBG1.png";
let BG = CSD ~ "\Pic\JackBG2.png";
Why didn't you just name the variables BG1 and BG2? Basically, like my opinion on tabbing, I think you need a more consistent and less ambiguous naming scheme for your variables.
3.) Your handling of the timer sound is really inefficient. If you decide to change the timer of the spell, you'd have to redefine all the conditionals. Why aren't you using GetTimer (http://dmf.shrinemaiden.org/wiki/index.php?title=Mathematical_or_Information_Functions#GetTimer)?
4.) Your mainTask is doing nothing except calling your fire task. Unless you're planning to add more stuff to the mainTask, this is entirely pointless and you should just call the fire task directly.
5.) Your fire task can be simplified greatly with a loop, specifically an ascent. Also you don't really need to use 4 different ids for the bullets. Here's my revised version that should behave exactly the same:
ascent(i in 0..4){
CreateShotA(1,GetEnemyX,GetEnemyY,10);
SetShotDataA(1,0,1,dir+i*90,0,0,1,24+i);
SetShotDataA(1,60,0,dir+i*90,0,0,1,24+i);
SetShotDataA(1,210,1,dir+i*90,0,0,1,24+i);
SetShotDataA(1,270,0,dir+i*90,0,0,1,24+i);
SetShotDataA(1,440,1.5,rand(0,360),0,0,1,9+i);
FireShot(1);
}Also, I changed rand(0,359) to rand(0, 360). I suppose it doesn't really make too big a difference, but technically you were missing 1 whole degree between 359 and 360 :V
6.) At the very end of your fire task, you have both a wait(1); and a yield; . wait(1) is the same thing as a yield so you're actually yielding twice. This is causing the boss to run that loop once every other frame instead of every frame. If that was your intention, you should probably use wait(2); instead of one wait(1); and one yield;
That's all I can find that bugged me about your scripting style. Honestly though, if you don't plan on collaborating, none of this really matters. All my tips are just to improve readability. If you're going to be writing everything yourself and not sharing it, as long as you can remember what you were doing, it's not really necessary to write clean code. Unless you're making something huge. :derp:
-
I know, the script is a hot mess...I tried using task fire{ }, but the bullets just stopped firing (I'm undoubtedly doing something wrong). I know how to make the bullets delay firing, but the problem I'm having is that the bullets are just perpetually firing instead of say, one bullet every ten frames, so instead of a stream of butterflies, I get an unmoving streak of them. I have this same problem with any other type of bullet too. As for the lasers, they are just firing randomly as well, but I'd really like them to wait, fire, wait, fire, etc...
http://pastebin.com/KVNTQYfW
I'm really sorry for my naivete and I hope I can improve to the point where I'm not making stupid mistakes all the time...
Thanks again.
-
I know, the script is a hot mess...I tried using task fire{ }, but the bullets just stopped firing (I'm undoubtedly doing something wrong). I know how to make the bullets delay firing, but the problem I'm having is that the bullets are just perpetually firing instead of say, one bullet every ten frames, so instead of a stream of butterflies, I get an unmoving streak of them. I have this same problem with any other type of bullet too. As for the lasers, they are just firing randomly as well, but I'd really like them to wait, fire, wait, fire, etc...
http://pastebin.com/KVNTQYfW
I'm really sorry for my naivete and I hope I can improve to the point where I'm not making stupid mistakes all the time...
Thanks again.
You must have an endless loop in the task for the bullets to never stop spawning. Like this:
task fire{
//stuff that's not supposed to loop, like let frame, let angle etc.
loop{
//stuff that's supposed to loop, like bullets firing.
//wait function after the action so it doesn't endlessly create bullets.
//The loop/task must contain atleast one yield/wait.
//Also remember to put a yield in maintask.
}
}
If you code in mainloop, you have to use frame/counter statements:
let frame = 0;
@MainLoop{
frame++;
if(frame==60){
//Fire bullets and do stuff after 60 frames.
//Then, after it's been done, reset the counter so it can count up to 60 again.
frame = 0;
}
}
EDIT: Oh, sorry. Misspelled.
-
You must have an endless loop in the task for the bullets to never stop spawning. Like this:
If you code in maintask, you have to use frame/counter statements:
Not to be picky, but there is a difference between maintask; and @MainLoop.
- Maintask; is a task that controls whatever is designated to it and is a product of the tutorials. It is not an essential part of the script, but it does help organize things a bit. It does not loop unless a loop(){} is put in it. A yield; or wait(); is not necessary unless there is a loop inside it.
Like this:
task maintask1{
stuff; // another task
}
task stuff{
loop{
ShootDownPlayer; // :P
wait(60);
}
}
Or this:
task maintask2{
loop{
destroyeverything; // another task
wait(120); // 2 second break
}
}
The @MainLoop is a loop that is integrated into the script and must always be there. As you said above, in order to implement this section of the script properly, you must use a variable and counter statements. If you are not going to be using the @MainLoop to script the actions, then you must leave a yield; in it. If there are no tasks in your script, then you do not need to add a yield; since it loops after one frame regardless. (However, leaving one in there does not affect the script in the slightest.)
It is possible to use both tasks and the @MainLoop to script: create the counter statements you want in the @MainLoop, integrate whatever tasks you want into those statements, and then drop a yield; at the beginning or end of the loop. Leaving out the yield; will make the script NOT check for any tasks outside of the @MainLoop.
-
You two didn't even look at his pastebin. :wat:
ByakuganAce, I explained the concept of variables and control statements here (http://www.shrinemaiden.org/forum/index.php/topic,30.msg171.html#msg171). A little later, I show how to use them here (http://www.shrinemaiden.org/forum/index.php/topic,30.msg202.html#msg202) to make bullets fire less often.
-
Yeah, I'm rather new to Danmakufu as well, though I have some prior experience with programming. (Python, I keep typing "rand_int" as "rand.int" >.>) Anyway, I was fiddling around with my first simple spellcard, and I wanted to try out Helepolis's custom cut-in script I saw the link to in the information thread. And I haven't been able to get it to work for some reason. There's no error message, there's just simply no cut-in at all, and it acts like a non-spell, except that it gives a spell bonus at the end when it does normally because of "SetScore".
The "function_cutin.txt" file is in the script folder ("tutorial"), and the spellcard picture is in a "system" folder inside the "tutorial" folder. I've put the relevant part of my script (up to the end of @Initialize) here: http://pastebin.com/wi2PQjmr (http://pastebin.com/wi2PQjmr), though I suspect that it has something to do with where I placed the function and picture files. In accordance to the readme, I extracted the .zip to the scripting directory ("tutorial"), but I think that something might be up there, as everything else seems to be in order. (Yes, the cut picture is in the proper place. Using the regular 'CutIn' works, by the way.)
-
there's just simply no cut-in at all
You obviously didn't load the graphic with LoadGraphic before you declared the cutin function.
LOAD IT LIKE THIS DRYER.
-
You obviously didn't load the graphic with LoadGraphic before you declared the cutin function.
LOAD IT LIKE THIS DRYER.
LoadGraphic(cut);
LoadGraphic(bg);
shotinit;
cutin("NAZRIN","River Sign"\""Rippling Waves"\",cut,0,0,256,512);It's in the pastebin I posted. Doesn't work. As I noted above, works perfectly with the regular 'CutIn' function when it's placed in the same spot, with only the first parameter changed.
-
It's in the pastebin I posted. Doesn't work. As I noted above, works perfectly with the regular 'CutIn' function when it's placed in the same spot, with only the first parameter changed.
let CSD = GetCurrentScriptDirectory;
let cut = CSD ~ "\system\face03ct.png";
cut = "script\tutorial\\system\face03ct.png"
Duh.
Quick note: the default CutIn function does not need to have loaded the cut graphic used in order to display it.
For custom cutin functions however you do have to load your graphics.
-
Oh. Duh indeed. Weird how I did the same thing for the sprite and the background yet those still worked...
What the heck...it still doesn't work...
-
Thank you for all of the help! I got the wait function to work, but the loop function causes my computer to freeze with the sprite about halfway through its descent.
http://pastebin.com/y2XM8FcE
Can anything be done to stop this?
-
task fire{
loop{
CreateShotA(1, GetCenterX, GetCenterY-90, 10);
SetShotDataA(1, 0, 5, 0, 1.9, 0, 5, RED22);
ascent(i in 1..2){
CreateShotA(2, 0, 0, 10);
SetShotDataA_XY(2, 0, rand(-1, 1), rand(-1, 1), 0, 0.1, 0, 1, PURPLE31);
AddShot(i*0, 1, 2, 0);
i++;
}
FireShot(1);
}
wait(60);
yield;
loop{
CreateLaserB(3, 800, 12, BLUE01, 130);
SetLaserDataB(3, 0, 0, 0, 0, rand(0, 360), 0, rand(0, 360), 0);
SetShotKillTime(3, 190);
FireShot(3);
}
wait(300);
yield;
}
(I have only changed the tabbing for readability purposes.)
Both of the loops have the waits/yields placed outside of them. Move them inside and it should work.
Also, just a little note: a wait(x) is an x number of yields, so you don't need the extra yield after a wait (unless you want to have x+1 number of yields).
-
loop{} loops infinitely. Even if the yield/wait was moved inside them, it would never exit the first loop and the rest of the code would never be read. You're probably looking for loop(number) which loops number amount of times, or while(something) which loops while "something" is true (like while(GetLife>1000), for example).
-
Or if you want both of them to run simultaneously, you can break the task into two.
-
So to break the task in two, I could just make another task fire function and name it somethiing like task fire2 and then in task mainTask, have fire2 after fire?
-
@Initialize
{
mainTask;
}
task mainTask
{
Wait(120);
Fire1; //You can put a pause between Fire1 and Fire2 if you want for some reason
Fire2;
}
task Fire1
{
loop{yield;}
}
task Fire2
{
loop{yield;}
}
-
BRILLIANT!!! Thank you guys so much! I appreciate all of the help with this...I feel like I'm well on my way now :D
-
I'm a complete noob at danmakufu and don't hurt me.
But.
Is there a tutorial on how to do bullet patterns like spirals and crud?
because all i can manage is erm...
singular bullets
-
Look at this (http://dmf.shrinemaiden.org/wiki/index.php?title=Danmakufu_Intermediate_Tutorial) if you can handle straight bullets well already.
Look for the "tasks" part, especially. Once you understand that, it's all about geometry.
In particular you have several choices for a spiral :
- Control angle for a bullet at a constant speed, by decreasing angular speed (each frame, add w to the angle, then reduce w a little);
- Directly control the x and y coordinates by setting them to x=x0+R*t*cos(t*w) and y=y0+R*t*sin(t*w) with any value you like for those variables, increasing t each frame. (Note that if t increases linearly, the speed also does, you might prefer something like t=t+1/(t+1)...)
-
How do you make a bullet move in a circle around the boss at a given radius? I know that you're supposed to increase it's angle every frame by an amount depending on how long it will take for the bullet to complete a circle, but I don't know how to calculate how long it takes.
-
The way I prefer to do things is update the X and Y positions every frame using a formula based on time. For example:
X = CenterX + A*cos(6/b*frame+offset)
Y = CenterY + A*sin(6/b*frame+offset)
In this case, CenterX and Y will be GetX and GetY if you want them to move around the boss
A will be the radius of the circle in pixels
b will be the number of seconds to complete a rotation (you can also just use b*frame instead and calculate the revolution speed by finding the value frame needs to be so that b*frame = 360 and remembering that there are ~60 frames to a second)
offset is used if you want to make multiple bullets starting at different locations in the circle. If you want 4 evenly spaced bullets spawn one with offset 0, then 90, 180, and 270
-
A simple object bullet for it too: http://pastebin.com/7shMFh77 (http://pastebin.com/7shMFh77)
A negative or positive value for speed determines the rotation direction.
-
Hi, I was wondering if it was possible at all to implement a database of high scores?
I've been considering using Danmakufu as the coding language for my senior computer studies project, but a necessary feature is a high scores database.
Is it possible at all to write to a .txt file? I was thinking the final score would be written on a new line and then to display the top 10 scores, coding would find all the scores in the file, put them in descending order and then display the top 10.
Or is it possible to link in an SQL database (although I doubt this would be possible).
-
Is there anyway to draw more than one graphic at once? I have a boss sprite, but I also would like to add in a sprite of an eye opening. The other problem is that I don't want this eye to have a hitbox...I tried simply placing it in the DrawLoop with braces around it and loading it as such, but it didn't seem to work. Creating multiple "task Draw"s has been unsuccessful as well. I would also like for this eye to go through the opening animation after 120 frames. Script is here: http://pastebin.com/0gQQE7mv
Any help is appreciated! Hope I'm not missing something obvious >.>
-
Uh ? You don't even seem to try to draw anything else in the script you pasted ... ?
-
Yes I did (at least I think so)...it's right in draw loop. I don't have the script for drawing in the eye, but that just because I can't figure it out. The sprite I'm using appears fine, but I just don't have the knowledge to draw in another graphic at the same time :/
-
You could use effect objects, if you have the time to learn about it. If you're doing advanced programming for the graphic, you may think it's easier to use, even though it's harder to draw. Then you could just use:
while(!Obj_BeDeleted(EYE)){
wait(120);
//Animation coding.
Obj_Delete(EYE); // If you want to create it, delete it and later respawn the graphic.
}
-
I'm not sure what you wish the script to do. I tested it's in fact animated. Now I'm wondering why you have these GetSpeedX since it's always equal to 0 in your script.
-
Effect objects are seeming like the best idea, but I'm not really sure how to find the proper vertices to use...Can someone give me a hand? Here's the sprite sheet for the eye if that helps... http://imageshack.us/photo/my-images/6/eyen.png/
-
The only way for me to understand it was with Helepolis video tutorial: http://www.youtube.com/watch?v=EMw7DOWYMkw&feature=channel_video_title (http://www.youtube.com/watch?v=EMw7DOWYMkw&feature=channel_video_title)
Probably, you're going to use four vertices, and give them XY positions. They are counted from the center of the game point. One eye seems to be about 56 x 72 pixels large. Then the XY vertices should be
0 : -28 and -36.
1 : 28 and -36.
2 : -28 and 36.
3 : 28 and 36.
Then you set the point in the graphic for the vertices using UV. It should be like this:
0 : 14, 5.
1 : 70, 5.
2 : 14, 77.
3 : 70, 77.
These coordinates are only for the closed eye, and i might have made some mistakes. This uses the same primitive type as in helepolis video, the triangelstrip. Using effect objects is hard work, but the results may be really good.
-
Ok, the effect object worked brilliantly for making the closed eye, but now I can't get the eye to "open" by going to the next sprite...Here's what I've got: http://pastebin.com/DejPxDZV
I'm not sure what I'm doing wrong, but at least it's not crashing my game...the eye just vanishes after 120 frames instead of opening, even though the while loop is right there. Can anyone figure this out? >.<
EDIT: Thanks for the link, Darkness1!!! That tutorial made it so much simpler to understand the purpose and use of effect objects ^_^
-
For sure it vanishes, since you delete the object when the counter equals 120. Your while(!Obj_BeDeleted(obj)) loop is not needed at all :ohdear:
-
What Ginko said, it deletes when the counter reaches 120, and the animation starts after the counter reaches 120. Also, unlike drawloop, you don't have to loop what's being shown, because you're using SET functions. So you don't need to use while for the vertices. And because the XY vertices are the same for both of the eyes, you don't have to use that command again. I would do it like this :
task EYE(deletetime){
//coding for the effect object, including the starting vertices.
while(!Obj_BeDeleted(obj)){
counter++;
yield;
if(counter==120){
ObjEffect_SetVertexUV(obj, 0, 13, 85);
ObjEffect_SetVertexUV(obj, 1, 69, 85);
ObjEffect_SetVertexUV(obj, 2, 13, 159);
ObjEffect_SetVertexUV(obj, 3, 69, 159);
}
if(counter==deletetime){
Obj_Delete(obj);
}}}
-
You could also just create an enemy and just skip the code that defines the hitbox.
-
Cool! Getting rid of that loop took care of it perfectly...now to add a background :D Thanks guys!
EDIT: I can't quite remember what you use to say "while the enemy has this much health, do this..." <-- for use in a task loop
Just a quick question if someone wouldn't mind answering...
-
if(GetLife == X){
do something;
}
or
if(GetLife <= X){
do something;
}
or
if(GetLife >= X){
do something;
}
-
Danmakufu Functions Page (http://dmf.shrinemaiden.org/wiki/index.php?title=Functions).
So in your case, the right condition is "GetLife > N" in the main boss' script, or "GetEnemyLife > N" in another enemy script.
-
Excellent! Thanks again ^_^
-
*sigh* Sorry to keep bothering you guys :/ I have yet another STUPID question...
I want the loop in the fire loop in this script http://pastebin.com/CgXbCTQm to loop every 60 frames...I've tried using a counter variable and counter++; along with the while loop, and I've also tried placing this loop inside another loop that waits for 60 frames, but neither of them has worked...If I'm on to anything with these, or if there's another way, could someone please help me make it work? I'm really sorry to be such a constant bother >.<
-
Let's take a look at what your fire task is doing.
task fire{
loop(5){ // In a loop for 5 loops...
PlaySE(CSD~"sound\Shot1.wav"); // you are playing a sound...
bullet(GetEnemyX,GetEnemyY,5,45,237,0);
bullet(GetEnemyX,GetEnemyY,5,135,237,0);
bullet(GetEnemyX,GetEnemyY,5,225,237,0);
bullet(GetEnemyX,GetEnemyY,5,315,237,0); // firing 4 bullets...
wait(6); // and waiting 6 frames in between each loop.
} // After this loop is finished...
loop{yield;} // you are yielding in an infinite loop forever for no apparent reason.
}
There is absolutely no point to the second loop. If you want to repeat the first loop indefinitely, stick it inside another loop that goes on indefinitely like so:
loop {
loop(5){
// stuff
wait(6); // 6 * 5 = 30.
}
wait(30); // 30 + 30 = 60 so it'll start the bullet firing loop after 60 frames.
}
-
Worked like a charm! Thank you for tolerating my stupidity! This is the epitome of my stupid, but...what is the purpose of having a yield; ? I just can't figure out the significance :/
-
You should probably get a better explanation from someone who knows more about programming than me, but yeah.
DMF reads and interprets code frame by frame.
Let's say you've got a block of code. For the first frame (or zeroth, whichever one), DMF will perform actions based upon the code. If a yield is inserted anywhere into the code, then DMF will assume that's the end of the code you want performed during the initial (ha!) frame and will move onto the next frame. Then for the second frame (or first dammit), DMF will perform any actions coded to perform on that frame, and so on and so forth. The entire script is read like: what happens on frame #1, what happens on frame #2, what happens on frame #3, etc.
If you have something like:
doawesomeshit; // task
domoreawesomeshit; // task
wait(30); // or loop(30){yield;}
BURNINATE; // task
then DMF will initiate the first and second tasks, perform no actions in that particular section of code for 30 frames (half a second), then initiate the third task. Consecutive actions will run on the same frame unless there is a yield; or wait(); in place.
-
Worked like a charm! Thank you for tolerating my stupidity! This is the epitome of my stupid, but...what is the purpose of having a yield; ? I just can't figure out the significance :/
http://www.shrinemaiden.org/forum/index.php/topic,9281.msg635706.html#msg635706
I should save a list of links to posts that explain things that are commonly asked from now on. :3
-
You're simply asking Danmakufu to do several things simultaneously. Yet :
- you can't necessarily make several things at a time
- you want them to be connected timewise, which won't be natural; some things need a lot of time to be done, and you don't want it to be slower than the rest.
- you don't want a value to me modified while it's being read by something else.
The multiple blocks of code that are simultaneously supposed to happen here are the main loop and the tasks. Those threads are competing for being processed, but you want them to apply in a certain order in order to avoid all the mess above. So you give each of them a token. Whenever you want to give some processing to another thread, you have this thread yield, and take back its token, then give your process time to a thread that still has his token. When noone has any token, you give each thread one.
-
Ok, makes sense now...thanks guys :) I'll undoubtedly be back, but for now... thanks!
-
Ya, so I wanted to test out my script but....I got an error. Before the stage even started, like when I select a character the error comes up. I had my older brother translate it, it says that it can't find my script...and it's in the script folder, so, I don't really know why. >.<
-
Please take a screenshot of the error. Your telling us it can't find the script is pretty much wrong, since if it couldn't find your script it simply wouldn't be in DNH's list. It erroring before running happens in 90% of errors, it means you have a syntax error or some such thing.
Also, please post in the Danmakufu Q&A thread next time. You didn't even hit the right forum. (http://www.shrinemaiden.org/forum/index.php/topic,9281.0.html)
-
And I was right...here I am again >.<
Where does one go about finding Reimu without a hitbox?
-
Where does one go about finding Reimu without a hitbox?
You would like to create your own System.png and edit it to remove the hitbox graphic.
Lemme give you a dat extraction.
-
Sorry, back again :( How do you make object bullets accelerate? I can't think of anything that works...I want to make two circles of ten object bullets on either side of the boss that accelerate so that they are spinning faster, and then to launch the circles of bullets at the player. I tried to do it with CreateShotA instead, but when I call a second SetShot to launch the bullets, they all leave from the same point in a line instead of remaining as a circle. Any takers?
I know, I have a ton of questions :/
-
Sorry, back again :( How do you make object bullets accelerate? I can't think of anything that works...I want to make two circles of ten object bullets on either side of the boss that accelerate so that they are spinning faster, and then to launch the circles of bullets at the player. I tried to do it with CreateShotA instead, but when I call a second SetShot to launch the bullets, they all leave from the same point in a line instead of remaining as a circle. Any takers?
I know, I have a ton of questions :/
Acceleration with object bullets can be achieved, but it is not easy. It has to do with changing the rate of movement over pixels in relation to time.
For example: A standard CreateShot01 aimed at 0 degrees (straight right) at a speed of 2 will adjust its position 2 pixels to the right of its current position every frame. The same CreateShot01, different in that it is now aimed at 45 degrees (right-down), will adjust its position by 2 * cos(45) pixels [x-position] and 2 * sin(45) pixels [y-position] every frame.
In order to make an object bullet accelerate or decelerate, it needs to have variables and control statements for monitoring its current position, its current movement speed per frame, the final movement speed per frame, and the rate at which to adjust the current movement speed until it reaches its final movement speed. There also needs to be a checking system in order to ensure that the values given to the object bullet are logical (you can't assign a bullet -0.15 deceleration and expect it to go faster).
Here is a little script demonstrating this. (http://pastebin.com/6idSL3rb) I know there are some problems with it, but I think it demonstrates the concept of what I'm trying to explain.
---
And if you're having problems with CreateShotA, then you should post your script. It'll make debugging it much easier than having us guess at what the problem is.
-
Sorry, back again :( How do you make object bullets accelerate? I can't think of anything that works...I want to make two circles of ten object bullets on either side of the boss that accelerate so that they are spinning faster, and then to launch the circles of bullets at the player. I tried to do it with CreateShotA instead, but when I call a second SetShot to launch the bullets, they all leave from the same point in a line instead of remaining as a circle. Any takers?
I know, I have a ton of questions :/
Acceleration with object bullets can be achieved, and it is easy. Seriously ...
If you just want to make bullet spin, usually, you can have a time counter "t" and do the following each frame, with a 0 speed bullet :
t++;
Obj_SetX(obj, x + R*cos(offset + angularspeed*t));
Obj_SetY(obj, y + R*sin(offset + angularspeed*t));
Obj_SetAngle(obj,offset+t+90); //optional
yield;
Now you want the bullet to accelerate ? Just accelerate the time ! For example if you use (a*t)*t instead of t and your bullet spins for 300 frames, the bullet will accelerate from 0 to a*300 times the speed it had above. A value of "a" around 1/100 seems reasonable, then.
t++;
Obj_SetX(obj, x + R*cos(offset + angularspeed*a*t*t));
Obj_SetY(obj, y + R*sin(offset + angularspeed*a*t*t));
Obj_SetAngle(obj,offset+t+90); //optional
yield;
-
Worked wonderfully! Sorry I'm so bothersome :/
-
3.) Your handling of the timer sound is really inefficient. If you decide to change the timer of the spell, you'd have to redefine all the conditionals. Why aren't you using GetTimer (http://dmf.shrinemaiden.org/wiki/index.php?title=Mathematical_or_Information_Functions#GetTimer)?
[/quote]
Well, GetTimer doesn't work with my script for some reason, it doesn't crash or anything, but the sound doesn't play.
So, I came up with another way to manage the timer:
let Timeout = 3000; //This value will change depending on the time the spell lasts. This spell lasts 60 seconds.
let Rep = 0;
//at the main loop
loop(6){if(fcount == Timeout + (60 * Rep)){PlaySE(Time1); Rep+=1;}}
loop(4){if(fcount == Timeout + (60 * Rep)){PlaySE(Time2); Rep+=1;}}
It uses less code, and if the timer changes, I only need to modify one value.
EDIT: BTW, I just put "10" as the value of the SetScore and the result was 29 in-game. I then put 1 and the result was "2" in game.
I don't know how this works, but the formula of this can be discovered. I hope...
-
Asking questions about 3D drawing cause it goes horrible for me:
- Is there anyway to calculate 3D positions? It's so hard to get the pieces to fit together as well as looking good. (And if i were to rotate my 3D object, I'm sure of that they actually aren't fitting together.)
- Okay, i got no clue here. I'm drawing the floor at the start of BackGround and then the bookshelves, but the floor is drawn on top of the bookshelves. I am using Zbuffer and i don't know how to make the floor be drawn behind the bookshelves entirely.
Pastebin: http://pastebin.com/9vx1cm9j (http://pastebin.com/9vx1cm9j)
-
Asking questions about 3D drawing cause it goes horrible for me:
- Is there anyway to calculate 3D positions? It's so hard to get the pieces to fit together as well as looking good. (And if i were to rotate my 3D object, I'm sure of that they actually aren't fitting together.)
- Okay, i got no clue here. I'm drawing the floor at the start of BackGround and then the bookshelves, but the floor is drawn on top of the bookshelves. I am using Zbuffer and i don't know how to make the floor be drawn behind the bookshelves entirely.
Pastebin: http://pastebin.com/9vx1cm9j (http://pastebin.com/9vx1cm9j)
Oh my, your code is quite messy. First of all: SetViewTo and SetViewFrom are camera functions. You only call them once in the beginning of your stage and modify them only if you wish to change the view. Right now it looks like you are swaying the camera to everywhere and nowhere.
Second: please show a screenshot how it currently looks for you. I cannot really make up from your code what is wrong.
Third (advised): Script your 3D objects as functions, so you can call them back with one line, instead of copy-pasting the entire block. For example:
SetTexture(bg2);
SetGraphicRect(0,0,512,512);
SetGraphicScale(1.2,1.2);
SetGraphicAngle(-90, 0, 180);
DrawGraphic3D(0,0,0);change this to
function createFloor(px,py,pz) {
SetTexture(bg2);
SetColor(215,215,215);
SetGraphicRect(0,0,512,512);
SetGraphicScale(1.2,1.2);
SetGraphicAngle(-90, 0, 180);
DrawGraphic3D(px,pz,py); // <--- parameters px y and z
}
So next time you call your floor for redrawing you just use createFloor(0,0,0); and it will be drawn at your given locations.
EDIT
About calculating your 3D positions. Welcome to Danmakufu, the wonderful engine that does not make your life easy. Basically you need to Trial & Error a lot with fitting the objects. Work with powers of 2 for all your objects (2 4 8 16 etc..). Remember that each object is calculated from the center of the object. You know, just like effect objects drawn at 0,0. So you need to visualize strongly on how you want to place the objects and then test endlessly how they appear. Some tips to keep in mind:
- Don't use dodgy scales (like 1.2,1.35). Stick to integers like 1,1 2,2 etc.
- Use powers of 2 for the GraphicRects etc
- Don't exceed GraphicRects beyond 1024 else it will show bad clipping when you are using fog.
-
It's still messy, but i changed them into functions and limited the use of camera functions: http://pastebin.com/sSbeH3W8 (http://pastebin.com/sSbeH3W8)
And here's a screenshot of how it looks: http://img189.imageshack.us/img189/3695/screenshotbg.png (http://img189.imageshack.us/img189/3695/screenshotbg.png)
The floor looks like water, it's on top of the other objects, especially on the left shelf's side for some reason.
EDIT:
I have a lot of problem with scaling the sides of the bookshelves as well as setting the right angle for it. Both are the same size of 512x512, which means that i have to scale them down incredibly much. Especially the sides, which are the smallest parts of the object. The front and top parts were much easier to do. But well, i could lower the SetGraphicRect...
-
Thanks for posting the screenshot, makes a lot of things clear.
First of all, what you are seeing here is not a mistake of drawing-order, but a mistake of positioning. Just take a look at your own code:
- Floor is positioned at: DrawGraphic3D(0,0,0); That means it is the center of X, center of Y axis and center of Z axis. With SetGraphicRect(0,0,512,512);
- Your shelf is positioned at: DrawGraphic3D(80,20,-20); with SetGraphicRect(0,0,512,512);
I am questioning whether you understand the usage of DrawGraphic3D. Let me explain to you:
- first number indicates where the object is placed on the X-axis (left or right)
- second number indicates how high the object is placed on the Y-axis (lower or higher)
- third number indicates how far or close the object is on the Z-axis (close / far)
[attach=1]
Notice how I marked the red dots and put the coordinates to them? That is how you should imagine your own stage. Your floor is at 0,0,0 meaning ANYTHING that you want to be higher than your floor, must have a Y-parameter greater than 0.
Ok now try to follow and think along:
You are positioning your shelf at Y axis: 20 (see the lime green highlighted number). Notice how the floor is positioned at 0? Basically it is your own fault for placing the shelf 'half-way' into the floor. GraphicRect indicates how big the object is suppose to be drawn. If you use 0,0,512,512 it means it will use the texture sizes X = 0 - 512 and Y = 0 - 512. Aka the object is 512x512 large at a scale of 1,1. Scale influences the graphicrect by stretching it so a 2,2 scale still uses the texture size 512x512 but STRETCHES the object to 1024x1024.
TL DR; your shelf is misplaced. Raise the Y-axis for your shelf, like at DrawGraphic3D(80,256,-20); Because the center of your shelf-graphicrect = 0,0 and thus technically it has from that center point, 256 to the left, 256 to the right forming 512 on the X-axis.
3D objects don't behave the same like Effect Objects where you have to use vertexes to define the shape and size. Because these are background functions, they can be easily placed.
-
To think that after all the time i had coded in danmakufu i didn't know such a simple thing... It makes more sense now, thanks!
But I'm still not so used to using the z-axis, nor do i know everything about it.
-
To think that after all the time i had coded in danmakufu i didn't know such a simple thing... It makes more sense now, thanks!
But I'm still not so used to using the z-axis, nor do i know everything about it.
Z-axis is used to put things closer or futher away from you. As you know, there are 2 methods of stage scrolling:
- Texture scrolling (just like in 2D drawing, scrolling the graphicrect)
- Moving 3Dobjects and resetting them each time.
It is kind of tricky to explain, perhaps a picture again:
[attach=1]
Here is what you do (this will show you why fuctions are going to be your friend for the rest of your 3D-stage making life):
- You create a variable called 'scroll' or w/e (let scroll = 0;)
- Place your floors exactly as they show up in the picture so Floor 1 = createFloor(0,0,0); Floor 2 = createFloor(0,0,-1024); Floor 3 = createFloor(0,0,-2048); (make sure you angle them proper so the Y-side is the longer length.
add the variable scroll to all Z parameters so it becomes:
- Place your floors exactly as they show up in the picture so Floor 1 = createFloor(0,0,0+scroll); Floor 2 = createFloor(0,0,-1024+scroll); Floor 3 = createFloor(0,0,-2048+scroll);
Now add at the end of your background loop or w/e scroll+=4; (or at the speed you wish to scroll) and if(scroll>2048) { scroll = 0; }
So what will happen now?
All the floor pieces will start moving closer to you. Because a negative value means the floor is away from you and is being moved towards you (by the scroll value). However, once the scroll variable hits 2048, all the floors will be re-setted back to their original location (because scroll = 0).
Now this will look very stupid if you leave it like this, but if you hide the last floor piece with a dense fog, the player won't even notice the floors being reset because the eyes will be fooled as if the floor pieces keep on coming. Logically, this requires repeating textures for all floors or plain texture, else it will be noticeable. And this is why the most creative builders will fool you with the SetFog.
Just to be warned, you won't probably get it the first time. I didn't either. Takes a lot of trial and error.
- Don't rush it
- Don't try to move EVERYTHING in one go.
- Do it step by step. Create the floors, move them. Use fog to hide the "resetting". Then carry on with the bookshelves.
-
Adding on to this, some of you may be wondering why you would go through the trouble of moving everything else when you can just move the camera and reset the camera's position after a bit while using fog to hide it.
LO AND BEHOLD! Another quirk of Danmakufu that causes fog to lag behind by a frame when calculating distance. For example, if your camera were at the position (0, 0, 0) and you move it to (0, 0, 10), when you render the fog, it'll still think the camera were at (0, 0, 0). It doesn't matter if you set the camera's position before or after you set the fog. Now this might seem negligible, but imagine the case where you want to reset the position of the camera. If the camera were at (0, 0, 2048) and you wanted to reset it to (0, 0, 0), when Danmakufu draws fog, it'll think the camera were still at (0, 0, 2048) for one frame, and quite likely you'll have a super thick cover of fog when there shouldn't be any. This will cause a very noticeable flash of your fog's color every time you reset the camera's position.
Of course, one bad
solution is to never reset the camera, but there's an upper limit to how big of a number can be stored in a variable, especially when Danmakufu stores everything as a float. Then there's the headache of cleaning up all the objects that have passed the camera while generating new stuff behind the fog.
-
Oh I didn't knew about that one yet Blargel. Wonders and mysteries of good 'Ol Danmakufu huh?
I wonder when that author is going to release a beta of the new Danmakufu engin. We checked the website, but still the same alpha version.
-
I CANNOT FIGURE THIS OUT!!! It's been irritating the crap out of me and I've tried everything I can think of and then some >.< I want this spellcard to form two circles (black and white) on either side of the boss and then I want these circles to travel above the boss but still at GetCenterX and remain there until further scripting. All I can do is make the bullets spiral or travel in a straight line to that point!!! In the script at the moment, the bullets only travel in a straight line, even though I have the formulas for circular movement (thanks Ginko!). My only thought was to make my own user-defined bullets of the circles using a printscreened shot and assign them an angular velocity, but I also can't get background to initialize for some reason, even though the code is right there, so I have no neutral color to eliminate in order to capture bullet sprites. If anyone knows what's going on, either with my background loop, my circles, or both, your help would be greatly appreciated! Script is here: http://pastebin.com/KTugyq61
And I guess that's my daily question >.<
-
Weird thing :
In your "bullet" task :
loop{
if(t==120){
Obj_SetPosition(obj,GetCenterX,Obj_GetY(obj) - 2);
}
wait(4);
}
You might have inverted the loop and the if : here, you'll never get out of the loop, and if t is not equal to 120 (which is the case), you're stuck in a loop that does nothing. What you want is to enter the loop if t is equal to 120.
-
Ok, that got rid of the straight line issue...sorry, I always mix up where I put ifs with where I normally put whiles in a task >.< So how do I make the circle move on its own without turning into a line or spiral?
-
Obj_SetSpeed(obj,0);
:derp:
-
Now I get this weird-ass twitchy thing >.< http://pastebin.com/q2h6qG1f
-
Speed should be 0 from the start.
-
It still twitches... Am I placing a loop wrong or something??? >.< http://pastebin.com/x6nPEsYB
-
loop{
Obj_SetPosition(obj,GetCenterX,Obj_GetY(obj) - 30);
}
I'll get angry if you keep doing this ...
yield; is your friend.
-
I'm sorry :( I really want to fix this, and I know I'm irritating...I'll stop asking questions, although this is really a small fraction of the questions I have...Sorry again :(
-
Uh no, I didn't mean you have to stop asking questions; I just want you to remember you have to check you use the yield; when it's necessary (in particular, there has to be one in your loops, or else all of it will be done at once, which is sort of a problem if your loop is infinite).
All we want is to help you release your scripts, so don't refrain from asking questions.
-
Right, sorry...misunderstood >.<
On that note...can you help me figure out why my background won't load?
And now I end up with slanted bullets... http://pastebin.com/fcuyJG3d WHAT THE HELL AM I DOING WRONG?!
-
loop{
Obj_SetPosition(obj,Obj_GetX(obj) + 2,Obj_GetY(obj) - 2);
yield;
}Each frame you add 2 to the object's x-coordinate and remove 2 from its y-coordinate, so it's ... normal if it's slanted.
-
Alright, so then how do I keep the circle as a cohesive object (i.e. no slanting or spiraling) and move it to a different location without it coming apart?
-
One thing you should consider is using that useless delay variable for this :
task fire{
let firedelay=0;
loop{
loop(60){
bullet(GetX-100,GetY,0,180,119,firedelay);
shot(GetX+100,GetY,0,180,247,firedelay);
wait(7);
firedelay=firedelay+7;
}
wait(320);
}
}
And then later in your task
task bullet(x,y,v,dir,graphic,delay){
let obj=Obj_Create(OBJ_SHOT);
let t = delay;
let z = 0.02;
Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,v);
Obj_SetAngle(obj,dir);
ObjShot_SetGraphic(obj,graphic);
ObjShot_SetDelay(obj,0);
ObjShot_SetBombResist(obj,false);
...
if(t==420){
...
-
Alright, that'll really help! Now about moving the circles without losing the shape...any suggestions or should I just find a way to make them user defined and give them an angular velocity?
-
Well what i wrote above was just for that, the key point is to give your bullets a "common timer", so if you fire your bullet bullet_i at the time t_i and you want them to move together at the time T, you can start a counter for bullet_i at t=t_i and make the new stuff happen when t equals T.
-
The counter variable makes a lot of sense, but the bullets stilll file out in lines...am I calling parameters for the object bullet wrong? http://pastebin.com/KhNscDT5 This is so frustrating >.< Thanks for all of your patience ^_^
-
Uh, i didn't put it in red last time, but still ... what did you think that firedelay variable was for ?
task fire{
let firedelay=0;
loop{
loop(60){
bullet(GetX-100,GetY,0,180,119,firedelay);
shot(GetX+100,GetY,0,180,247,firedelay);
wait(7);
firedelay=firedelay+7
}
-
Gah! Total hurr durr moment >.< Now I get this weird ass glowing on the white circle and then the bullets file out...in a straight line >.< http://pastebin.com/cuA8Uwst
Also, I'm trying to reset the counters of f and t so that the process loops, but I can't seem to put the f = 0; or t = 0; in the right place...any ideas?
-
You forgot to set the delay to 0 in your "shot" task.
If you want to process to loop completely, move the "let firedelay=0" clause.
task fire{
let firedelay=0;
loop{
let firedelay=0;
loop(60){
...
-
This all helps smooth things out, but my circles still won't move as cohesive units, only as lines DX I wish I could figure out what I'm doing wrong and stop bugging you guys :/
-
task fire{
let firedelay=0;
loop{
loop(45){
bullet(GetX-100,GetY,0,180,119,firedelay);
shot(GetX+100,GetY,0,180,247,firedelay);
wait(7);
firedelay=firedelay+7 (why did you change that ?)
}
wait(320);
}
}
task bullet(x,y,v,dir,graphic,delay){
let obj=Obj_Create(OBJ_SHOT);
let t = 0;
Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,v);
Obj_SetAngle(obj,dir);
ObjShot_SetGraphic(obj,graphic);
ObjShot_SetDelay(obj,0);
ObjShot_SetBombResist(obj,false);
while(!Obj_BeDeleted(obj)){
Obj_SetX(obj, x + 50*cos(90 + 6*t));
Obj_SetY(obj, y + 50*sin(90 + 6*t));
if(t==600-delay){
...
Little error on my side, since you actually want bullets to follow the same path, t has to start at 0 and end at 600-delay rather than to start at delay and end at 600.
-
Why not explain the logic and how you came to that conclusion instead of just throwing code at him and expecting him to understand it? That would be a lot more helpful in the long run.
-
Why not explain the logic and how you came to that conclusion instead of just throwing code at him and expecting him to understand it? That would be a lot more helpful in the long run.
Uh, I think I did.
-
Uh, kinda just bumping my question since it seemed to be overlooked. Even if you don't know if it's possible, that's a better answer than no answer; at least then I'd know to move onto another language.
Hi, I was wondering if it was possible at all to implement a database of high scores?
I've been considering using Danmakufu as the coding language for my senior computer studies project, but a necessary feature is a high scores database.
Is it possible at all to write to a .txt file? I was thinking the final score would be written on a new line and then to display the top 10 scores, coding would find all the scores in the file, put them in descending order and then display the top 10.
Or is it possible to link in an SQL database (although I doubt this would be possible).
-
It's possible to save variables to a file, using common data. That will only save the scores for one computer, though - there's no way to have an online database or anything like that (unless you used FTP or something to automatically upload and download that file, but that's getting pretty ugly). Just saving the top scores is fairly easy for what I assume your programming skill is, though. The only downside is that you need to write all your own menus (and your own text-display function to show the scores), since Danmakufu just loads a single boss or stage.
-
How do I get these circles to stop and/or bounce of walls? The GetClip functions don't seem to be reading for some reason, and the if statement I tried is also ignored...anyone have any ideas? Knowing my luck, it's yet another misplaced yield >.< On a side note, simply doing something like
if(Obj_GetY(obj) < GetClipMinY){
Obj_SetAngle(obj,-dir)
}
Did not work either >.< (Link to script: http://pastebin.com/e4Mh3t7e)
-
Think about it logically. If, say, a bullet is heading in the 30-degrees direction, which is a little lower than straight right, and it hits the wall, it becomes -30 degrees. You can't really say that angle would accurately portray a bounce.
Try angle-180 for exact direction flips.
180-angle is a more realistic bounce for walls.
360-angle for more realistic ceiling/floor bounces.
-
Ok, but my problem is that the bullets don't even bounce when they hit the walls, regardless of what I enter in the if loop...II have the same problem with all but the first if loop...what am I doing wrong?
-
Ok, but my problem is that the bullets don't even bounce when they hit the walls, regardless of what I enter in the if loop...II have the same problem with all but the first if loop...what am I doing wrong?
Could you perhaps show us your current code for the bouncing action? Pastebin it without the rest of the script, it makes it much more manageable to read over, in my opinion. I've had some experience with bouncing rings of bullets, so I should be able to help you out.
-
http://pastebin.com/ezeeSCV9 Here is everything from the fire task. I appreciate your help!
-
Man, I'm not used to reading pastebin code!
Anyway, a few things:
-Wait is the same thing as yield. Putting yield; after a wait(60); is the same thing as writing wait(61);
-Yield is not needed for loops that do everything inside all at once.
Quite honestly, though, I think there's more than one logic error in your script. It's hard to say what's causing you the real problem. But from what I can understand, try to rewrite your bullet code so that all movement is based on the bullet's Obj_GetAngle. You know, throw in a bit more sin/cos math. That might fix things.
Oh, and don't put infinite loops within your object bullet codes - Besides the typical while(!Obj_BeDeleted(obj)). That'll most likely mess stuff up.
EDIT : Well, I guess I can't really call it an infinite loop now. >_>
-
if you have a while(!objbedeleted) loop then by definition it isn't an infinite loop, even you plan to have it run forever it requires putting yields in the script which makes it not an infinite loop
-
Thanks for the yield suggestion ^_^ So about the rest of the loops...
-
I think I'm reading things correctly, but when you have it looking like this in your object shot tasks...
while(!Obj_BeDeleted(obj))
{
if()
{
loop(){}
}
if()
{
loop(){}
}
yield;
}
...the execution of your code will never ever leave one of those loops (and thus the if-statement that holds it) once it is entered. You should use the while-statement itself as all the looping action that's required in this case since you want it to monitor several different conditions at the same time.
while(!Obj_BeDeleted(obj))
{
if(Obj_GetX(obj)<GetClipMinX){*reverse angle mumbo-jumbo*}
if(Obj_GetX(obj)>GetClipMaxX){*see above*}
if(Obj_GetY(obj)<GetClipMinY){*see above*}
if(Obj_GetY(obj)>GetClipMaxY){*see above*}
yield;
}
The while-loop above lets your bullet have a frame-by-frame overview of whether it has fulfilled one of the if-conditions or not, which is what you want.
-
Yeah I assumed I would have to write my own menus. Pretty sure I understand the basics of them, although from what I understand so far it seems that there isn't any way to bypass that initial "Choose your character" in Danmakufu? Or is there a way to choose your character in a menu you make yourself?
Thanks, just read up on the Common Data functions. I'm guessing I would use the GetScore function as the value for the data I'm saving.
What I just tried was
SetCommonData("Score",GetScore);
SaveCommonData;
Which was placed in the @Finalize.
It didn't cause a crash (which was promising), but a quick look in the resulting .dat file via Notepad didn't reveal any significant input; just a small portion of gibberish characters.
Is that code that I'm using right? I would have written something to get the score from the file, but couldn't think of how to do it.
It's possible to save variables to a file, using common data. That will only save the scores for one computer, though - there's no way to have an online database or anything like that (unless you used FTP or something to automatically upload and download that file, but that's getting pretty ugly). Just saving the top scores is fairly easy for what I assume your programming skill is, though. The only downside is that you need to write all your own menus (and your own text-display function to show the scores), since Danmakufu just loads a single boss or stage.
-
http://pastebin.com/d4Bwd13d Ok, I tried the if loops, but now the bullet won't even move after 600 frames >.< Any ideas?
-
http://pastebin.com/d4Bwd13d Ok, I tried the if loops, but now the bullet won't even move after 600 frames >.< Any ideas?
That's probably because of the Obj_SetPosition inside the t==600-delay if-statement. Since t will only ever equal '600-delay' once, the objects position will be set at those coordinates and then remain there. Try changing the if-statement to read:
if(t>=600-delay)
...which will have the function inside it performed once per frame after t has reached its destination value.
-
Yeah I assumed I would have to write my own menus. Pretty sure I understand the basics of them, although from what I understand so far it seems that there isn't any way to bypass that initial "Choose your character" in Danmakufu? Or is there a way to choose your character in a menu you make yourself?
Thanks, just read up on the Common Data functions. I'm guessing I would use the GetScore function as the value for the data I'm saving.
What I just tried was
SetCommonData("Score",GetScore);
SaveCommonData;
Which was placed in the @Finalize.
It didn't cause a crash (which was promising), but a quick look in the resulting .dat file via Notepad didn't reveal any significant input; just a small portion of gibberish characters.
Is that code that I'm using right? I would have written something to get the score from the file, but couldn't think of how to do it.
You did it right. If you put LoadCommonData at the beginning of the script now, you can then use score = GetCommonDataDefault("Score",0); to load the score into that variable for display somewhere. GetCommonDataDefault is used instead of just GetCommonData: the second parameter controls what the default value is whenever the common data exists, which in this case is the first time playing - the high score should be zero.
For the character select, there's no way to bypass it, but you can limit it to just one character of your creation. Common data again - note that common data is completely universal, so if you do something in the menu that does SetCommonData("Character",1); you can have the player react to that and change to the first character, or change to another character if it's 2 and so on.
-
That's probably because of the Obj_SetPosition inside the t==600-delay if-statement. Since t will only ever equal '600-delay' once, the objects position will be set at those coordinates and then remain there. Try changing the if-statement to read:
if(t>=600-delay)
...which will have the function inside it performed once per frame after t has reached its destination value.
The circle still won't move after 600 frames...it just remains stationary...All I changed was the delay code. ???
-
The circle still won't move after 600 frames...it just remains stationary...All I changed was the delay code. ???
The circle moves for me, although I'm not quite sure what you want to have done with it. Could you perhaps pastebin the entire script code this time, and I'll paste it into my own file(s) and try it out.
-
Here it is: http://pastebin.com/s1dvtuW8
So do the circles bounce for you too? Thanks for the help :)
-
The circles does not bounce yet, but they do start to move after the specified amount of time. I'd like to know what your plans for them are, though. The ring on the right travels up-right while the left ring goes up-left. Do you want them to bounce in such a way that they'll come back down towards the player?
Edit: got my left and right mixed up. :V
-
Yeah, that's what I'm aiming for...I want them to bounce off all of the walls in different ways...but that's essentially my goal. Wonder why the circles in my script won't move...
-
That was my mistake, sorry. I misunderstood your code when I first looked over it, and my solution wasn't completely compatible with yours. I've remade your code slightly. It's no more than a base for you to continue building from, but the rings are now bouncing as they should from all borders. Please let me know if anything looks strange.
http://pastebin.com/JhC9uFhg
Also, you can take a look at one of my own scripts below. It's a bit messier than it ought to be, but the whole bouncing-rings-thing was a whole new experiment for me as well back then.
http://pastebin.com/BParnQkL
It produced the ring sequence you can see in this video.
http://www.youtube.com/watch?v=zbZF90cIsaM&t=1m55s
Pretty funky, if you ask me. :]
-
For some reason, the bullets don't even spawn at the moment :/ Ideas? That's a pretty wicked script!
-
Oh right, I changed path to your ShotData on line 33 in the pastebin. You'll need to remove the 'system/' bit of it, I only needed it in order to fit my own folder structure.
-
IT FINALLY WORKS :D THANK YOU SO MUCH!!!
-
And now I have another question...lets say that after one ring is fired, I want the rings to fire down instead of out...how do I do it? Using Obj_SetPosition doesn't work because it throws the bullet against the wall because it is perpetually being told to go down...Since I can't reset the angle and speed since it'll change the parameters of the currently existing object bullets to go down, what do I do? Here's what I have that's making due for now, but I'd like to change it to be a little more appealing...
if(f>1115-delay && f<1165-delay){
Obj_SetAngle(bang,135); Obj_SetSpeed(bang,2);
}
Suggestions?
-
...make another object bullet function?
-
Woops...I need to think before I speak >.< Thanks!
-
Can someone tell me if we can use "global" variable that we can use in all the functions of the script?
Like change the value of a variable in a task and get this new value in another task?
I will post my code if it's not clear enough.
-
Can someone tell me if we can use "global" variable that we can use in all the functions of the script?
Like change the value of a variable in a task and get this new value in another task?
I will post my code if it's not clear enough.
Uhh... odd question. Here, have a really really crude example:
script_enemy_main {
let script_wide_variable = 0;
@Initialize {
}
@MainLoop {
}
@DrawLoop {
}
@Finalize {
}
function AddNumberToScriptWideVariable(number){
script_wide_variable += number;
}
}
Obviously totally pointless, but I hope it got the point across.
-
How would you make an object bullet move in a sine wave or cosine wave? Stupid question, sorry >.<
EDIT: I mean an oscillating pattern like the graph of a sine or cosine function...sorry if I confused anyone!
-
not a stupid question really, just difficult if you don't trig well or whatever
firstposx = bulletorigin + speed*cos(angle)
firstposy = bulletorigin + speed*sin(angle)
secondposx = firstposx + wave*cos(angle+90)
speed += bla
wave += sin(bla2)
bla2 += bla3
-
So you fill in the values in the firstposx and firstposy formulas, but what do you do with the secondposx? I'd imagine you could make firstposx a variable... let Obj_GetX(obj) = firstposx...or something like that. And what do I fill in for the "bla"?
-
whoops mistakes
firstposx = bulletoriginx + speed*cos(angle)
firstposy = bulletoriginy + speed*sin(angle)
secondposx = firstposx + wave*cos(angle+90)
secondposy = firstposy + wave*sin(angle+90)
speed += bla
wave = sin(bla2)*bla4
bla2 += bla3
firstpos are both arbitrary variables. Secondpos are the ones that you actually set the bullet position with. You could skip firstpos entirely and use ObjSetX(obj, bulletorigin + speed*cos(angle) + wave*cos(angle+90)); or whatever but it's messy and confusing. You control the bullet position entirely though Obj_SetX and Y, so you don't use SetSpeed or Angle. The speed variable is just an arbitrary counting variable, bla is supposed to be whatever speed you want the axis point to move at along the trajectory. Bla2 is another counter that increases by whatever you want bla3 to be. The value of wave oscillates between bla4 and -bla4. Wave is technically unneeded as a variable but again I put it there for cleanliness.
Wow I suck at explaining this. If you understood basic trigonometry and object bullets (http://www.shrinemaiden.org/forum/index.php/topic,865.0.html) it'd be easier to grasp, sorry.
-
http://pastebin.com/WDH99gdW So here's what I've got...the bullet is just stationary, so I'm obviously doing something wrong. Any idea what?
-
You need a SetPosition in the while loop or the bullet's position won't change.
-
Excellent! I love it when things work this quickly! Thanks for your help guys :D
-
ByakuganAce, it seems you're just trying to make things work. So far, it looks like in the code that you're just putting in what people tell you what you should be having. Have you truly read the tutorials? I suggest rereading them and practicing moving your object bullets with Obj_SetPosition like how Drake and Lyan put in their exampls for you.
-
I've honestly read both the beginner and intermediate tutorials...I just need help with certain patterns because I just don't know how to make them...
-
I have a question :V
So I'm making a ending for my game (like the scenes after the final boss) , I vaguely remember something about effect objects and layers (say, I want a picture to cover the entire danmakufu screen covering the side bar too). But when I try to go to the tutorial it says
404 - Not Found :ohdear:
-
ObjEffect_SetLayer(obj,8);
is what you're looking for. If you want to draw more top of it, you need to take care of proper drawing order.
also new link http://dmf.shrinemaiden.org/wiki/index.php?title=Nuclear_Cheese%27s_Effect_Object_Tutorial
-
When ever I select a spell. Even a downloaded spell, danmakufu says it has to stop and it shuts down. ???
-
When ever I select a spell. Even a downloaded spell, danmakufu says it has to stop and it shuts down. ???
Have you even bothered looking at the FAQ (http://www.shrinemaiden.org/forum/index.php/topic,6181.msg345024.html#msg345024) which says:
Danmakufu crashes when I load it or try to play.
Are you using AppLocale to run the game? 99% of the crashes are due to this. Refer to the AppLocale thread to see if you correctly configured it.
If yes: Get this (http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=2043) and read this (http://www.shrinemaiden.org/forum/index.php/topic,4138.0.html) please. It is explained all in there.
-
I was wondering if there is a way to Get the amount of points the player has recollected, not Score Point but rather the Power Points.
There doesn't seem to be any function on the Wiki about it.
-
Power points don't exist in 0.12m. You have to make your own custom objects that add to a CommonData named "POWER" or something. Once you've done that, it's fairly trivial to make another CommonData that tracks the number of individual items picked up, etc.
-
Well, I start my script, spawn some fairies and then run a loop that cause a variable called "FogEnd" to increase by 100 one hundred times.
let FogEnd = 500;
In MainTask:
Wait(200);
loop(5){FairyWave1(GetClipMinX+Test,1,1); Test+=80;}
Test = 0; Wait(20);
loop(4){FairyWave1(GetClipMinX+70+Test,1,1); Test+=80;}
WaitForZeroEnemy;
Wait(200);
loop(100){FogEnd+=100;Wait(5);}
Then, @Background, I control the "SetFog" like this...
if(CurBG == 0){
WriteZBuffer(true);
UseZBuffer(true);
SetFog(0, FogEnd, 0, 0, 0);
SetViewFrom(600,90, -80);
...and the scripts slows down massively just in while the looping is being processed. After that, everything runs normal.
I'm aware that using looping in 3D Drawing consumes lots of processing power, but is there any other way to make this work?
EDIT: Also, how does the Explosion01 function is used? I already placed it in my script and does nothing...
-
Ok, I'm sure I'm just doing something stupid here, but I've been having trouble figuring it out:
http://pastebin.com/eQuFK7MC
Goal: Fire two shots at angles a-o and a+o, respectively. Initial speed is 's', but slows to roughly 's2' over 'deceltime' frames. During this time and thereafter, it is under the influence of a gravity acceleration 'fireaccel'. At no times does the speed of the bullet exceed 'm' in the y direction.
Problem: x velocity seems to be appropriate and consistent, but y velocity seems to vary directly with 'm' (it should vary with 's' and 's2') and changes abruptly after 'deceltime' frames. Clearly the two SetShotData's don't match up in the y, but it seems to be pretty simple math to me and I don't see what I did wrong >.>
-
Well, I start my script, spawn some fairies and then run a loop that cause a variable called "FogEnd" to increase by 100 one hundred times.
...and the scripts slows down massively just in while the looping is being processed. After that, everything runs normal.
I'm aware that using looping in 3D Drawing consumes lots of processing power, but is there any other way to make this work?
EDIT: Also, how does the Explosion01 function is used? I already placed it in my script and does nothing...
That is odd. I am modifying my SetFog distance as well by using regular loop, and it shouldn't be slowing down. Judging from your current code there is nothing wrong, but you are not showing your entire code so it is hard to figure out whether there are other things which might be conflicting.
Have you tried comment out the SetFog line, but just keeping the loop there to see if something is wrong (or commenting out the loop)? (Trial and Error) =.=
Explosion01 is a enemy script function, it won't work in stages AFAIK.
-
Have you even bothered looking at the FAQ (http://www.shrinemaiden.org/forum/index.php/topic,6181.msg345024.html#msg345024) which says:
If yes: Get this (http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=2043) and read this (http://www.shrinemaiden.org/forum/index.php/topic,4138.0.html) please. It is explained all in there.
. Thx dude
-
---------------------------
ScriptError「C:\Documents and Settings\ana.A\Escritorio\th_dnh English\script\Extra Mode\Stage.dnh」
---------------------------
一回も代入していない変数を使おうとしました(40行目)
↓
let AllEnm = [Fairy1,Fairy2,Fairy4,Fairy5,Fairy6,Fairy6B,Fairy6C,Fairy6D,Fairy7,Fairy8,Fairy9,Fairy9B];
/**********Enemy Sc
~~~
---------------------------
Aceptar
---------------------------
That is for get all the enemies into an array and then loading them CompileEnemyFromFile();, however, when I tweaked something into the Stage (dunno what could be the cause...) it appear that error.
I Compiled every enemy manually (I used ascent(number in 0..length(AllEnm)){CompileEnemyFromFile(AllEnm[number]);} before...) and worked perfectly.
What the hell happened?
-
Hi, I'm still new here, but I've been having a couple of my friends test my first few scripts that I've created, and one claims that the bullet hitboxes are larger than what he's used to playing with in the main Touhou games.
I never noticed a difference, but I'm just wondering if any of you have.
I wonder if it's the user created shotsheet that I'm using that created a discrepancy.
-
The bullet hitboxes are bigger than in the Touhou games... because the player hitboxes are smaller. I honestly don't notice any significant difference in gameplay.
-
Hey, i got a question...
THIS:
// Masterspark
ShotData{ id=254 rect=(0,514,122,767) render=ADD angular_velocity = 0 delay_color= (128,128,128) } //gray
I know it sets shot data for master spark...but i dont understand how i would use it. Would it be something like:
Masterspark(254,rect(0,514,122,767),ADD,0,(128,128,128);
?
-
You don't use shot data for a Master Spark. I'm not sure why it was even put on the shot sheet. You have to make your own Effect to create the Master Spark that uses the graphic, using it as a normal shot won't do a thing. There isn't a function for it, either. You make the whole thing yourself.
-
So is that function there as an example or...is it just there to intimidate me? :/
And more on the Effect with the graphic...the pic is just there as a Graphic?
-
It's not a function. You can use it as a texture for an Object Effect, or you can use its id (in this case, 254) as the graphic for an Object Laser.
-
Hey, i got a question...
THIS:
// Masterspark
ShotData{ id=254 rect=(0,514,122,767) render=ADD angular_velocity = 0 delay_color= (128,128,128) } //gray
I know it sets shot data for master spark...but i dont understand how i would use it. Would it be something like:
Masterspark(254,rect(0,514,122,767),ADD,0,(128,128,128);
?
*atomic facepalm*
I have no idea where you think a Masterspark function would magically appear from. That is just part of a shot data that you load and then instead of using RED01 or whatever, you use the id that was defined. In this case, the id is 254 so you'd do something like CreateShot01(GetX, GetY, 0, 90, 254, 0) and it'll shoot a bullet with the master spark graphic. Obviously you should be using a laser though. However, this is going to look like crap because Master Spark should really be done with effect objects if you want it to look not stupid.
-
Hi every one ~
Hum...I have a problem with Obj_Effect, I dont't understand certain function (Vertex thing >+<) . I look at the tutorial of nuclear cheese but the english is too hard for me (I'm french). Please help me >+< it's for create a explosion effect when the shot is create.
-
Hi every one ~
Hum...I have a problem with Obj_Effect, I dont't understand certain function (Vertex thing >+<) . I look at the tutorial of nuclear cheese but the english is too hard for me (I'm french). Please help me >+< it's for create a explosion effect when the shot is create.
Can you maybe show in pastebin link what you already tried to do yourself and what you are not exactly understanding?
It is vertex you say huh? Maybe you can view my tutorial video which shows a picture as well how to understand it http://www.youtube.com/watch?v=EMw7DOWYMkw
-
I have already seen it but I don't understand the part on vertex xD
-
Hello
It's been quite a while since i've been here if you remember me, but danmakufu doesn't work for me.
It doesn't even get to the menu screen, but a window pops up saying that the program stopped working
I'm running a windows 7. Tried without applocale and with.
-
Try running the custom.exe through Applocale, then click the first button on the bottom.
-
Hey, can someone decent with math/trig take a look at this and see where I'm going wrong? Pastebin (http://pastebin.com/HfqLRPqJ)
-
...You can extrapolate angular velocity and speed needed for how you wrote the first equation, but it's much easier to figure out when you ditch the center of the circle entirely. For your point to constantly be traveling on the outside of a circle, it'll be traveling along the circumference. For the point to reach the same point it started from, it'll have to turn 360 degrees. In other words, the entire length of the circumference. Therefore, think of the circumference of a circle like a line that your point is moving across.
2*π*r is the circumference of a circle. For a point traveling 1pixel per frame and increasing angle by 1per frame, it will get all the way around a circle with a circumference of 360 pixels in 360 frames. If the speed doubles, both the circumference and frames taken doubles. If the angular velocity doubles, the circumference and frames taken are halved. Therefore, if the time (frames) it takes for the point to go around the circle regardless of radius is constant, then use
a=2*π*r*s/360
But, if the angular velocity of the point is constant, then because circumference and time taken in this case is the same measurement, we have
a=2*π*r*s/360
-> a=t*s/360
-> t=a*360/s
I'm going to guess though that you'd want the first, considering you threw in the radius and probably want an even expansion rather than the laser rotating super fast and then slowing down as the circle expands. First is more like Subterranean Rose.
-
I have already seen it but I don't understand the part on vertex xD
:|
In that case, I hope someone who knows French on this board can help you out =/
-
task DrawStarRank
{
let obj=Obj_Create(OBJ_EFFECT);
let xpos = 0 + 32*csr;
ObjEffect_SetTexture(obj,Star);
ObjEffect_SetRenderState(obj,ALPHA);
ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLEFAN);
ObjEffect_SetLayer(obj,8);
ObjEffect_CreateVertex(obj,4);
ObjEffect_SetVertexUV(obj,0,xpos,0);
ObjEffect_SetVertexUV(obj,1,32,0);
ObjEffect_SetVertexUV(obj,2,32,32);
ObjEffect_SetVertexUV(obj,3,0,32);
//ObjEffect_SetVertexXY(obj,0,-256,-256);
//ObjEffect_SetVertexXY(obj,1,256,-256);
//ObjEffect_SetVertexXY(obj,2,256,256);
//ObjEffect_SetVertexXY(obj,3,-256,256);
ObjEffect_SetVertexXY(obj,0,-16,-16);
ObjEffect_SetVertexXY(obj,1,16,-16);
ObjEffect_SetVertexXY(obj,2,16,16);
ObjEffect_SetVertexXY(obj,3,-16,16);
loop{
Obj_SetPosition(obj,530,385);
ObjEffect_SetScale(obj,2,2);
yield;
}
//Obj_Delete(obj);
}
This object works, but I can't change the image in-game, ii's possible to change an Effect Object graphic?
-
Just call ObjEffect_SetTexture again and reset their XYs and UVs.
-
Maybe explain a bit more the possibilities of effect objects Mewkkyuuri =.=. Your half-done help isn't really explaining the potential possibilities.
Teff007 you could do this two ways:
- Create a while(!Obj_BeDeleted) inside your task and modify the influence the SetVertex/SetUV in there with certain functions/delays etc.
- Make your let obj=Obj_Create a global variable. This allows you to set the Vertex/UV or anything related to the object from anywhere in your script. Makes it extremely flexible if you wish to alter the effect object inside another task.
Edit:
If you really wish to change the texture of the object, you could use the above method as well. If the sprite has the same dimensions, you could simply call the texture. If the image is a part of a sprite animation, then you need to fiddle around with the UV coordinates by changing them through your desired method.
It sounds complicated but if you start out with basic tests, you will understand it quickly. See what works best for you.
-
I highly suggest NOT setting XYs and UVs over and over without deleting an object. If you plan for this object to persist for long periods of time, try to find a better way. Danmakufu 0.12m seems to have a bug in its engine that makes subsequent changes to XY and UV vertices take longer and longer for each call. It's not noticeable if you do it only a hundred times, but if you set 4 UV and XY coordinates every frame, for example, it will only take a few minutes or so for the slow down to become very noticeable. Deleting and recreating the effect object is a valid workaround though.
-
I highly suggest NOT setting XYs and UVs over and over without deleting an object. If you plan for this object to persist for long periods of time, try to find a better way. Danmakufu 0.12m seems to have a bug in its engine that makes subsequent changes to XY and UV vertices take longer and longer for each call. It's not noticeable if you do it only a hundred times, but if you set 4 UV and XY coordinates every frame, for example, it will only take a few minutes or so for the slow down to become very noticeable. Deleting and recreating the effect object is a valid workaround though.
Huh? Is that so? For my ballerina boss, I am actually faking the animation of the boss using effect objects where the UV is reset using a variable to "cycle" through the animation frames.
-
I'm talking about stuff like a score counter that updates every frame instead of checking when the score changes, for example. Your ballerina boss will probably delete itself before it becomes a problem, especially if it deletes and recreates itself after every attack.
-
Hi guys,
I tried searching the forum for my problem but it didn't work so here it is:
When I start Danmakufu on my laptop it crashes immediately with the error message that it just doesn't work right. I tried to run it with Applocale just the way I do on my pc (it works perfectly there) but I don't know what else I have to do.
Both systems are Win7 Ultimate 64-Bit, they are identical, except the hardware.
Would be nice if someone replies quickly because I wanted to script some spellcards on a journey tomorrow (well I still can do that, but I cannot test them).
-
Would be nice if someone replies quickly because I wanted to script some spellcards on a journey tomorrow (well I still can do that, but I cannot test them).
Please refrain from saying such things. Help is not a demand, it is a request. And it will come when people read and reply.
When I start Danmakufu on my laptop it crashes immediately with the error message that it just doesn't work right. I tried to run it with Applocale just the way I do on my pc (it works perfectly there) but I don't know what else I have to do.
Both systems are Win7 Ultimate 64-Bit, they are identical, except the hardware.
Is the error msg from Danmakufu? or the Windows error msg saying "this program stopped responding." Either way, that just doesn't sound right. It still sounds like an applocal problem to me. Have you actually reinstalled Applocal or Danmakufu? Have you tried a clean danmakufu install?
-
Is the error msg from Danmakufu? or the Windows error msg saying "this program stopped responding." Either way, that just doesn't sound right. It still sounds like an applocal problem to me. Have you actually reinstalled Applocal or Danmakufu? Have you tried a clean danmakufu install?
It was the windows error message, however, reinstalling solved it, thanks.
-
Teff007 you could do this two ways
You can call me Teff.
What I'm intending to do is to change a Image drawn over the Frame according to the current spellcards captured, I'm not on my computer right now, but I try what you said at the moment.
Also, another two questions:
1.- CommonData, I know how to use it decently now, but is there a way to add values to the CommonData?
Say : if (GotSpellCardBonus){SetCommonData("Rank", CURRENT VALUE + 1); }
That's what I'm intending to do, to add one value with each spellcard captured.
2.- @DrawTopObject. I have seen it in a few scripts, but I dunno what it does except for being another drawing sintaxis. Any explanations?
[I apologize for any typo, I'm in a hurry :V]
-
SetCommonData("X", GetCommonData("X") + Y);
-
I'm talking about stuff like a score counter that updates every frame instead of checking when the score changes, for example. Your ballerina boss will probably delete itself before it becomes a problem, especially if it deletes and recreates itself after every attack.
Oh like that. Well yea. My function only runs for like 1 non-card and after that it is just regular boss animation handling in the DrawLoop. Interesting fact to know.
-
I apoligize if this may annoy anyone but could someone please try to explain danmakufu. I've read all the tutorials, printed them out, looked at he faq and i can't even make the simplest attack. Plz don't link to other topics are say something bad. If your not answering, plz don't post...
-
Ok, now you are just sad. What are you even trying to create? You aren't specifying anything at all. If you're having a problem, at least tell us what the problem is. End of fucking statement.
[tso]Uhh no we don't treat people this way, timeout for you[/tso]
-
i read everything but dunno how anything derpaderp
Make a folder called MyBoss or something in the scripts folder of your copy of danmakufu. Make an img folder in there. Save the below script as a txt file in your new folder. Test it, and it should be a boss that self-destructs after a few seconds. Mess around with CreateShot01(x,y,speed,angle,graphic,delay) and stick it in MainTask to make shots. Use the wiki to learn new functions.
http://pastebin.com/3yxEV6N5
-
Lucas, I don't think using tasks in a beginner example is good idea. Generally, a beginner's script just has a bunch of stuff in @MainLoop chock full of ifs and loops with no subs or functions. Basically, the least amount of programming concepts you can possibly introduce while still making varying attacks.
I apoligize if this may annoy anyone but could someone please try to explain danmakufu. I've read all the tutorials, printed them out, looked at he faq and i can't even make the simplest attack. Plz don't link to other topics are say something bad. If your not answering, plz don't post...
You're quite right about your post annoying people. I'm sure you didn't intend to come off like this but saying "If your not answering, plz don't post..." makes you sound really conceited. As Mewkyuu said, you could have at least pointed at a specific part you're having trouble with because I don't think we have any psychics around here. Considering you said you tried all the tutorials and are still don't seem to understand enough to produce a script, I can try guessing though:
* Are you having trouble running Danmakufu without crashing?
* Are you having trouble making a script that doesn't cause an error message to appear?
* Are you having trouble understanding how variables or control statements work?
* Are you having trouble understanding how changing stuff in one of Danmakufu's functions (like CreateShot01) changes how it works when run?
As a side note, I'd like to point out that making a game is a lot harder than it sounds. It's really easy to underestimate the amount of effort it takes to even make a simple game. Also, programming/scripting is not for everyone. It demands that you think in a way that is different than normal (which might explain why stereotypically, programmers are given certain personality traits) and some people have a hard time thinking that way.
EDIT:
Also, this is the simplest attack possible:
#TouhouDanmakufu
#Title[Simplest Attack Possible]
#ScriptVersion[2]
script_enemy_main {
@Initialize {
SetLife(1);
}
@MainLoop {
CreateShot01(GetX, GetY, 3, 90, RED01, 10);
}
}
It's also impossible to beat because the boss does not have a hitbox. If you don't know why or how something works in here, point it out. I'll try explaining.
-
I am still unhappy that regular members of RikaNitori still do not put large blocks of code in pastebin links.
-
Mmm... I'm getting this mistake:
---------------------------
ScriptError「E:\danmaku related stuff\Danmakufu~\th_dnh\script\Umi no Charlotte\UmiSpell01.txt」
---------------------------
SetShotDataAの対象にはできません(347行目)
↓
SetShotDataA(1,0,1,dir,0.2,0,1,AQUA31); FireShot(1); CreateShotA(2,GetEnemyX+20*cos(dir),GetEnemyY+20*sin(dir)
~~~
---------------------------
Aceptar
---------------------------
Here's the script: http://pastebin.com/3DaRtEDi
-
I'll have to get home to test this but one thing I'd like to point out is you have a bit of redundancy in your script:
wait(120);
yield;
you already declared a function that is looping yields for you. So you are really yielding 121 times or frames at this point in the script. I don't think that's what you want and it makes it easier to synch if you use 0's and 5's.
-
[00:00] <~Naut> what did the error message say again?
[00:00] <~Naut> oh hm
[00:00] <~Drake> not able to, setshotdataa target
[00:00] <~Drake> (verb)
[00:01] <~Drake> well it loops
[00:01] <~Drake> but it fires the shots so it should free up
[00:05] <~Naut> he creates lasers with ID 1
[00:05] <~Naut> they are not fired
[00:05] <~Naut> shot tries to use id 1 but the laser already has it
[00:05] <~Naut> -> kunai task
[00:05] <~Drake> wait what
[00:06] <~Drake> ugh
[00:06] <~Drake> i saw object bullet and figured that was the whole task
[00:06] <~Drake> the laser isn't even fired
[00:06] <~Drake> lol
[00:06] <~Naut> mhm.
Yeah, free up the shot ID by either getting rid of the laser in your kunai task or changing its ID.
-
I keep getting the "th_dnh has stopped working" whether i'm using applocale or not.
There was another download somewhere that i was able to use without troubles (due to some edits or whatever with it) but i cant seem to find it.
-
During a script or on startup? For the latter, have you tried starting the game through the config.exe? Tried deleting your script_index.dat?
-
On Startup. I just tried starting through config and it worked though, thanks
-
Uhm sry for the question:
What can I do to make an enemy moves its position? (I don't know how to do it, and I always put in @Initialize "SetMovePositionHermite(cx,120,-90,290,0,0,100);" )
-
Assuming you already have cx defined as a variable, that should work, I think.
Edit: You can also use any of the following:
SetMovePosition01(destinationX, destinationY, VelocityOfMovement);
SetMovePosition02(destinationX, destinationY, FramesToMove);
SetMovePosition03(destinationX, destinationY, weight, maxSpeed);
-
No, the problem supposes:
http://pastebin.com/nXhnDcES Large blocks of code goes into pastebin.com -Hele
I mean, in a certain moment the character might appears and move to the center of the screen, but I don't know how to do it...
P.S. this is an incomplete script, there's an event for Marisa and Sanae too.
-
I'm confused about how CreateLaserC works. Instead of shooting the laser straight from the boss, it always shoots like the laser image is rotated 90 degrees. Another strange part is that only the very middle of the horizontal laser hits the player. I know I'm probably doing something wrong.
CreateLaserC(1,GetX,GetY,150,8,3,0);
SetLaserDataC(1,0,3,90,0,0,3);
SetLaserDataC(1,30,3,180,0,0,3);
FireShot(1);
-
You have laser width and length swapped.
I know you're just doing it to test, but right now what will happen is that the laser will bend instantaneously and have a hideous corner. Gotta curve dat shit.
-
FACEDESK!!
That was really stupid of me, thanks. Though in my defense, CreateLaserA has the length and width in the reverse order, so I just assumed it was the same.
BTW if you want some weird danmakufu stuff, try using this code:
CreateLaserC(1,GetX,GetY,150,8,78,0);
SetLaserDataC(1,0,3,180,10,0,3);
SetLaserDataC(1,30,3,90,10,0,3);
FireShot(1);
wait(120);
used with the expanded supershot shotsheet, this makes an extremely weird, yet cool looking pattern.
-
Not to mention, CreateLaserC is not fired from the boss by default because it is asking for X Y.
GetX, GetY which is not the boss location (GetEnemyX/Y). Helepolis fails, it auto gets boss-x/y. Ignore this
LaserB is default fired from the boss.
-
I am completely at a loss here. I've double, triple, quadruple checked, but I cannot get my plural file to work. Every time I try to start it up, it simply freezes. No error message.
Strangely enough, each of the scripts that are involved in this plural file work individually, so I'm fairly confident that the problem doesn't stem from them (I hope).
Here's the plural file code. I copied it directly from the tutorial here (http://dmf.shrinemaiden.org/wiki/index.php?title=Danmakufu_Intermediate_Tutorial#How_to_make_a_boss_fight.21), then inserted my own things:
#TouhouDanmakufu[Plural]
#Title[Edgey Boss Fight]
#Text[Courtroom Madness]
#Image[.\system\miles-aha.png]
#BackGround[Default]
#Player[FREE]
#ScriptVersion[2]
#ScriptPathData
#ScriptPath[.\Edgey2.txt]
#ScriptPath[.\Edgey3.txt]
#ScriptPath[.\Edgey.txt]
#ScriptPath[.\Edgey5.txt]
#ScriptNextStep
#ScriptPath[.\Edgey4.txt]
#EndScriptPathData
-
Is making a lifebar split into four separate scripts valid?
-
It is. I have about 15 different lifebar segments in one of my plural scripts just for testing, and it worked.
-
Stupid questions time.
Are the Edgey files in the same directory?
Are the Edgey files all single attacks?
Do the files you're trying to load in a plural work on their own?
If you only load one script in your plural, does it still freeze? (Check each of em one by one)
...You're not naming that plural script Edgey.txt and attempting to recursively load it in itself are you?
-
Stupid questions time.
Are the Edgey files in the same directory?
Are the Edgey files all single attacks?
Do the files you're trying to load in a plural work on their own?
If you only load one script in your plural, does it still freeze? (Check each of em one by one)
...You're not naming that plural script Edgey.txt and attempting to recursively load it in itself are you?
1) Yes. (http://i56.tinypic.com/21dpwyq.jpg) (picture of my directory, for reference in my answer to question 4)
2) Yes.
3) Yes.
4) Yes, it still freezes, along with occasionally displaying this error message:
(http://i51.tinypic.com/nwnhbb.jpg)
My Japanese-speaking friend just told me that this message reads that the file "could not be found". But if the files are in the same directory, I don't see why there should be a problem.
5) Nope.
-
> function_cutin and Utsuhoeffect are text files
> no extension in name
> extensions in all the other names
...Cut all the ".txt" off the filenames.
-
> function_cutin and Utsuhoeffect are text files
> no extension in name
> extensions in all the other names
...Cut all the ".txt" off the filenames.
Thanks! I always questioned the necessity of ".txt" at the end of the files, but didn't give it much thought, since it didn't affect anything outside of the plural files. But now I know. And knowing is half the battle.
-
Open the Run (Win+R) window and run "control folders" to open Folder Options. Go to View, then uncheck "Hide extensions for known file types". Problem solved, everything has extension in filename.
-
Hey, I've got a possibly complicated question. My friend asked me if I could make a rotating square of lasers around a point. I tried to do this with object lasers whose starting points rotate around the center point, but I can't seem to get the math right or something, because I keep getting weird motions. So, first of all, is this idea feasible? And second, does anyone know how that might be done? I'll post the failed code that I have if it helps at all.
-
Yeah shouldn't be too difficult. Use object lasers so you can change position and angle easily. Let 'r' be the radius of the vertices of the square, 'ang_vel' be the number of degrees to rotate per frame, 't' be a frame count, and [CenterX,CenterY] be the coordinates of the center of the circle.
For i from 0 to 3, have lasers at position [x,y] = [CenterX+r*cos(90*i+ang_vel*t),CenterY+r*sin(90*i+ang_vel*t)], each of which with an angle of [90*i+135+ang_vel*t] and a length of [r*sqrt(2)]. You'll need to update the position and angle every frame for each laser. If you want to move the center point of the square around, just change CenterX and CenterY
Let me know if this doesn't work, I didn't actually try it in a script so I may have said something stupid xD
-
task mainTask {
wait(30);
lasercage(GetCenterX,GetCenterY,1,100,0);
}
task lasercage(CenterX,CenterY,ang_vel,r,i){
let obj = Obj_Create(OBJ_LASER);
let t = 0;
Obj_SetPosition(obj,CenterX+r*cos(90*i+ang_vel*t),CenterY+r*sin(90*i+ang_vel*t));
Obj_SetAngle(obj,90*i+135+ang_vel*t);
ObjLaser_SetLength(obj,r*2^(1/2));
ObjLaser_SetWidth(obj,15);
ObjShot_SetGraphic(obj,4);
ObjShot_SetDelay(obj,0);
ObjLaser_SetSource(obj,false);
while(!Obj_BeDeleted(obj)) {
Obj_SetPosition(obj,r*cos(90*i+ang_vel*t),r*sin(90*i+ang_vel*t));
Obj_SetAngle(obj,90*i+135+ang_vel*t);
t++;
yield;
}
}
Here's what I have, though the laser doesn't appear near the middle of the screen. This is only a test, so there's only 1 laser for now. Am I doing something wrong?
-
It's fine when you first position the laser (CenterX+r*cos(90*i+ang_vel*t),CenterY+r*sin(90*i+ang_vel*t)), but immediately afterwards, in the loop, you got rid of the center point. Right now it spins around (0,0), the point immediately after spawn should be (100,0). Put the center point back in.
-
It's fine when you first position the laser (CenterX+r*cos(90*i+ang_vel*t),CenterY+r*sin(90*i+ang_vel*t)), but immediately afterwards, in the loop, you got rid of the center point. Right now it spins around (0,0), the point immediately after spawn should be (100,0). Put the center point back in.
And we've got another stupid mistake. Apparently I'm batting a thousand lately. Thanks for the help, it works now. I added the center point to the initial setposition but forgot to add it to the loop.
-
I've got one more question, is it possible to shoot bullets that will then bounce off the insides of the laser box? I've tried to do it by checking for whether the bullet collides with the laser, but all it seems to do is jiggle around and still pass through most of the time. I figure it's because it's constantly colliding with the laser so it's constantly changing direction.
-
Yes, when the bullet connects with the laser you have to manually change the position of the bullet to shift 1 or 2 pixels over in the direction you want or else the bullet will stay on top of the laser constantly changing angles.
Alternately you can make a counter to bounce once, then add a variable to prevent another bounce.
-
Ok, I've done that. Here's what I have:
http://pastebin.com/2HhHUrjv
The bullet is in the same task so as to test. I'll move it to a separate one later.
There's still something wrong, it's probably the angle shift that happens during the collisions. Since the laser walls are constantly rotating, I don't know what to define the angle shift as so that they will bounce correctly.
-
The generalized formula for a bullet to bounce correctly off a wall with angle 'a' is: final_angle = 2a - init_angle (Note that in cases of a=0 and a=90, as for the walls of the stages, this matches the equations you are probably already familiar with)
The angle of each laser is the same as Obj_GetAngle for each laser. You'll have to check for each laser whether a bullet is intersecting, then use that laser's 'a' value in the equation along with the bullet's initial trajectory to calculate the correct reflection angle for the bullet.
-
The generalized formula for a bullet to bounce correctly off a wall with angle 'a' is: final_angle = 2a - init_angle (Note that in cases of a=0 and a=90, as for the walls of the stages, this matches the equations you are probably already familiar with)
The angle of each laser is the same as Obj_GetAngle for each laser. You'll have to check for each laser whether a bullet is intersecting, then use that laser's 'a' value in the equation along with the bullet's initial trajectory to calculate the correct reflection angle for the bullet.
Thanks a lot for your help so far, but something is still off. The bullets still won't reflect correctly sometimes, depending on where they hit the laser wall. I can't find anything wrong with the angle shifts this time, your math seems flawless. I'm starting to wonder if the combined effect of the rotation and the changing radius is somehow affecting the reflection.
Here it is:
http://pastebin.com/qpUpvcyT
I'm truly stumped as to what's wrong.
-
EDIT: I'm a dumbass. IGNORE ME!
EDIT2: I didn't look at Ozzy's code but how likely is it that the bullet is ending up in the laser after bounce still? Are you moving the bullet out of the laser at the same time you change the bullet's angle? If not, you should try that.
-
Possibly some shenanigans from Obj_Obj. What would probably work, and would be faster, is checking if the bullet is inside the square.
I'm going to cheat and use a bit of taxicab. Because you're using a square (rotated 45 degrees) where the circle around it has a defined radius, it's easy to check a "collision" of that square by comparing the bullet position to the center of the circle. It's simply if( (|bulletx-centerx|) + (|bullety-centery|) >= r){ collision; }
However since the square is rotating, you need to adjust the target value like uh cos(()%90) [NOT FINISHED LOL]
also the if bounce statement should go before the ascent because redundancy
-
I was there trying to script and test my unfinished script, Suddenly when making the enemy appearance, It wouldn't work. Is there any problem?
Here is the code:
http://pastebin.com/CTB3kjcR
Any problems?
EDIT:
I have done all the stuff, The original (the one with the life,time and others on set_enemy_main) cast off an invisible enemy with life. but I was halfway right now just found about let shot. Unfortunately it says that there is a problem with let angle = 0 (this was the result from the Danmakufu Intermediate Tutorial) and then it just says "CLEAR" after this happens. I am finding about "let shot" but the director says there is no "let shot". I typed "shot", The only results we're the enemy bullets and the description, Including the DeleteSE.
-
There are many problems. It doesn't even look like you tested the script even once; it seems as though you typed it all out and now you're surprised it isn't working.
Rule 1: Script problems and questions go here (http://www.shrinemaiden.org/forum/index.php/topic,9281.0.html) or here (http://www.shrinemaiden.org/forum/index.php/topic,10181.0.html) depending on danmakufu version.
Rule 2: Always Pastebin (http://pastebin.com/) long segments of code.
Rule 3: Give as much information as possible when asking for help. If it gave an error, copy it with ctrl+c or take a screenshot. If the game froze, say so, and describe when.
First of all, SetLife(1000);, SetMovePosition01 (GetCenterX,GetCenterY,5);, SetTimer(65); and LoadGraphic(imgBoss); should be in @Initialize, not anywhere else (except for SetMovePosition01, but your intention is to put it in @Init). Similarly SetTexture(imgBoss); and SetGraphicRect(0, 0, 63, 63); should only be in the @DrawLoop. These probably give errors.
Second of all, you shouldn't need to increase frame before even starting the script, you probably don't even want to.
Thirdly, if every time your frame counter hits 60 it goes back to 50, it will never reach anything else. Why are all these frame=50; even there. Are you trying to leave a gap of ten frames in between each firing?
Fourthly, angle += 360/36 and DeleteGraphic(imgBoss) have no semicolon on the end. You always need a semicolon at the end of a statement.
Fifthly, you have a Gety somewhere in there instead of GetY. Danmakufu is case-sensitive, so it will error.
Sixthly, you did not define angle or shot as variables. They do not exist, and you are trying to call them. It will error.
Seventhly, your @DrawLoop's closing bracket is an open bracket instead of a closing bracket. It will error.
There is no way that script could have worked, and you obviously didn't even try to figure out what was wrong before asking for help. Please, you need to seriously go back to the tutorials and try to understand them better. You also need to go read the forum's rules and info thread (http://www.shrinemaiden.org/forum/index.php/topic,6181.0.html) (which incidentally contains links to tutorials).
-
EDIT:
I have done all the stuff, The original (the one with the life,time and others on set_enemy_main) cast off an invisible enemy with life. but I was halfway right now just found about let shot. Unfortunately it says that there is a problem with let angle = 0 (this was the result from the Danmakufu Intermediate Tutorial) and then it just says "CLEAR" after this happens. I am finding about "let shot" but the director says there is no "let shot". I typed "shot", The only results we're the enemy bullets and the description, Including the DeleteSE.
Post your new code in pastebin.com (http://www.pastebin.com) so we can check it.
-
How can I detect Collision between two Object Bullets? Looks like Obj_SetCollisionToObject is only for making activate Collision Detection.
-
Collision_Obj_Obj or something.
You should code your own collision function for that, though.
-
I think I don't understand, in the wiki Collision_Obj_Obj is referenced but I can't see any parameters.
By coding my own collision function you mean that I need to make it something like a task?
-
I think Collisio(ry) has just x(object1, object2) as the parameters...
And of course, you can always just put all of the object ids into an array, like array = [object1, object2], then check if x area around position of object1 intersects with y area around position of object2.
-
Starting from the top here. You gave no information about how advanced in programming or math you are, so I'm covering it all.
Say that you have two circular objects, and you have a radius defined for each one (r1 and r2). In order to check if they are colliding, you must check the distance between the two object centers. It is easy to see that if the objects are, say, 20 pixels in radius each, and they're less than 40 pixels away from each other, there is a collision. In other words, if the distance between the objects is less than (r1+r2), then they are colliding.
Now, how would you find the distance between two points? All you have are the X and Y coordinates, which don't directly say how far apart. If you paid attention in math class, you probably learned about the Pythagorean Theorem, which states that you can find the hypotenuse of a right triangle if you know the other two sides. In this case, the two sides are the X distance between the objects and the Y distance between the objects, and the hypotenuse is the distance between said objects.
a2 + b2 = c2. A and B are the X and Y distances between the objects, so distance2 = (x1-x2)2 + (y1-y2)2. Converted to Danmakufu code, with two objects obj1 and obj2, and assuming a constant radius:
if( (Obj_GetX(obj1)-Obj_GetX(obj2))^2 + (Obj_GetY(obj1)-Obj_GetY(obj2))^2 < radius * radius){
collision stuff here;
}
Assuming you're going to be colliding every bullet with every other bullet, the problem is how to get other bullet IDs in the bullet task. To do this, you put them all into an array (as Mewkyuu said with his very vague and not-explanatory explanation). You might have a global array called bullets (let bullets = [];), and at the beginning of each bullet task after you get its ID (the let obj = Obj_Create(OBJ_SHOT); line), you would put bullets = bullets~obj; to add the bullet ID to the array. In the bullet task, loop through the array and check collision if the bullet ID is less than the current one (so it only checks each pair once, and doesn't check collision with itself).
So then the only thing left to do would be removing the bullet ID from the array if the bullet is deleted. I'm not sure if I need to explain that, but I'd explain it anyway if I wasn't really hungry right now. Hopefully you can handle it from here!
(I probably wrote way too much.)
-
This is not being responded on, and then is posted as another one for the lack of popularity of the "Gap Table" theory.
-
Here is the code:
http://pastebin.com/C7sFCrTP
EDIT: ( I have no idea with what is happening to this. Again, I say this code is halfway or halfquarter (2.75) still. So I am still finding the solutions for now.
This is just embarrassing to point out what you did wrong. I won't directly help you out unless you insist. Because this is a learning moment for you and people like you.
start reading from script_enemy_main { and check LINE by LINE. Not just the code, but everything. If you don't spot your error within 30 seconds. Then just drop a post here and I will point it directly out.
Again this isn't to tease you or to make fun of you. Just to learn you how trial and error precisely.
Edit: Just you also know, once you find the problem (and fix it). It will start giving more errors. And they are also caused by the most simple mistakes which even experts sometimes struggle on.
Edit2:
I'll add it as spoiler below here as I am going to bed. If you don't want to learn or really cannot figure it out, peek here. Or if you managed it, check whether you were correct:
- You have a } in line 13 which belongs at the end of your script (closing the script enemy main). Because right now it ENDS the script without anything and ignores the rest of the TXT file. Pretty obvious.
- You have a missing ; at 67 behind Alpha value.
- 'shot' in line 77 is undefined therefore errors.
All of these errors can be tracked by simply looking at the given line code error in the game after you have fixed the } . The } could be discovered by simply counting the opening { and closing } for each block. You would've instantly run into this because your script is small.
-
(I probably wrote way too much.)
As long as somebody responds me, you can wrote a book if you want :D
Now seriously, thanks Azure, it really worked, and with Danmakufu my English Math Vocabulary has become beter that it was.
But I have some minor issue here, you see:
@MainLoop{
/****************Boss Hitbox****************/
SetDamageRate(10,0);
yield;
/****************Frame Count Initialization*************/
fcount++;
bcount++;
acount++;
/****************Bullets Initialization & Control***************/
if(bcount == 60){
loop(5){
DarkBullet(GetClipMinX,GetCenterY + 100,0.5,0,202,DelayTrack);
WhiteBullet(GetClipMaxX,GetCenterY + 100,0.5,180,201,DelayTrack);
DelayTrack+=120;
}
}
if(acount == 60){
loop(180){
DarkMiniBullet(GetX,GetY,1,dir1,25,60);
WhiteMiniBullet(GetX,GetY,1,dir2,24,120);
dir1+=360/180;
dir2+=360/180;
}
}
//if(bcount == 120){bcount = 0;}
if(acount == 60){acount = -60;}
/****************Effects Initialization******************/
loop(6){if(fcount == Timeout +(60 * Rep)){PlaySE(Time1); Rep+=1;}}
loop(4){if(fcount == Timeout + (60 * Rep)){PlaySE(Time2); Rep+=1;}}
}
The "DarkBullet" and "WhiteBullet" are the bullets that contain the code you gave me, the minibullets are just for Collision detection.
The issue is, each time it loops again the Frame Counter (fcount) the "Dark/WhiteBullet" dissapears and respawns at the location it was set. I'm not sure why this happens...
-
So I decided to get into this a bit more and I have some questions:
First, if I've set a variable to ++/-- is there a command I can use to cause it to stop increasing/decreasing?
For example, I have a ring of shots I have set to decrease using "radius--;" and want to stop it decreasing when it reaches 100.
Second, how do I use the boss's life or spellcard timer as a variable, for things such as timeout phases, or adding more bullets as health decreases "Border of Life and Death"-style?
I guess for timeout phases you could just use "if(frame==<value>){raeptime}", but I don't know how you'd change the pattern according to the health.
-
So I decided to get into this a bit more and I have some questions:
First, if I've set a variable to ++/-- is there a command I can use to cause it to stop increasing/decreasing?
For example, I have a ring of shots I have set to decrease using "radius--;" and want to stop it decreasing when it reaches 100.
if(raidus>100){
radius--;
}
Second, how do I use the boss's life or spellcard timer as a variable, for things such as timeout phases, or adding more bullets as health decreases "Border of Life and Death"-style?
I guess for timeout phases you could just use "if(frame==<value>){raeptime}", but I don't know how you'd change the pattern according to the health.
You can use GetEnemyLife and GetTimer to check how much of either remains.
-
What do you have to do to the shotsheet to make bullets glow?
-
What do you have to do to the shotsheet to make bullets glow?
Well, "glowing" bullets require 2 things:
- Black background, use ADD rendertype (this pretty much goes for most images)
- The bullet is self must have some glowy look (adds to the glowness)
-
I think I've seen some people use a ring of a colour around the bullet to make it glow but I couldn't get that to work. Do you know how to do that?
-
Photoshop? Really, it is just smart editing the shotsheet and then experimenting until desired effect is achieved. Half of what you see is optical illusion-like tricks.
-
I see. So I will have to experiment with it then.
Thanks for that Hele.
-
I was just trying to improve my circle shots because they disappear when they spawn, However, After deleting the } (that causes it to delete) and add the frame (So they do not shot at the same time), It says there is a problem about script_enemy_main and quickly says CLEAR (This is weird, I thought I already removed the script_enemy_main problem...) while playing, Here is the pastebin code for my stuff:
http://pastebin.com/7tb0eH4L
UPDATE: New pastebin code for new errors upon finding of solution depending on popping errors (Un-translatable Japanese could lead to more unknown errors)
-
I was just trying to improve my circle shots because they disappear when they spawn
Okay.
However, After deleting the } (that causes it to delete)
....what?
and add the frame (So they do not shot at the same time)
I don't even know what you mean here.
It says there is a problem about script_enemy_main and quickly says CLEAR (This is weird, I thought I already removed the script_enemy_main problem...) while playing
Deleting a random } is going to cause that error. You need to have an equal amount of {'s and }'s because they signify when specific blocks of code start and finish.
That said, you're missing a { and a } and your code has a bunch of unnecessary redundant stuff in it. I don't even know where to start with correcting your mistakes. I don't mean this in a mean way; I'm actually asking: How did you learn how to script?
-
2 silly questions:
How to make the screen shake? (as in the last spell of Yuugi)
How I can replicate the Yuugi spell "storm in mt. Ooe"?
-
Since this is 0.12m, it's not going to be as easy as "set camera to random shaking" like in ph3.
Welp, the idiot way many people use is just shake the background (like DrawGraphic(x+rand(-10, 10), y+rand(-10, 10); or something.) This doesn't really give a shaking effect if you're really into seeing it, however.
IIRC, the bullets shake even when moving. This is sorta hard, but I think you can make all of the bullets and also the player use custom movement defined in your script. Lemme type up the example.
Here's a very bare skeleton and would not work if you just plain copy it in to your notepad. (http://pastebin.com/EVqABzLA) I expect you to be able to finish up the job. Let me know if you have trouble understanding some of it. (Ugh. Never write code in the morning.)
Storm on Mount Ooe is easy - you just spawn some bullets from the top right corner of the screen. When some of the bullets reach the left border, make them warp over to the right side again. I think that's how they work.
-
Since this is 0.12m, it's not going to be as easy as "set camera to random shaking" like in ph3.
Welp, the idiot way many people use is just shake the background (like DrawGraphic(x+rand(-10, 10), y+rand(-10, 10); or something.) This doesn't really give a shaking effect if you're really into seeing it, however.
IIRC, the bullets shake even when moving. This is sorta hard, but I think you can make all of the bullets and also the player use custom movement defined in your script. Lemme type up the example.
Here's a very bare skeleton and would not work if you just plain copy it in to your notepad. (http://pastebin.com/EVqABzLA) I expect you to be able to finish up the job. Let me know if you have trouble understanding some of it. (Ugh. Never write code in the morning.)
Storm on Mount Ooe is easy - you just spawn some bullets from the top right corner of the screen. When some of the bullets reach the left border, make them warp over to the right side again. I think that's how they work.
Roger. I'll put into practice in my next script, thanks
About Ooeyama, is rare, comes too straight (not random as in the original attack, I'm clumsy as I have said several times, in danmakufu)
-
Is it possible to manually move the player (like SA's Subterranean Sun)? Using a loop with SetPlayerX/Y displays the error message "bad allocation" twice before Danmakufu crashes.
-
I'll type it out really quickly.
function Gravity(x, y, v) {
let angle = atan2(y-GetPlayerY, x-GetPlayerX);
SetPlayerX(GetPlayerX+v*cos(angle));
SetPlayerY(GetPlayerY+v*sin(angle));
}
run this every frame when you wanna pull the player in to a certain point
http://www.youtube.com/watch?feature=player_detailpage&v=620AB0KPhrM#t=12s
It's demonstrated here, but not very noticeable.
-
Is there a way to get a graphic drawn by @DrawLoop to fade out of existence and then be replaced with another graphic? I've been trying to use this for the fade out and subsequent transition:
if(c == true) {
loop(120) { SetAlpha(255-(255/120*x)); x++; yield; }
c = false;
}
if(c == false) {
SetTexture(imgBoss2);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(0.35,0.35);
if (int(GetSpeedX())<0) { SetGraphicAngle(180,0,0); } else { SetGraphicAngle(0,0,0); }
SetGraphicRect(0,0,152,175);
DrawGraphic(GetX,GetY);
}
However, it still seems to switch to the next graphic instantaneously instead of fading out. Am I just understanding this wrong?
-
What it's doing is looking for other things to yield to, but you're in the DrawLoop so there probably are none. Script returns back to the yield again, hits the closing bracket, loops, repeats the same thing 120 times in one frame. Gets out of the loop, c is now false, changes texture, ends DrawLoop and advances the frame.
Try
//initialize x=255; instead
if(x>0) {
SetAlpha(x);
x-=120/255;
}else{
SetTexture(imgBoss2);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(0.35,0.35);
if (int(GetSpeedX())<0) { SetGraphicAngle(180,0,0); } else { SetGraphicAngle(0,0,0); }
SetGraphicRect(0,0,152,175);
DrawGraphic(GetX,GetY);
}
-
What it's doing is looking for other things to yield to, but you're in the DrawLoop so there probably are none. Script returns back to the yield again, hits the closing bracket, loops, repeats the same thing 120 times in one frame. Gets out of the loop, c is now false, changes texture, ends DrawLoop and advances the frame.
That works, thanks for the help!
-
Hey Guys, how do i make my bullets spin clockwise?
(For example: I have a circle of Bullets, and want them to spin around.)
-
http://www.shrinemaiden.org/forum/index.php/topic,865.msg31781.html#msg31781
Similar to this, I'd assume.
-
Does somebody knows how to replicate Mamizou Spellcard Background? I don't find a way to replicate it...
-
It looks like it's warped in a bubble, but I can't seem to figure out how the graphic is actually positioned in there. Note that the white parts of the foreground is a mask that colors/darkens the background.
-
I think you can do it with PRIMITIVE_TRIANGLESFAN. Create 360 degrees fan and move source texture rectangle every frame.
-
It's less of just one fan as it would be a small fan as the center and then several series of strips around it to form something like an ellipsoid (http://en.wikipedia.org/wiki/File:Ellipsoid_321.png). Like I said, it's more of a warp than mass-vertice editing.
-
Hey ther~
I'm new here, so Idk if this is the right place to post this...
Whenever I try to use arisa from CtC in Phantasmagoria trues, I get an error...
(http://www.omgimages.net/img/5425/123785.jpg)
Is there any way to fix that and make Marisa a playable character? Thanks a ton for the attention~
-
i think CtC Marisa script uses common data "Score" & "SubRate". Your script doesn't support them. Create common data and enjoy.
-
Thank you ^^ but... how do I do that? '-'
*newbie*
-
I think you should just be able to replace GetCommonData("Score"); with GetCommonDataDefault("Score",GetScore); and it will work fine.
-
It's not the player script that has these variables, but actually Phantasmagoria Trues that uses "Score" and "SubRate" common data.
Trying the quick fix (in this case GetCommonData("Score"); --> GetCommonDataDefault("Score",0);) reveals further problems, namely that none of the bosses appear during gameplay. I think some of the common data commands related to the CtC player are interfering with the script's common data, however more investigation is needed.
-
Oooh okay... I wonder if I can download CtC Marisa somewhere else, maybe it'd work... Sorry I'm a huge noob when it comes to scripting ^^; Thanks a ton~
-
Hey, I'm trying my hand at devising player scripts and I'm trying to make a bomb that creates a green circle as an object spell around the player. After x frames, I want all of the bullets inside the circle (the spell doesn't delete them, but does give the player invincibility) to be counted, and then have the spell circle expand and deal damage enemies proportional to the number of bullets inside the circle at that moment.
I thought I could use GetEnemyShotCountEx for this, but whenever I try to store it in a variable or call it inside a function, danmakufu raises an error and I can't figure out why. I've double checked the function parameters, and tested the same line elsewhere in the script. Am I doing something wrong? And it GetEnemyShotCountEx doesnt work, is there another way for my idea to work? Here's the while loop inside of the object spell task:
while(!Obj_BeDeleted(obj)) {
ObjEffect_SetScale(obj,scale,scale);
Obj_SetPosition(obj,GetPlayerX,GetPlayerY);
ObjSpell_SetIntersecrionCircle(obj,Obj_GetX(obj),Obj_GetY(obj),96*scale,1,false);
if(count<=240) { scale+=0.005 }
if(count>240) {
scale+=0.05
ObjSpell_SetIntersecrionCircle(obj,Obj_GetX(obj),Obj_GetY(obj),96*scale,2*GetEnemyShotCountEx(GetPlayerX, GetPlayerY, 96*scale, ALL),true);
}
if(count==300) { Slow(0); Obj_Delete(obj); }
count++;
yield;
}
Thanks in advance.
-
scale+=0.005 and scale+=0.05 have no semicolon
-
How does "SaveCommonData" and "LoadCommonData" work? I've heard they behave way different from their Ex Versions... neither I don't know how to test it exactly.
-
scale+=0.005 and scale+=0.05 have no semicolon
Why does this always happen to me? Seriously it seems to be happening a lot more lately than usual. Sorry for cluttering the thread with my retarded questions.
-
Why does this always happen to me? Seriously it seems to be happening a lot more lately than usual. Sorry for cluttering the thread with my retarded questions.
I just write a semicolon after every chunk of code that needs one. Even if it's the only thing inside {}'s.
-
That's just it, I usually do too, but lately I've been forgetting to put them there and I'm surprised when I get unexpected errors. Oh well, I'll get back in my good habit sometime.
In the meantime, I've got another question: Is it possible for an effect object to act as a color filter? For example, is it possible to get my aforementioned green circle bomb to actually alter the colors of bullets that are inside of it?
-
You should put the object effect on a high layer so it's over the bullets (although I think it's like that by default?), and then you can set the blending mode to SUBTRACT, which would be the closest thing to what you're looking for. If the image was purple (255,0,255), it would subtract all red and blue from the image, leaving only green, which is pretty neat.
On a side note, your logic is wrong for setting the damage - it counts all bullets in the radius every frame, even once it expands to a huge size to damage enemies. You probably want to store the shot count on frame 240 and then just read the stored value from then on.
-
You should put the object effect on a high layer so it's over the bullets (although I think it's like that by default?), and then you can set the blending mode to SUBTRACT, which would be the closest thing to what you're looking for. If the image was purple (255,0,255), it would subtract all red and blue from the image, leaving only green, which is pretty neat.
On a side note, your logic is wrong for setting the damage - it counts all bullets in the radius every frame, even once it expands to a huge size to damage enemies. You probably want to store the shot count on frame 240 and then just read the stored value from then on.
Oh derp, I actually had that stored in a variable before but changed it for some reason, thanks for catching that. I WAS wondering why the bomb was ridiculously powerful. Also thanks for the tip, this should make the bomb all the more interesting and easier to understand.
-
However, I'm going to add that creating one mask will not work well if you only want to mask bullets. If you subtract 255,0,255, it will remove all red and blue of the bullets yeah, but it'll also darken every color that's lighter than 0,x,0 to a maximum of 0,255,0, which you might not like. It'll also affect every other layer underneath, including the background, enemy sprites, various other effects put on layer 2, etc. You can't really make an adjustment layer unless you want to fiddle with render targets, which is unintuitive for bullets. Tread carefully, I suppose.
-
http://www.shrinemaiden.org/forum/index.php/topic,865.msg31781.html#msg31781
Similar to this, I'd assume.
I think i have an idea to solve this.
Would this work? :
I am making an variable that determines the angle (it starts with zero) and every frame the angle goes up (6 -> 7, 180 -> 181).
Would that work?
-
So, now i've gotten through some of the problems I had with danmakufu earlier. I also learned to read the error messages (just enough to know where the problem is)
But now I get error from the wait function, and I have no idea what's the problem with it...
I wrote the wait function like this:
wait(30);
Also for some reason danmakufu crashes when stage ends. It's not a big problem now, but I just want to know that is it normal and is there possible way to fix it.
-
So, now i've gotten through some of the problems I had with danmakufu earlier. I also learned to read the error messages (just enough to know where the problem is)
But now I get error from the wait function, and I have no idea what's the problem with it...
I wrote the wait function like this:
wait(30);
Also for some reason danmakufu crashes when stage ends. It's not a big problem now, but I just want to know that is it normal and is there possible way to fix it.
Greetings Trace,
First of all, please make sure you read the stickies before you continue to work with in our garage. Nitori and Rika do not appreciate co-mechanics who don't follow the union rules. I merged your post before they would throw danmaku.
Second, your problem is hard to figure if you don't show us some code. Please post your script in pastebin to us.
-
Sorry if this is too engine-related, but can anyone explain how the collision checking for curvy lasers and oval bullets work ?
-
Collision checking for oval bullets is simple - they're checked as circles. The shorter side (multiplied by some decimal) is used as the radius for the circle.
For curvy lasers, they are divided into lots of little segments (one segment is created per frame, and if it reaches the maximum size specified, erases the oldest segment). This is how they are drawn, and why they take so much processing power. For collision checking, I'm betting that line segment collision (the same as for normal lasers) is performed with each individual segment of the laser.
-
I see, thanks for the quick reply. I assume circle checking is also used for circular objects ? Is it more expensive than rectangle checking ?
-
As far as I know, the only things with non-circular collision are lasers. Circles are faster to calculate (it's just Pythagorean theorem - 3 multiplications, 2 additions, and a single comparison) instead of rotating rectangles (which is, uh... much more than that, as a quick Google search shows code for (http://www.gamedev.net/page/resources/_/technical/game-programming/2d-rotated-rectangle-collision-r2604)).
-
I see, thanks for the quick reply. I assume circle checking is also used for circular objects ? Is it more expensive than rectangle checking ?
This is the code for checking if two arbitrarily rotated rectangles are colliding:
http://www.shrinemaiden.org/forum/index.php/topic,5164.msg586604.html#msg586604
This is the code for checking if two circles (rotation obviously doesn't matter) are colliding:
function Collision_Circle_Circle(x1, y1, r1, x2, y2, r2){
let distance = ((x1-x2)^2+(y1-y2)^2)^0.5
return distance < r1+r2
}
Take a guess which is more expensive. :V
-
Rectangular collision checking is lighter if you don't rotate the rectangles. When you're dealing with really small hitboxes, the rotation is pretty much irrelevant. Many bullet hells use rectangle collision checking for most bullets afaik, including Touhou.
(http://i43.tinypic.com/mjtw5w.png)
-
blargel's missing the squares, also square root processing yumyumyum
if(|px-ox|< pw+ow && |py-oy| < ph+oh ) is the lightest thing i can think of
-
Well ... yeah, I meant non-rotated rectangles :V Anyway, thanks a lot for the help, guys.
Btw Naut, what was Reimu's hitbox size and the boolets' general hitbox:sprite ratio ?
-
blargel's missing the squares, also square root processing yumyumyum
if(|px-ox|< pw+ow && |py-oy| < ph+oh ) is the lightest thing i can think of
Damnit, corrected. Also, really? They use rectangles? That's surprising to me. :wat:
-
I'm learning scripting a stage for testing stuff. I've read Naut's tutorial. According to him...
For enemies, you won't want them to have too much health, so you can kill them quickly. Typically have them spawn a really basic flurry of bullets, and just continue off in one direction (they will be destroyed upon leaving the game screen).
And i have a problem that if i leave some enemies to fly beyond the screen, they seem not been destroyed automatically, cause my wait-for-zero-enemy function doesnt proceed as if i've shot them onscreen. So do i need to control enemy for leaving the screen myself, or it's processed automatically and i'm doing something wrong?
Here's the enemy script: http://pastebin.com/WgHmAJ8M
And here's the stage: http://pastebin.com/5vVPnLJ6
-
Btw Naut, what was Reimu's hitbox size and the boolets' general hitbox:sprite ratio ?
In UFO, Reimu's hitbox is 2 pixels square (compare with Sanae's 3 and Marisa's 3.5). Reimu's hitbox is the same size for MoF and SA afaik, but it is slightly smaller in TD (1.5 iirc). Bullet hitboxes are usually about half the visible sprite size, but the way danmakufu calculates them seems to be very slightly bigger. I don't think anybody knows for sure.
And i have a problem that if i leave some enemies to fly beyond the screen, they seem not been destroyed automatically, cause my wait-for-zero-enemy function doesnt proceed as if i've shot them onscreen. So do i need to control enemy for leaving the screen myself, or it's processed automatically and i'm doing something wrong?
Could've sworn they were auto deleted. Oh well, simple fix. In @MainLoop:
if(GetX<GetClipMinX - 32 || GetX>GetClipMaxX + 32 || GetY<GetClipMinY - 32 || GetY>GetClipMaxY +32){
AddLife(-GetLife);
}
-
Just as i thought. Thanks for advice. Edit: but i used not AddLife(-GetLife) but VanishEnemy, and added && !BeVanished to @Finalize. Otherwise there're point items collecting from outtascreen lol.
And i've got 2 more questions:
1. Is there a way to change default enemy explosion (or just disable it so i could script my own)?
2. How to change background in stage? I've tried it like in boss scripts by loading texture and drawing it in @Background section, but it doesnt work like no spellcard - no bg
-
I don't remember 1 off hand but there is a way to delete the SFX that pops when enemies die. Is that what you mean?
For number two, you're going to have to make a stage script and draw the background for nonspells with the stage script itself. Plural scripts won't let you do that and you won't be able to do it from the nonspell.
-
For number two, you're going to have to make a stage script and draw the background for nonspells with the stage script itself. Plural scripts won't let you do that and you won't be able to do it from the nonspell.
what do you mean? Of course i'm doing a stage script, but i still cant change the default running background of it.
That's how it looks now:
.
.
script_stage_main{
let CSD = GetCurrentScriptDirectory;
let bg = CSD ~ "\img\starbg.png";
let bgshift = -300;
.
.
.
@Initialize{
LoadGraphic(bg);
SetRateScoreSystemEnable(false);
stage;
}
@Background{
SetTexture(bg);
SetAlpha(255);
SetGraphicRect(0, 0, 600, 1200);
DrawGraphic(GetCenterX,GetCenterY+bgshift);
bgshift++;
if (bgshift>300){bgshift=-300};
}
.
.
.
-
@BackGround, not @Background. Yay, capitalization.
-
@BackGround, not @Background. Yay, capitalization.
(https://www.scenemusic.net/static/emoticons/facepalm.gif)
-
There's no real way to disable the default explosion, but there are workarounds. The way I do it is having a really high number (like 10000) as "default" health, and if the enemy's health is actually 200 for example, then it gets added to that (10200). Every frame check if the health is less than 10000, and if so, VanishEnemy (and give the player points and stuff). The only problem with this is that destroyed enemies don't have DrawLoop called, and they can't manipulate effect objects either. There are two ways to bypass this.
1. Don't actually delete the enemy as soon as it's dead, just disable collision and set a timer. Draw the explosion graphic based on that timer and delete the enemy when it reaches 0. The problem is that homing player scripts will still home in to the enemy when it's exploding, but depending on how short your animation is, that might not be a problem.
2. Set common data, and have the stage create explosion graphics based on that common data. This is the one that I use, and it doesn't have the drawback mentioned above, but it's kind of hard to set up.
-
...and if so, VanishEnemy (and give the player points and stuff). The only problem with this is that destroyed enemies don't have DrawLoop called, and they can't manipulate effect objects either. There are two ways to bypass this.
Hmm.. Why not to call a special task just a frame before the enemy vanished so it can do all stuff like draw explosion, give items etc?
Also, what is common data and functions for it? Cant find any tutorial explaining how and why to use it.
-
If you're handing out the script with its own danmakufu folder/executable/etc, as you usually would with scripts that follow their own system, you can remove the graphic by replacing the hidden img\system.png file, or by editing it if you can grab the actual file.
Hmm.. Why not to call a special task just a frame before the enemy vanished so it can do all stuff like draw explosion, give items etc?
Oh, the joys of expert danmakufu proggin'. As in, the terrors.
Once the enemy is destroyed, all tasks instantiated from the enemy script are ended. In other words, any effect objects drawn, the DrawLoop, all other functions you might want to do when the enemy dies, are stopped and deleted. This is exactly what Azure just said but you misinterpreted it; the two main workarounds are as they described. Calling "a special task" would be the second workaround: the function would set a bunch (i.e. a lot) of arbitrary common data, then the stage script would be constantly checking for altered values of the common data and if it finds some then it acts accordingly. Main issue is that it sucks. It's the most proper method to do it but it sucks assssss.
-
Use ph3, avoid such terrors.
Encounter new ones
-
okay.jpg
Well. I think i'll be fine with default explosions. They look neutral and fit my project well. Let's pay more attention to gameplay and patterns! As for ph3, i'd rather wait untill it's out of beta and english documentation will be complete. Also old version seems to have all i need (almost).
-
Is there a way to change the default keys used for moving around? My down arrow key is broken so it is hard to play scripts. I've checked the config.exe but I couldn't find any options for changing arrow keys.
-
Is there a list of built-in variables (not functions) that I could find? Like GetX and GetY?
-
GetX and GetY are functions though.
Well, the default shot names are variables, I suppose. Most of the other built-in variables have functions for calling them.
-
Finally I got my scripts work...
So, now I need to know the commands that makes the bullet's speed and direction random.
Also when I try to make stream of bullets to be fired at player from both sides of the boss like this:
50 40 30 20 10 B 10 20 30 40 50
B = Boss
Numbers = Delay frames
Result:
(http://img840.imageshack.us/img840/3656/bulletsk.png) (http://imageshack.us/photo/my-images/840/bulletsk.png/)
All bullets has GetAngleToPlayer command so it should fire ehem at player, right?
EDIT: Also how do I make a laser that is still and possibly rotates, but not moving to any direction.
-
GetAngleToPlayer means the angle from the boss to the player.
If you want the bullets to aim at the player, write:
SetShotDirectionType(PLAYER);
then the shoot command, with an angle of 0. CreateShot01(X,Y,speed,0,color,delay);
SetShotDirectionType(ABSOLUTE);
There are more ways to do so, but this is the only one I know by heart.
-
Finally I got my scripts work...
So, now I need to know the commands that makes the bullet's speed and direction random.
Also when I try to make stream of bullets to be fired at player from both sides of the boss like this:
50 40 30 20 10 B 10 20 30 40 50
B = Boss
Numbers = Delay frames
Result:
-img-
All bullets has GetAngleToPlayer command so it should fire ehem at player, right?
EDIT: Also how do I make a laser that is still and possibly rotates, but not moving to any direction.
So, are you trying to get the bullets to all fire according to the left pattern, or are you trying to get them to fire according to the right pattern? If the former: all you do is move the position the bullets spawn from. If the latter, do what puremrz said. Now, as for random speed and direction:
rand(x,y)
OR
rand_int(x,y)
These two functions return a random number between x and y. You can use them anywhere you desire a random number, naturally. The former allows for decimals, the latter doesn't. I suggest the former for the speed and the latter for the direction. Also, don't set the speed too high! 5 is usually considered to be a fast bullet, so lower than that is fine, unless fast bullets are what you want. Now, as for the laser, you mean you want it to spin in place, yes? Just place your LaserA (or ObjLaser) somewhere and change its angle. I suggest you use the Turn Speed argument for this. Here's the function I speak of, just so you know. (http://dmf.shrinemaiden.org/wiki/index.php?title=Bullet_Control_Functions#CreateLaserA)
-
To elaborate on puremrz's suggestion:
GetAngleToPlayer is just the angle from the boss to the player, no matter where it is called. To get the angle between the bullet to the player (or any point to any other point!), you need to use that one trig function that you learned in school but then completely forgot about because it's so useless. Arctangent!
atan2(targetY-sourceY, targetX-sourceX)
This returns the angle from (sourceX, sourceY) to (targetX, targetY). Replace the source position with the bullet's, and the target position with the player's.
-
I've got one question about GetAngleToPlayer. In my script it also works with nonboss enemies on the stage. Will it work for a boss only when both boss and plain enemies appear?
-
Yeah. When you call GetAngleToPlayer, you get the angle from position of the enemy you call it from to the player.
-
Why lasers cant be moved with Obj_SetSpeed?? Is it a bug or a feature and i have to use something like Obj_SetPosition(obj,Obj_GetX(obj)+cos(Obj_GetAngle(obj)),Obj_GetY(obj)+sin(Obj_GetAngle(obj))); instead?
-
Why lasers cant be moved with Obj_SetSpeed?? Is it a bug or a feature and i have to use something like Obj_SetPosition(obj,Obj_GetX(obj)+cos(Obj_GetAngle(obj)),Obj_GetY(obj)+sin(Obj_GetAngle(obj))); instead?
Yes, that's the problem. You'd have to do exactly as you just said.
Though Obj_GetAngle(obj) would make it travel at only its own angle, so if you want like, one where it travels sideways, you'd have to have another angle.
-
Yes, that's the problem. You'd have to do exactly as you just said.
Though Obj_GetAngle(obj) would make it travel at only its own angle, so if you want like, one where it travels sideways, you'd have to have another angle.
good Obj_SetAngle works for lasers. Also i've noticed that laser position is measured from the beginning of it not from the center of the sprite wich is uncomfortable too.
-
Uh no, it makes sense. If the position of the laser was in the middle of the laser it'd be crazy as hell to control.
-
I've got a new question. I'm trying to make a boss turn invisible temporarily but those white things (I don't know how else to describe them) give away the boss's position. How do you remove them?
-
MagicCircle = false;
in @initialize should remove them.
-
It's MagicCircle(false);
As a general rule, you never include the capability to edit program variables lest someone do something catastrophically stupid to them. Having it as a function limits the possible inputs to the intended values, and overall increases program integrity/stability.
-
Now, as for random speed and direction:
rand(x,y)
OR
rand_int(x,y)
These two functions return a random number between x and y. You can use them anywhere you desire a random number, naturally. The former allows for decimals, the latter doesn't. I suggest the former for the speed and the latter for the direction.
Can you make a example for me?
A task that fires 5 bullets at the same time with random direction and speed each 1 second.
If you make this it would help me to understand how I should use these, since I don't think you can put it like this:
CreateShot01(GetEnemyX, GetEnemyY, rand(x, y), rand_int(x, y),WHITE22, 10);
-
You can. Usually for a random integer angle, I use rand_int(0,359). Negative numbers can also be used.
-
What I'd like to know is how to get bullets to "realistically" obey gravity after being shot upwards, like in 1:54 of this video (http://www.youtube.com/watch?v=TD-QA53YSI0).
I already know how to get bullets to do this while standing still or when already moving downward, but as for upward-moving bullets, I can only get them to drop straight down with realistic acceleration.
-
Next thing:
How do I create this pattern with lasers:
1. Laser spawns from boss with 0 degree angle
2. Laser rotates Anti/Counter Clockwise and despawns when reaches 90 degree angle
3. another laser spawns from boss with 180 degree angle
4. this laser rotates Clockwise and despawns when reaches 90 degree angle
this pattern also should be looped
And don't tell me to check how to use CreateLaserA and SetLaserDataA from wiki, I already did that and it was no help
-
MagicCircle = false;
It's MagicCircle(false);
Thanks to both of you, I wasn't aware that the MagicCircle function affected the white things in addition to the circle itself.
Now I have a possibly more complicated question. My friend wanted to know if it is possible for a boss script to affect the movement speed of the player. I didn't think it was possible since the player speed is defined in an entirely separate script. I know there are a lot of questions piled up before mine so you can answer those first.
-
Something like Ozzy, is there a way to make that if the player is below Y, it automatically focuses? (Like in Subterrean Animism Phantasm Stage, Mitori Survival Final Phase but Inversed)
-
Something like Ozzy, is there a way to make that if the player is below Y, it automatically focuses? (Like in Subterrean Animism Phantasm Stage, Mitori Survival Final Phase but Inversed)
task movement {
let x = GetPlayerX; let y = GetPlayerY;
let vS = GetPlayerInfo(PLAYER_SPEED_LOW);
let vF = GetPlayerInfo(PLAYER_SPEED_LOW);
loop {
let fo = GetKeyState(VK_SLOWMOVE)!=KEY_FREE;
if(!OnPlayerMissed) {
if(GetKeyState(VK_LEFT)!=KEY_FREE) { x-=[vS,vF][fo] }
if(GetKeyState(VK_RIGHT)!=KEY_FREE) { x+=[vS,vF][fo] }
if(GetKeyState(VK_UP)!=KEY_FREE) { y-=[vS,vF][fo] }
if(GetKeyState(VK_DOWN)!=KEY_FREE) { y+=[vS,vF][fo] }
} else { x = GetCenterX; y = GetClipMaxY-64; }
if(x<GetClipMinX+16){x=GetClipMinX+16;}
if(y<GetClipMinY+16){y=GetClipMinY+16;}
if(x>GetClipMaxX-16){x=GetClipMaxX-16;}
if(y>GetClipMaxY-16){y=GetClipMaxY-16;}
SetPlayerX(x); SetPlayerY(y);
yield; while(GetPlayerY<GetCenterY+100){x=GetPlayerX;y=GetPlayerY;yield;}
}
}
-
Something like Ozzy, is there a way to make that if the player is below Y, it automatically focuses? (Like in Subterrean Animism Phantasm Stage, Mitori Survival Final Phase but Inversed)
If you're using not builtin Reimu or Marisa but some custom player script, maybe it should get the info about changing speed from common data exchange?
Can you make a example for me?
A task that fires 5 bullets at the same time with random direction and speed each 1 second.
If you make this it would help me to understand how I should use these, since I don't think you can put it like this:
CreateShot01(GetEnemyX, GetEnemyY, rand(x, y), rand_int(x, y),WHITE22, 10);
task fire{
while(something){
loop(5){
CreateShot01(GetX,GetY,rand(1,3),rand_int(0,360),RED03,0);
yield;
}
wait(60);
yield;
}
}
What I'd like to know is how to get bullets to "realistically" obey gravity after being shot upwards, like in 1:54 of this video (http://www.youtube.com/watch?v=TD-QA53YSI0).
I already know how to get bullets to do this while standing still or when already moving downward, but as for upward-moving bullets, I can only get them to drop straight down with realistic acceleration.
The easiest way is to use SetShotDataA_XY (http://dmf.shrinemaiden.org/wiki/index.php?title=Bullet_Control_Functions#SetShotDataA_XY) with some lower limit for Y acceleration. Here's a fast example of how to do it. Be careful with gravity value. it should be quite low to affect upward-movig bullets well http://pastebin.com/Vf2gqDRY
Or use object bullets with some variable that controls Y speed and adds it to Obj_SetY all the time. No wait. You actually have to know the Y-speed of an object and control it separately. Since objects handle only angle and speed over that angle it becomes messy. In this case you have either to control angle too or to refuse using angle and control X and Y speeds separately.
Meanwhile i faced same shit again. I'm implementing power system in my game and wanna make enemies do such an easy thing as drop power items on death. And guess what happens if i run task from the enemy script wich creates an object? How the f*ck should i handle that? Use common data? Will it work for lots of enemies with power items to drop dying at the same time (read: can common data share arrays or something?). If anyone else had to solve such a problem in their scripts - please tell what solution you found.
-
task fire{
while(something){
loop(5){
CreateShot01(GetX,GetY,rand(1,3),rand_int(0,360),RED03,0);
yield;
}
wait(60);
yield;
}
}
The yield in the loop will add a one frame delay in between each shot, so if the bullets are to be fired at the same time, there shouldn't be a yield there. Also, there is no need to use rand_int when randomizing angles as danmakufu allows non integers for angles.
-
The yield in the loop will add a one frame delay in between each shot, so if the bullets are to be fired at the same time, there shouldn't be a yield there.
Does it mean that without yield loop will take all the time needed for it to perform? What about another tasks and if loop(1000) or something?
Also, there is no need to use rand_int when randomizing angles as danmakufu allows non integers for angles.
That's just the demonstration of the functions. While rand_int is enough for angle cause of high range of random interval, using it for speed will give exactly 1, 2 or 3 instead of any real value between them like with rand, wich can be used to control patterns.
-
Greetings everyone! So I started playing around with danmakufu yesterday and I find it really enjoyable. As I progress though a few questions come up :(
For starters, where can I get the sound effect files for the bullets?
-
Well, there aren't any sound effects for the bullets, actually! If you wanna go get some of the sounds from the official Touhou games, head over here (http://www.shrinemaiden.org/forum/index.php/topic,197.0.html) and download some of the sound rips.
Hell, you can use any freaking sound you want for firing bullets, even the sound of some random dude burping if you want.
-
Lol! yeah that's what I actually wanted, thank you mate ;)
-
Does it mean that without yield loop will take all the time needed for it to perform? What about another tasks and if loop(1000) or something?
If there is no yield in the loop then the loop will run within a single frame, so:
loop(100){
do something;
}
takes 1 frame to perform and does whatever you want 100 times within that frame, while
loop(100){
do something;
yield;
}
does the same thing but takes 100 frames instead
-
takes 1 frame to perform and does whatever you want 100 times within that frame, while
Yeah but if only it can fit a single frame. I always yield all loops and whiles but here it makes sence cause the time to perform such a fast loop is insignificant.
-
Yeah but if only it can fit a single frame. I always yield all loops and whiles but here it makes sence cause the time to perform such a fast loop is insignificant.
loop(1024){
CreateShot01(GetX, GetY, rand(1, 3), rand_int(0, 360), RED01, 0);
}
This code will create 1024 shots in a single frame without problems, but if you had put a yield there then it would take about 15 seconds to spawn them all. So you should only put yields in a loop if you want that delay.
-
Heeeelz yeah! I've managed my enemies to drop power items via common data exchange! 8) That was not so difficult. Here's some code if anyone's interested in...
In stage script:
. . .
//organising queue from enemies for power items to drop
CreateCommonDataArea("poweritems");
SetCommonData("firstpower",0);
SetCommonData("lastpower",0);
let firstpower=0;
let lastpower=0;
let powerdata=[0,0,0];
. . .
@MainLoop{
firstpower=GetCommonData("firstpower");
lastpower=GetCommonData("lastpower");
if(firstpower>lastpower){
firstpower=0;
SetCommonData("lastpower",0);
ClearCommonDataEx("poweritems");
}
if(firstpower>0){
powerdata[0]=GetCommonDataEx("poweritems",firstpower)[0];
powerdata[1]=GetCommonDataEx("poweritems",firstpower)[1];
powerdata[2]=GetCommonDataEx("poweritems",firstpower)[2];
loop(powerdata[2]){
CreatePowerItem(powerdata[0]+rand_int(-10,10),powerdata[1]+rand_int(-10,10),1);
yield;
}
firstpower++;
}
SetCommonData("firstpower",firstpower);
yield;
}
In enemy script:
. . .
let lastpower=GetCommonData("lastpower"); //retreiving number of last power item in queue
. . .
lastpower=GetCommonData("lastpower");
lastpower++;
SetCommonData("lastpower",lastpower);
if(lastpower==1){SetCommonData("firstpower",1);}
SetCommonDataEx("poweritems",lastpower,[GetX,GetY,power]); //sending information about power to drop into queue
Also, as i remind from my previous questions in this thread, this is the way to override default enemy explosions and make own ones.
-
Thanks MMX! Now, another question for anyone who's willing to answer. I don't know how to work with backgrounds other than creating a still image. How can I make the multi-layered moving backgrounds that are prevalent in more recent Touhou games? (i.e. the spinning radiation symbol in Utsuho's background, and the infinitely-moving space background behind it)
-
Thanks MMX! Now, another question for anyone who's willing to answer. I don't know how to work with backgrounds other than creating a still image. How can I make the multi-layered moving backgrounds that are prevalent in more recent Touhou games? (i.e. the spinning radiation symbol in Utsuho's background, and the infinitely-moving space background behind it)
Just the same way as with static backgrounds. Load all textures you want to use as background layers and draw them one after another in @Background section with all movement, spinning commands. Be sure they have proper alpha channels and stuff to be drawn one above each other. I've made my first 2-layer BG recently
@BackGround {
SetGraphicScale(1,1);
SetTexture(starbg);
SetGraphicRect(0,0,600,1200); // set twice (or more) the width (length) of image so it'll get automatically tiled
DrawGraphic(GetCenterX,GetCenterY+bgshift-300); // draw bottom layer with moving starfield texture
bgshift+=4;
if(bgshift>=600){bgshift=0;}
SetTexture(bg);
SetGraphicRect(0,0,384,448);
DrawGraphic(GetCenterX,GetCenterY); // draw top layer with static texture with alpha "holes" to see a layer under it
}
You can see how it works in a boss script i made for my project http://www.shrinemaiden.org/forum/index.php/topic,11416.0.html
And i've got another question myself: How to draw stuff outside the game field? like show power level'n'stuff under lives and bombs. I found it's needed to call in mainloop, but it works weird.
-
Is it possible to fade in and fade out effect objects? Obj_SetAlpha doesn't seem to work on them.
-
This code will create 1024 shots in a single frame without problems, but if you had put a yield there then it would take about 15 seconds to spawn them all. So you should only put yields in a loop if you want that delay.
it'll lag like fuck
And i've got another question myself: How to draw stuff outside the game field? like show power level'n'stuff under lives and bombs. I found it's needed to call in mainloop, but it works weird.
ObjEffect_SetLayer(obj,8);
Is it possible to fade in and fade out effect objects? Obj_SetAlpha doesn't seem to work on them.
for(i in 0..vertexnum){ ObjEffect_SetVertexColor(obj,i,alpha,red,green,blue); }
-
for(i in 0..vertexnum){ ObjEffect_SetVertexColor(obj,i,alpha,red,green,blue); }
lol for
He means ascent.
-
goddamn it
-
ObjEffect_SetLayer(obj,8);
Oh tanx i'll try it. But how can i place a DrawText output there? Via SetRenderTarget?
for(i in 0..vertexnum){ ObjEffect_SetVertexColor(obj,i,alpha,red,green,blue); }
you meant ascent, right?
Also i'm constantly experiencing troubles with measuring distance between two points using Pythagoras' theorem. If only i put something like (x2-x1)^2+(y2-y1)^2 it makes danmakufu halt and crash instantly on stage start (even before any actuall call of that calculations). That makes me use such a perversions like
ang=atan2(y2-y1,x2-x1);
dist=(|(x2-x1)/cos(ang)|);And it works like a charm! Even when cos is about to be zero lol. Good thing i need an angle too so it's not such a waste but seriously. Is it a known unsolved problem, or am i doing it wrong?
-
you meant ascent, right?
lol for
He means ascent.
Also i'm constantly experiencing troubles with measuring distance between two points using Pythagoras' theorem. If only i put something like (x2-x1)^2+(y2-y1)^2 it makes danmakufu halt and crash instantly on stage start (even before any actuall call of that calculations). That makes me use such a perversions like
ang=atan2(y2-y1,x2-x1);
dist=(|(x2-x1)/cos(ang)|);And it works like a charm! Even when cos is about to be zero lol. Good thing i need an angle too so it's not such a waste but seriously. Is it a known unsolved problem, or am i doing it wrong?
That does not make any sense. If it crashes before even getting to that code, it can't possibly be that code's fault. That's an interesting alternate way to get distance, though I'm curious what happens when cos(ang) is 0.
-
Well, if you want to be really weird like that you can apply the tangent half-angle and do something incredibly stupid like
ang = atan2(y2-y1,x2-x1)
d = ( (x2-x1)^2 + (y2-y1)^2 )^0.5
tan(ang/2) = (1 - cos(ang)) / sin(ang)
ang = atan2(y2-y1,x2-x1) = 2 * atan( (d - (x2-x1)) / (y2-y1) )
d = (y2-y1) * tan( atan2(y2-y1,x2-x1) / 2 ) + (x2-x1)
But the problem is definitely with your other code, not the math code itself. (Speaking of which someone double-check my math I haven't done calc in ages)
However, d = (|(x2-x1)/cos(ang)|) doesn't make much sense. ang is (basically) the angle of o2 to o1 so cos(ang) is essentially just the +- x-distance between them, i.e. x2-x1. d looks like it should always return 1.
-
Even though it's completely pointless to improve on this method of getting distance, here's a function to get distance without the Pythagorean theorem.
function GetDistance(x1, y1, x2, y2){
let angle = atan2(y2-y1, x2-x1);
if(absolute(sin(angle)) > absolute(cos(angle))){
return absolute((y2-y1)/sin(ang));
}
else {
return absolute((x2-x1)/cos(ang));
}
}
Checking if sin or cos is larger because we don't want to divide by zero. Or even anything close to zero because of float precision.
-
However, d = (|(x2-x1)/cos(ang)|) doesn't make much sense. ang is (basically) the angle of o2 to o1 so cos(ang) is essentially just the +- x-distance between them, i.e. x2-x1. d looks like it should always return 1.
Wat? Remember definition of cosine? http://en.wikipedia.org/wiki/Trigonometric_functions#Right-angled_triangle_definitions If we have a vector x1y1 to x2y2 then we have some angle between this vector and x axis. cosine of that angle is adjacent / hypotenuse where adjacent=x2-x1 an hypotenuse is our distance.
And my function magically works in all conditions even when cos is about to be zero. I dunno what happens there. This language continues to confuse me.
-
Found this in the Useful Miscellaneous Code Snippets thread:
function GetDistance(x1,y1,x2,y2){
return(((x2-x1)^2+(y2-y1)^2)^(1/2))
}
Haven't tested if it works yet but it's worth a try.
-
Found this in the Useful Miscellaneous Code Snippets thread:
function GetDistance(x1,y1,x2,y2){
return(((x2-x1)^2+(y2-y1)^2)^(1/2))
}
Haven't tested if it works yet but it's worth a try.
Yes, that's the Pythagorean Theorem. We were trying to do it without that for stupid reasons.
-
function GetDistance(x1,y1,x2,y2){
return(((x2-x1)^2+(y2-y1)^2)^(1/2))
}
This DOESNT work in my scripts no matter of code it serves, or is it called as a separate function or not. And i think there's not a "problem of code" cause those weird trigonometric distance metering method works just fine. It looks just as kind of a curse or something :colonveeplusalpha:
-
I've been wondering. Should I replace the len_05 and genmu ExRumia for something more hard and a different boss. I don't know. I am currently translating Phantasm Romance but... I think I'll improve the old danmakufu ( Like anyone uses it or cares about the old engine anyway ).
-
( Like anyone uses it or cares about the old engine anyway ).
Plenty of people use 0.12m. Anyway, if you want to modify Ex-Rumia, go ahead. If you're just making another Rumia, then great. I hope you add sounds.
You should totally make a script/mod topic, and post all of your stuff there so it's easier for people to find :derp:.
-
Don't.
It's supposed to be there as an example for people who want to learn Danmakufu's scripting language by looking at actual code.
The better ExRumia scripts (and I don't mean the ones by the idiot beginners who can't do shit in Danmakufu
are more complicated and shouldn't be used as examples for learning Danmakufu off of.
-
My friend (Who hasn't an account here) wishes to ask why this fires no bullets, even with a time++; in the main loop.
http://pastebin.com/uHdMkWki (http://pastebin.com/uHdMkWki)
Thanks.
-
My friend (Who hasn't an account here) wishes to ask why this fires no bullets, even with a time++; in the main loop.
http://pastebin.com/uHdMkWki (http://pastebin.com/uHdMkWki)
Thanks.
It might be because of using the shot1 variable as id and not simply a number, but I'm not really sure.
-
It might be because of using the shot1 variable as id and not simply a number, but I'm not really sure.
Whynot? But could it be zero? :wat:
Ah! It doesnt fire because of double SetShotDataA before Fireshot. I've encountered the same mistake.
Also what means graphic id 87? Did he loaded it as user shot data?
Also i've got a question: I wanna make a spellcard for my player character wich is based on it's regular shot. Is there a way to make same task avaliable for both player and spell scripts?
-
Don't.
It's supposed to be there as an example for people who want to learn Danmakufu's scripting language by looking at actual code.
The better ExRumia scripts (and I don't mean the ones by the idiot beginners who can't do shit in Danmakufu
are more complicated and shouldn't be used as examples for learning Danmakufu off of.
I mean change the bullets to more beautiful bullets. I'll keep a spare copy for myself but, I just wanna change those shitty bullets(Or change the boss to Flandre or Sanae )
-
Plenty of people use 0.12m. Anyway, if you want to modify Ex-Rumia, go ahead. If you're just making another Rumia, then great. I hope you add sounds.
You should totally make a script/mod topic, and post all of your stuff there so it's easier for people to find :derp:.
I have one... I have finished translating PR (well almost). I have just begun my complete game Project and I Just want to replace EXrumia for peoples enjoyment to clearer and those shitty bullets. When I'm done, want a link?
-
Ah! It doesnt fire because of double SetShotDataA before Fireshot. I've encountered the same mistake.
Multiple SetShotDataA is allowed, so that has nothing to do with it.
Also i've got a question: I wanna make a spellcard for my player character wich is based on it's regular shot. Is there a way to make same task avaliable for both player and spell scripts?
You could just copy to the task and place it in another script.
-
You could just copy to the task and place it in another script.
Thanx Captain! I am about to do this but the task is huge and complicated enough to just a copy it into a spell script. So i wonder if i can.. call it from a library or something? But looks like i found another solution: modify this task so it can process OnBomb flag to change the fire behaviour.
-
How do you separate the bullets. For example, making a set of bullets do one task and making a different set of bullets do a different task at different times. Can some one explain to me? Thnx :)
-
How do you separate the bullets. For example, making a set of bullets do one task and making a different set of bullets do a different task at different times. Can some one explain to me? Thnx :)
The best way to program complex bullet patterns is to use object bullets. Read this tutorial (http://dmf.shrinemaiden.org/wiki/index.php?title=Nuclear_Cheese%27s_Shot_Object_Tutorial) and watch this one (http://www.youtube.com/watch?v=8Yr3UxcJi5I) to learns how it works.
You also may need to learn about tasking in danmakufu from this (http://www.shrinemaiden.org/forum/index.php/topic,865.0.html) mustread tutorial.
Good luck ;)
-
How to do curvy lasers? I'm interested on doing a survival card with curvy lasers.
-
a survival card with curvy lasers.
why would you do that that's stupid
I'll just paste the code from my own scripts, just a sec.
Basically, it's like CreateShotA, but the bullet trails behind a bit.
CreateLaserC(0, GetX, GetY, 10, 150/4, BLUE02, 20);
SetLaserDataC(0, 0, 4, GetAngleToPlayer, 1, 0, 0);
SetLaserDataC(0, 75, NULL, NULL, 0, 0, 0);
FireShot(0);
This makes a curvy laser, width 10, length ~38.5. It aims at the player but moves to the left a bit slightly.
-
Yay! Now Tenshi will troll reimu with Curvy Lasers! Thanks!
What did I do wrong? It keeps saying ImgBoss is an undefined number and I declared it to it's rightful destination path.
http://pastebin.com/RLmP0eqb
I suck at CreateShot01. I'm more of a CreateShotA person ( Well, I've been using CreateShotA for months so.) I suck at simple non spells. Why am I so used to making hard ones?
-
Ok. A few things.
-Use Pastebin (http://pastebin.com/) for large stripes of code when asking questions please.
-You don't have a frame variable declared.
-You're missing a bracket in your @MainLoop
-You don't have anything counting frame so it won't fire any bullets. It looks like you are trying to fire that spread once every 60 frames so use something like frame ++;
Your missing bracket is probably what's giving you that error since your drawing seems ok. Make sure to check and double check these.
-
Oh, I see. Fixed it now. But ImgBoss is not read. What in damn hell did I do wrong?
-
I fail to understand the concept of 'familiars'. Could someone describe in language simple enough for a child to understand, what a familiar is, how to make one, and how to put one in your stage script?
Thanks to anyone who can help, btw. :)
-
Familiars are like the one in IN. CtC uses them too. To make a familiar just do it within your script. ( For E.X. Yuyuko's Perfect Fan. And the Bunnies in Stage 5 IN that shoots out red balls. ) That or it's something having to do with for another example, Alice's doll. Atleast thats what my study proves.
-
Maybe familiar was the wrong word to use; I mean enemies. I'm not used to danmakufu, so I get mixed up at times. :blush:
-
Maybe familiar was the wrong word to use; I mean enemies. I'm not used to danmakufu, so I get mixed up at times. :blush:
Y U NO READ FAQ AND TUTORIALS? ლ(ಠ益ಠლ) http://www.shrinemaiden.org/forum/index.php/topic,865.0.html
-
This is where I need to clarify I know how to find & read tutorials, but what escapes me is understanding that part of the tutorial. I make my familiar, and when I try to stick it in, I get an error. I've since deleted all my familiar scripts, because there was no point trying when all I got was constant failure.
Let me simplify: I do not understand the section about familiars in that tutorial.
-
You'll need to be more specific. What exactly are you trying to do? What error do you get? What code is causing the error?
-
You can look at examples from the Default ExRumia Script. Or just simply search "Familiar" in the old danmakufu wiki ( Considering if it's there ).
-
// path/enemy.txt
script_enemy{
@Initialize{}
@MainLoop{}
@DrawLoop{}
@Finalize{}
}
// stage.txt
#headers if needed
script_stage_main{
@Initialize{}
@MainLoop{
//at some point
CreateEnemyFromFile("path/enemy.txt", x, y, s, a, 0);
}
@BackGround{}
@Finalize{}
}That's basically all enemies are. If you're getting errors and it isn't immediately obvious, then something is going wrong elsewhere. If you want help, please pastebin some sample code.
-
I'm making a spell card and I have few issues:
1. How to make boss sprite to rotate when the boss moves left or right (Chen and Ran are good examples about what kind of rotation I'm talking about)
2. How to make BG appear properly (It appears sometimes depending on script, I usually copy the part to @Background from script where the bg works and change neccesary things)
3. How to make BGM play properly (same thing as with BG, music plays sometimes depending on script)
-
1. How to make boss sprite to rotate when the boss moves left or right (Chen and Ran are good examples about what kind of rotation I'm talking about)
//in enemy sprite drawing, where spriteangle and spin are predefined
if( GetSpeedX != 0){ spin = GetSpeedX; } //GetSpeedX returns 1 if enemy is moving right and -1 is enemy is moving left
if( spriteangle != 0 ){ //needed so when the enemy stops it keeps spinning until upright
spriteangle += spin;
}
SetGraphicAngle(spriteangle);
2. How to make BG appear properly (It appears sometimes depending on script, I usually copy the part to @Background from script where the bg works and change neccesary things)
3D drawing in @BackGround is only used in stage scripts. You use @DrawLoop in enemy scripts for script-pertinent graphics, and @BackGround for spell card backgrounds. @BackGround does not work during non-cards, which are defined by the use or non-use of SetScore().
3. How to make BGM play properly (same thing as with BG, music plays sometimes depending on script)
That sounds more like you're doing something incredibly wrong. How do you try to make BGM play?
-
SetGraphicAngle(spriteangle);[/tt]
SetGraphicAngle(0,0,spriteangle); i think.
-
3D drawing in @BackGround is only used in stage scripts. You use @DrawLoop in enemy scripts for script-pertinent graphics, and @BackGround for spell card backgrounds. @BackGround does not work during non-cards, which are defined by the use or non-use of SetScore().
I know that already but for some reason it doesn't appear. Here is what I wrote in @Background
@Background {
SetTexture(bg);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0, 0, 255, 255);
SetGraphicScale(2, 2);
SetGraphicAngle(0, 0, 0);
DrawGraphic(GetCenterX, GetCenterY);
}
Because I'm lazy I copied that part from another script where the bg appeared. I didn't need to change anything else exept for GraphicRect, because I always use same names for these "let <name> = <some stuff>" things, file names and always create same directories inside my script directory
That sounds more like you're doing something incredibly wrong. How do you try to make BGM play?
This is how it was instructed in a tutorial
#TouhouDanmakufu
#Title[title]
#Text[text]
#Player[FREE]
#ScriptVersion[2]
#BGM[.\bgm\bgmBoss.mp3"]
script_enemy_main {
Some stuff
}
EDIT:
//in enemy sprite drawing, where spriteangle and spin are predefined
if( GetSpeedX != 0){ spin = GetSpeedX; } //GetSpeedX returns 1 if enemy is moving right and -1 is enemy is moving left
if( spriteangle != 0 ){ //needed so when the enemy stops it keeps spinning until upright
spriteangle += spin;
}
SetGraphicAngle(spriteangle);
Danmakufu gave an error about the word spin
-
@Background
@BackGround. Capital G.
#BGM[.\bgm\bgmBoss.mp3"]
Well I'm not sure why the random quotation marks are there (everything in the headers are read as strings by default), but that isn't a problem. Try doing it the standard way, which is using PlayMusic("pathtoyourfile"); in @Initialize or during the script sometime. Somehow I don't think it'll help, but eh.
Danmakufu gave an error about the word spin
...That's why I noted that spriteangle and spin have to be predefined. They're variables. Give them both values of 0 or something.
-
@BackGround. Capital G.
Well I'm not sure why the random quotation marks are there (everything in the headers are read as strings by default), but that isn't a problem. Try doing it the standard way, which is using PlayMusic("pathtoyourfile"); in @Initialize or during the script sometime. Somehow I don't think it'll help, but eh.
...That's why I noted that spriteangle and spin have to be predefined. They're variables. Give them both values of 0 or something.
I created variables "spin" and "spriteangle". But now it gives me error about SetGraphicAngle
-
I created variables "spin" and "spriteangle". But now it gives me error about SetGraphicAngle
Look up the function next time. Do not immediately post back after every single error, investigate and try to figure out why. If you really can't figure it out after trying a bunch of things, then post back and we'll see if we can help.
SetGraphicAngle(0, 0, spriteangle);
-
Hey, How do you set player lives. ( Like in Phantasm romance lifes are 2 and CtC youcan set it.
-
ExtendPlayer(number);
-
Or rather, ExtendPlayer(thenumberoflivesyouwanttheplayertohave-GetPlayerLife);
-
Look up the function next time. Do not immediately post back after every single error, investigate and try to figure out why. If you really can't figure it out after trying a bunch of things, then post back and we'll see if we can help.
SetGraphicAngle(0, 0, spriteangle);
Ok, this time I tried to investigate things. Danmakufu doesn't give any errors this time, but the sprite doesn't spin and I have tried everything.
Maby this helps:
@DrawLoop {
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1, 1);
let spin = 0;
let spriteangle = 0;
if(int(GetSpeedX())==0) {
SetGraphicAngle(0, 0, spriteangle);
if(f<5){ SetGraphicRect(7, 197, 43, 256); }
if(f>=5 && f<10){ SetGraphicRect(55, 197, 91, 256); }
if(f>=10 && f<15){ SetGraphicRect(103, 197, 139, 256); }
if(f>=15 && f<20){ SetGraphicRect(151, 197, 187, 256); }
f2=0;
}
if(GetSpeedX()>0) {
SetGraphicAngle(0, 0, spriteangle);
if(f2<5){ SetGraphicRect(11, 324, 41, 384); }
if(f2>=5 && f2<10){ SetGraphicRect(56, 328, 88, 384); }
if(f2>=10){ SetGraphicRect(107, 331, 136, 377); }
f2++;
}
if(GetSpeedX()<0) {
SetGraphicAngle(180, 0, spriteangle);
if(f2<5){ SetGraphicRect(11, 324, 41, 384); }
if(f2>=5 && f2<10){ SetGraphicRect(56, 328, 88, 384); }
if(f2>=10){ SetGraphicRect(107, 331, 136, 377); }
f2++;
}
if( GetSpeedX != 0){ spin = GetSpeedX; }
if( spriteangle != 0 ){
spriteangle += spin;
}
DrawGraphic(GetX, GetY);
f++;
if(f==20) {f=0;}
}
I hope you can find waht's wrong.
-
let spriteangle = 0;
Define it outside the drawloop so it'll not always reset to zero. Also join those two ifs doing the same thing.
Also, lets go talk on IRC. I'm currently sitting there bored :wikipedia:
-
Define it outside the drawloop so it'll not always reset to zero. Also join those two ifs doing the same thing.
Doesn't work. I also tried moving let spin = 0; outside @DrawLoop because it didn't recognize it while it was there.
I'm starting to wonder if the part of the script that should make the sprite to rotate even works.
-
also what does
if( spriteangle != 0 ){
spriteangle += spin;
}mean? Is it supposed to ever perform?
-
also what does
if( spriteangle != 0 ){
spriteangle += spin;
}mean? Is it supposed to ever perform?
Here is the answer:
//in enemy sprite drawing, where spriteangle and spin are predefined
if( GetSpeedX != 0){ spin = GetSpeedX; } //GetSpeedX returns 1 if enemy is moving right and -1 is enemy is moving left
if( spriteangle != 0 ){ //needed so when the enemy stops it keeps spinning until upright
spriteangle += spin;
}
-
Here is the answer:
In your code it's never supposed to perform. I've edited it to something like this
let spin = 0;
let spriteangle = 0;
@DrawLoop {
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1, 1);
if(trunc(GetSpeedX())==0) {
if(spriteangle==0){spin=0;}
SetGraphicAngle(0, 0, spriteangle);
if(f<5){ SetGraphicRect(7, 197, 43, 256); }
if(f>=5 && f<10){ SetGraphicRect(55, 197, 91, 256); }
if(f>=10 && f<15){ SetGraphicRect(103, 197, 139, 256); }
if(f>=15 && f<20){ SetGraphicRect(151, 197, 187, 256); }
f2=0;
}else{
spin = GetSpeedX;
if(f2<5){ SetGraphicRect(11, 324, 41, 384); }
if(f2>=5 && f2<10){ SetGraphicRect(56, 328, 88, 384); }
if(f2>=10){ SetGraphicRect(107, 331, 136, 377); }
f2++;
if(GetSpeedX()>0) {
SetGraphicAngle(0, 0, spriteangle);
}
if(GetSpeedX()<0) {
SetGraphicAngle(180, 0, spriteangle);
}
}
spriteangle += spin;
DrawGraphic(GetX, GetY);
f++;
if(f==20) {f=0;}
}
Havent tried it cause i havent those sprites'n'shit.
Oh. And lets stop flooding the thread already and go IRC (http://webchat.ppirc.net/?channels=danmakufu) and talk there
-
Can someone make a SA ReimuA player? I just want it because I'm pure lazy
-
make options circle around the player, fire shots forward at a constant rate
if not focusing and not shooting and the player leans against a wall and taps twice in that direction, the player warps to the other side of the screen
code this
-
Oh, i see. Meh. It'll be done after i'm not lazy
-
then stop being lazy
Ok, so just wondering - why can't enemies and object effects be created on the first frame?
(Though it's easily avoidable.)
-
Fine. *Opening folder* *Open's notepad* *Does long work* *Searches for god damn purple needles and yin-yang orbs* *Goes to work*
THE END :D
Since I'm not gonna be lazy anymore, anyone know where to find yin-yang orbs and purple needles of death? ( You get my cookies if you give me a link ).
There is no reason for double posting. Please edit your posts. -Helepolis
-
go (http://www.shrinemaiden.org/forum/index.php/topic,197.0.html)
-
Ok, so just wondering - why can't enemies and object effects be created on the first frame?
I'm pretty certain it's because the engine hasn't initialized for drawing yet, basically. It's similar to why DrawLoop and Object Effects seem to draw on different frames.
-> script reading
--> variables initialize and errors show up
-> @initialize
--> drawing task
---> trying to draw things, no render available, abort abort
--> other tasks
---> yield; exits thread, no other active yield available, continue program flow
-> @mainloop
--> yield; no other active yield available, continue program flow
-> @drawloop
--> set up current frame rende
--> render drawing
-> frame finished; computer threads to other programs, updates monitor
-> @mainloop
--> yield; threads to task stack
--> tasks
---> yield to next task etcetcetc
--> last task yields; no other active yield available, continue program flow
-> @drawloop
--> set up current frame render
--> render drawing
-> frame finished; computer threads to other programs, updates monitor
Something along those lines. It's also possible danmakufu threads over after MainLoop and not after DrawLoop, maybe. I don't really know.
-
Is it possible to check for whether a player's shots are colliding with an object or enemy? I want to have bullets fired back if a particular target is shot, similar to how Parsee's second spellcard works in SA.
-
Well, if you're going to do it in the way Parsee's card does, you'd just need GetHitCount.
So like, if(GetHitCount > 0) { FIREMOREBULLETS!!!; }
In the enemy script, of course.
-
Be careful about that though, since that returns the number of hits in the previous frame, not the damage. If you just created a set number of bullets per hit, a rapid-fire player would get completely swamped but a single-shot powerful player would have no trouble at all. The better thing to do would be to store the enemy's current life, and next frame see what the difference is with its current life, so it's based on how much damage you're doing instead of the number of hits.
-
Like this? (Typing from memory instead of actually stealing from my own code since I'm hella tired right now.)
let diffinlife = 0;
task updatelife {
let nL = GetLife;
loop {
diffinlife = GetLife-nL;
yield;
nL = GetLife;
}
}
thencallupdatelife,anddostuffwithdiffinlife
-
That wont do it like Small box, Large box. You actually need to track wich shots attack wich target. This should be checked with Obj_IsIntersected and comparing projectile coordinates in enemy script via common data exchange.
Jesus. What a BS i wrote. Of course you can count enemy hits if you spawn a "Parsee clone" like a child enemy. More like
shitty code that doesnt work
(http://www.scenemusic.net/static/emoticons/facepalm.gif)
-
Nope.
Since you're creating the count variable in @Initialize, it will only be available in the @Initialize block of code. Which means @MainLoop can't use it.
Also, since you're making it that you have to hit the boss with more bullets every time you hit it, you'd quickly become not able to get the boss to fire any more bullets. Also, it's a while, so :infiniteloop: after that happens.
I think that's what's up there.
Discussion in IRC.
-
http://pastebin.com/7TGgjedk now it works like i wanted.
-
Anyone have a CTC Marisa sprite?
-
Something tells me you're not in the right thread. Also, which type? Player? Boss sprite?
I think I can probably find a boss-type CtC Marisa sprite.
-
Something tells me you're not in the right thread. Also, which type? Player? Boss sprite?
I think I can probably find a boss-type CtC Marisa sprite.
Oops. It's suppose to be in the request thread. Sorry. Anyway, boss sprite please.
( WHY THE F**K DO I POST IN THE WRONG THREAD!!!??? Meh. This headache is getting my nerves today)...
-
I have a question:
Are there any tutorials that I can use (I am a beginner)? All the ones in the Danmakufu tutorial thread are so confusing! Is there an easy turorial, please?
-
Yeah, there's this one (http://www.shrinemaiden.org/forum/index.php/topic,30.0.html) and then there are a few more over here (http://www.shrinemaiden.org/forum/index.php/topic,2852.0.html).
:D
-
If you've looked at my beginner tutorial and said it's too difficult, then we're going to have some problems. It starts at the basics of computer languages, variables and control statements. There's nothing that's simpler than that. Now, I have considered starting a video tutorial series on YouTube parallel to Helepolis's, but it's a daunting task and I don't think I'd be able to keep it going long enough to teach everything.
My advice is to try reading my beginner tutorial again slowly. Read a section and try to absorb the information. If you didn't get it that time, try again another day. Sometimes looking at something confusing again after you had a chance to sleep helps.
-
Is there a way to make the music loop from cetrain spot?
-
Um... Not exactly.
But, you can do something like...
http://pastebin.com/P5sMRrNQ
I'm actually not entirely sure myself, because I haven't tested that. Yet. But it does seem to work in games like Never Extinguished Flame.
-
Is there a way to choose player after the script started? The only idea coming to my mind is to make some "universal" player script, containing all shottypes and then tell it wich one to choose via common data :wat:
-
Yeah, that'd be the way. You can still use separate files as long as you import them properly.
-
Another question: how the fuck danmakufu defines bullet's hitbox by graphic loaded? Is it always a circle with a radius measured by graphic size? And what about stretched sprites?
-
Another question: how the fuck danmakufu defines bullet's hitbox by graphic loaded? Is it always a circle with a radius measured by graphic size? And what about stretched sprites?
Yes, it's a circle of radius [smallest dimension of graphic] / 2, or 3, or at least something close to that. Bullets themselves cannot be resized, though. If you define an object bullet and use another render object to draw it, it doesn't affect the hitbox. If you use a laser to stretch it though, then danmakufu calculates a new hitbox as it does for all lasers.
-
Yes, it's a circle of radius [smallest dimension of graphic] / 2, or 3, or at least something close to that. Bullets themselves cannot be resized, though. If you define an object bullet and use another render object to draw it, it doesn't affect the hitbox. If you use a laser to stretch it though, then danmakufu calculates a new hitbox as it does for all lasers.
Just as i thought. So i can "define" the hitbox/bullet size relation by changing the fraction of rectangle the actual bullet's image takes. Like if i wanna make a bullet with a bigger hitbox i have to make it smaller than the rectangle defined in shotdata. Oh man. This should be mentioned in basic tutorials once it's going into loading user bullets, cause it's danmaku-critical. Remember, the first thing i've done is like loading a graphic for a blullet with a rect equal to it's image, and then was confused why all my bullets are so easy to dodge? ??? Also i think i have to make some test script just for testing the hitboxes.
And the fact you actually cant resize user bullets after being loaded kinda sucks. I have idea of a pattern based on bullet size (and it's hitbox too) change and just putting an effect object over wont work. The only solution i see - is to split size changing in some steps and load them as separate ids. That's ridiculous, but kinda might work.
And how actually laser hitboxes work? How do functions like ObjLaser_SetLength, ObjLaser_SetWidth and size of a graphic used affect it?
-
If you really want to you can use SetCollisionB as a makeshift bullet collision. It's kind of roundabout but it works, I guess.
-
Hahaha. Like spreading enemy's hibox all over the place. That makes some sense though, so i'll try it. Thanx for advice ;)
UPD: I've actually made some simple script wich shows how hitbox size relates to visible bullet size depending on bullet graphic rectangle.
Download script (http://www.mediafire.com/?ictsk9yl5vcob99) 11 kb.
(http://album.foto.ru:8080/photos/or/123238/2210801.jpg)
I think this might be usefull for noobs just entering custom shots management.
And now i've gotta redo all shotdata for my game and as a consequence of that - modify some patterns :fail:
-
nevermind...
-
http://pastebin.com/7NgrMLy0
- I can't tell if SetAction is failing because that isn't linked.
- Your first SetShotData is telling the bullet to go 60 pixels per frame at 1.5 degrees, turning 1 degree per frame, accelerating at 20 pixels per frame until it hits 70 pixels per frame. That is definitely not anything close to what you probably want.
- You second SetShotData is actually set to activate before the first one so I don't know why it's below it. It's telling the bullet to go 10 pixels right and 30 pixels down per frame, accelerating at 20 pixels right per frame and 1.5 pixels down per frame until it reaches 15 pixels right and 35 pixels down per frame. This is still not anything close to something that makes sense.
- Your AddShot is trying to add a bullet with the ID of 134 to the first bullet, but you don't have a bullet with the ID of 134. Error would happen here.
- rand(0,0) will return 0.
- You actually managed to not even give the right amount of arguments for CreateShot01. Both of them. Error would happen.
- Your CreateShot02 isn't even finished and misspells "GetX". Error would happen.
- Your frame==480 section has an extra close bracket that would also make the script error.
- DrawBoss isn't even a function and even if it were DrawGraphic it would error because nothing is set up before you call it. Error.
- Both SetAction(ACT_MOVE,0) in your DrawLoop have no semicolon. Error.
- You don't have a closing bracket for script_enemy_main which I can only assume is the extra bracket mentioned above.
What are you doing.
-
- I can't tell if SetAction is failing because that isn't linked.
- Your first SetShotData is telling the bullet to go 60 pixels per frame at 1.5 degrees, turning 1 degree per frame, accelerating at 20 pixels per frame until it hits 70 pixels per frame. That is definitely not anything close to what you probably want.
- You second SetShotData is actually set to activate before the first one so I don't know why it's below it. It's telling the bullet to go 10 pixels right and 30 pixels down per frame, accelerating at 20 pixels right per frame and 1.5 pixels down per frame until it reaches 15 pixels right and 35 pixels down per frame. This is still not anything close to something that makes sense.
- Your AddShot is trying to add a bullet with the ID of 134 to the first bullet, but you don't have a bullet with the ID of 134. Error would happen here.
- rand(0,0) will return 0.
- You actually managed to not even give the right amount of arguments for CreateShot01. Both of them. Error would happen.
- Your CreateShot02 isn't even finished and misspells "GetX". Error would happen.
- Your frame==480 section has an extra close bracket that would also make the script error.
- DrawBoss isn't even a function and even if it were DrawGraphic it would error because nothing is set up before you call it. Error.
- Both SetAction(ACT_MOVE,0) in your DrawLoop have no semicolon. Error.
- You don't have a closing bracket for script_enemy_main which I can only assume is the extra bracket mentioned above.
What are you doing.
I'm linking the actions too lib_anime_Marisa. I used DrawBoss as an experiment (I'm using the FLAN library Example). I'm typing in random codes for no apparent reason. I forgot to erase CreateShot02. ACT_MOVE,0 really doesn't need semicolons. I used it to modify Genmu and it works fine. Meh, for some reason i'm noly good at event scripts. This is my first time scripting in months now and I forgot most of the functions. Seems like i need to study more... ( Oh yeah. I loaded the usershot data. Should i use it as include_function instead?
-
Does GetEventStep work in stage scripts? Every time I attempt to run a script with that in it, it gives me an error message with GetEventScript highlighted as the cause.
-
Nope, OnEvent and GetEventStep only work in Enemy scripts.
-
What does CreateEnemyFromFile do?
-
What does CreateEnemyFromFile do?
As written on the wiki:
Create a child enemy which behavior is defined in another file. Plural-script files can not be passed.
6 Parameters
1) path of the enemy script (string)
2) x-coordinate
3) y-coordinate
4) velocity
5) direction
6) user-defined argument
-
Thank you.
-
Hey, I'm having problems with some effect objects that I'm making. I wanted these circles to act like Medicine's EX attacks from PoFV where they slow down (or in some cases speed up) the player. However, the player's movement inside the moving circles is a bit wonky, I'm not sure what's wrong. Here's the effect object:
http://pastebin.com/rffbq0LG
Thanks!
-
Hey, I'm having problems with some effect objects that I'm making. I wanted these circles to act like Medicine's EX attacks from PoFV where they slow down (or in some cases speed up) the player. However, the player's movement inside the moving circles is a bit wonky, I'm not sure what's wrong. Here's the effect object:
http://pastebin.com/rffbq0LG
Thanks!
Hmm. Seems like you are trying to shift a player in direction oposite to wich it moves. I guess it's just SetPlayerX and Y functions negotiating player's movement by assigning an absolute value to it's position. I dunno what do you mean by "wonky", but i encountered the same issue with SetX, SetY in enemy script. Once called it will completely ignore current enemy's speed for some reason. Maybe you should do it the other way by completely overriding player's movement. Get player's focused and unfocused speeds by GetPlayerInfo assign them to vL and vH but with some decrease, and then move player in direction it needs to move like if(GetKeyState(VK_UP)!=KEY_FREE) { y-=vL } instead of +. That's just a suggestion. I havent tested it for real :blush:
-
Hmm. Seems like you are trying to shift a player in direction oposite to wich it moves. I guess it's just SetPlayerX and Y functions negotiating player's movement by assigning an absolute value to it's position. I dunno what do you mean by "wonky", but i encountered the same issue with SetX, SetY in enemy script. Once called it will completely ignore current enemy's speed for some reason. Maybe you should do it the other way by completely overriding player's movement. Get player's focused and unfocused speeds by GetPlayerInfo assign them to vL and vH but with some decrease, and then move player in direction it needs to move like if(GetKeyState(VK_UP)!=KEY_FREE) { y-=vL } instead of +. That's just a suggestion. I havent tested it for real :blush:
Actually, you're suggestion was what I tried initially, only instead of completely overriding the player's movement, it actually added to it and sped it up, instead of slowing it down as intended. So I'm stumped now.
Here's the version with your suggestion: http://pastebin.com/RNsEA5Up
-
EDIT: Actually I misread the text, but still. If the second one adds to the speed then the first one should work instead. If the first one ignores the actual player movement then the second one should work. Explain what "wonky" is and such. I would also suggest maybe halving the speeds (or some other multiple) to be certain that no player will start moving backwards.
If you really want to override the player's movement, turn the current method into a flagswitch...
let inarea = false;
while(!Obj_BeDeleted(obj)) {
if(type == 2 && playerisinbox && ! inarea) { inarea=true; slowmove; }
}
And then change your actually-just-a-subroutine-task into an embedded (to modify the flag) looping task like
task slowmove {
let x = GetPlayerX; let y = GetPlayerY;
let vL = GetPlayerInfo(PLAYER_SPEED_LOW)/2;
let vH = GetPlayerInfo(PLAYER_SPEED_HIGH)/2;
while(playerstillinbox){
dothings;
positionplayer;
yield;
}
inarea = false;
}
This way, as soon as you enter the box, the player position is given and then locked. In all the next frames afterwards it doesn't get any new player position, it only modifies the already-known position. So, there's no chance of accidental speedup.
-
Sorry I didn't know how better to describe it. When the player moves diagonally within the field, the speed is for some reason lowered even more than it would be just moving up, down, right, or left. It's like the effect of the original slowmove task is double for diagonal movement. The "wonky" movement resulted when some players that had a high enough speed would end up going backwards when they attempted to move diagonally.
Edit:
If you really want to override the player's movement, turn the current method into a flagswitch...
let inarea = false;
while(!Obj_BeDeleted(obj)) {
if(type == 2 && playerisinbox && ! inarea) { inarea=true; slowmove; }
}
And then change your actually-just-a-subroutine-task into an embedded (to modify the flag) looping task like
task slowmove {
let x = GetPlayerX; let y = GetPlayerY;
let vL = GetPlayerInfo(PLAYER_SPEED_LOW)/2;
let vH = GetPlayerInfo(PLAYER_SPEED_HIGH)/2;
while(playerstillinbox){
dothings;
positionplayer;
yield;
}
inarea = false;
}
This way, as soon as you enter the box, the player position is given and then locked. In all the next frames afterwards it doesn't get any new player position, it only modifies the already-known position. So, there's no chance of accidental speedup.
Thanks a bunch! That's exactly what I was trying to do. It works perfectly now.
-
How do you create Marisa's Master Spark? I'm using it in Yuuka's card, Flowering Breeze,"Master Spark"
-
it'd be nice if you were to make something OTHER than copying spellcards...
It seems you just make a huge laser, with a bit more than usual delay.
-
it'd be nice if you were to make something OTHER than copying spellcards...
It seems you just make a huge laser, with a bit more than usual delay.
Thank you! By the way, didn't Yuka had Master Spark first, till marisa stole it?
-
What I mean is, that doesn't really give you a good enough excuse to just throw in Master Spark into a Yuuka fight, instead of making more pretty flower patterns. Well, this excuse isn't good enough for me, at least. (But, it IS she who used it first... But she only used it once.)
-
I had an idea for a flower pattern. It was impossible too pull for me to pull off. Well here's how it starts out:
1. Yuka shoots curvy lasers in left and right
2. The Curvy lasers leave out a bunch of familiars
3. The Familiars shoot a sunflower pattern danmaku
4. Yuka in the mean time shoots a perfect circle of bubbles.
5. The familiars delete themselves leaving behind billions of petals.
6. The petals freeze and does a Phantasm romance Sakuya Cheap.
7. Restart.
Since I have barely any experience with familiars ( Because they glitch up in danmakufu (The CTC one ) and they look dem ugly. if you know what I mean ). and I never task much, I really don't know. I'll just look in some example scripts from genmu.
-
I finally got around to trying advice given to me earlier on this thread about making multi-layered backgrounds, but I seem to have encountered a problem. I believe I followed the advice I was given, but I can only get one background to appear. The second one doesn't appear on top.
Here's what I have for my @Background (I've already declared "bg" and "bg2" at the start of the script)
@BackGround{
SetTexture(bg);
SetGraphicRect(0,0,256,256);
SetGraphicScale(1.75,1.75);
SetGraphicAngle(0,0,0);
DrawGraphic(GetCenterX,GetCenterY);
SetTexture(bg2);
SetGraphicRect(0,0,256,256);
SetGraphicScale(1.75,1.75);
SetGraphicAngle(0,0,0);
DrawGraphic(GetCenterX,GetCenterY);
}
I'm trying to get "bg2" to appear on top of "bg", but it doesn't seem to be working.
-
Could you pastebin your entire script? Something tells me you are loading/defining your textures wrong. Hard to judge from just your background loop (which seems fine so far).
-
How do you load Yuyuko's fan? To I need to task it or something?
-
How do you load Yuyuko's fan? To I need to task it or something?
Yuyuko's fan is an image which you need to draw using Effect Objects. If you're unknown with Effect Objects, you might want to first dive into. (Which is same principal for Master Spark etc).
-
Could you pastebin your entire script? Something tells me you are loading/defining your textures wrong. Hard to judge from just your background loop (which seems fine so far).
That may not be necessary, because I tested the script out again a few times with several other images for "bg2", and it worked out the way I intended. It only doesn't work when I try to use this image (http://i43.tinypic.com/11k9q0z.jpg) for "bg2". Could this perhaps be remedied by SetRenderState or SetAlpha, since the image is partially transparent? I tried playing around with it a bit myself, but couldn't get anything to work.
-
It is a JPG. You might want to try BPM or PNG. As far as I know, Danmakufu doesn't like JPG.
JPG has no transparency, PNG has that. BPM only has it for pure black (0,0,0). I think there is your issue.
-
It is a JPG. You might want to try BPM or PNG. As far as I know, Danmakufu doesn't like JPG.
JPG has no transparency, PNG has that. BPM only has it for pure black (0,0,0). I think there is your issue.
Tinypic uploaded that image as a JPG, but I can assure you that the original image is in fact a PNG. I've never tried BPM, though, and what you said about it sounds like it could be helpful, so I'll give that a try.
-
I don't remember tinypic forcing pictures into different formats. Either way, it sounds to me like a corrupted image in worst case. You can try to reupload it as PNG and I'll test it out by trying to load it in my script.
There is noway a singular image is going to fail to load unless:
- The image is corrupt
- The image is not true format (dodgy saving/corruption as well)
- Script mistakes/errors
-
You might want to try BPM or PNG.
I've never tried BPM, though, and what you said about it sounds like it could be helpful, so I'll give that a try.
It's BMP, not BPM.
-
I don't remember tinypic forcing pictures into different formats. Either way, it sounds to me like a corrupted image in worst case. You can try to reupload it as PNG and I'll test it out by trying to load it in my script.
There is noway a singular image is going to fail to load unless:
- The image is corrupt
- The image is not true format (dodgy saving/corruption as well)
- Script mistakes/errors
Hmm...this is very strange. I tried re-saving the image as a .PNG file, but it still doesn't work in the script. I checked multiple times to make sure I wasn't being stupid and messing up with the scripting, but I spotted no errors (and as stated earlier, it actually worked when I tried every other image in the same folder). I even made a new image file, copied over the contents of this image, and saved that as a .PNG. I keep trying to reupload it to Tinypic, and checked several times to make sure it was an actual .PNG file, but it keeps getting turned into a .JPG.
Well, Photobucket seems to keep it true to a .PNG, so if you could help me out and test this image (http://i275.photobucket.com/albums/jj300/ZiiPee/yukaribg2.png) out yourself, that'd be great.
It's BMP, not BPM.
Yeah, I kinda figured that out when I tried to save the image as a different file type. ::)
EDIT: Weirdness going on...while messing around, I found out that if I made the image for "bg" the same as the image for "bg2", both will appear, but if I put the image that I originally intended for "bg", "bg2" will not appear. Here's my entire script, because something's going on that I'm not noticing for some reason.
http://pastebin.com/zA8wniGa (http://pastebin.com/zA8wniGa)
The above-linked image is "bg2", this is "bg1" (http://i275.photobucket.com/albums/jj300/ZiiPee/yukaribg.png).
-
christdamnit you didn't load the graphic
-
christdamnit you didn't load the graphic
Damn...I KNEW it was something stupid. :derp: Thanks.
-
christdamnit you didn't load the graphic
And I even asked him to paste his full script before =.=
AJS, next time please just follow our requests when we ask you. You'd be surprised how often people make common mistakes like this. It is only disrespectful and stressing for us who are trying to help when people refuse to post their scripts.
It's BMP, not BPM.
I blame my thesis work :V Been lately searching for Business Process Modelling papers a lot :V
-
Everytime I try to use the random patern generators or the first Koishi Hell, It comes up with an error saying that th_dnh has stopped working, meaning that it just causes my Danmakufu to crash. I have the latest version of it, but this isn't the first time it's happened.
On the other hand, I can play the Second Koishi Hell just fine, and one other person's script is the same.
But every other script crashes Danmakufu. Is there anything I can do to fix this problem?
-
Well, first of all, are you using AppLocale? Danmakufu likes crashing without it.
Additionally, there are two versions now. Some scripts, like Koishi Hell, are for the first(0.12m), while other, newer scripts are for the latest version(ph3). Make sure to check what version the script is for, and what version you're using.
You can see detailed information in the great information thread, (http://www.shrinemaiden.org/forum/index.php/topic,6181.msg345024.html#msg345024) along with the other stickies in this board.
-
Where can i find the most complete list of builtin sound effects filenames? So i could disable them like
DeleteSE("seseEnemyExplode01.wav");
DeleteSE("seseUseSpellCard.wav");
-
sePlayerShot01.wav
seGraze.wav
sePlayerCollision.wav
sePlayerSpellCard.wav
se1UP.wav
seScore.wav
seBomb_ReimuA.wav
seExplode01.wav
seBomb_ReimuB.wav
seUseSpellCard.wav
seGetSpellCardBonus.wav
seEnemyExplode01.wav
seSuperNaturalBorder1.wav
seSuperNaturalBorder2.wav
-
Ah thanks. Already found it at http://www.shrinemaiden.org/forum/index.php/topic,3167.msg143460.html#msg143460
Another question: Can i unload outer frame graphic STG_Frame.png? Wich folder is it placed in? When i put something like DeleteGraphic("img\STG_Frame.png"); it makes danmakufu crash instantly. Is there a way to do this or it's better to use effect objects?
-
You have the directory right. If you want to change the frame then instead of deleting it and making new one, just rename your new file to STG_Frame.png and plop it in the dnh\img folder. Create the folder if it doesn't exist.
-
And I even asked him to paste his full script before =.=
AJS, next time please just follow our requests when we ask you. You'd be surprised how often people make common mistakes like this. It is only disrespectful and stressing for us who are trying to help when people refuse to post their scripts.
My bad. I thought I had things mostly figured out, but obviously I didn't.
Now more on-topic, how do you make multiple bosses with a shared health bar? (i.e. the Prismrivers)
-
You have the directory right. If you want to change the frame then instead of deleting it and making new one, just rename your new file to STG_Frame.png and plop it in the dnh\img folder. Create the folder if it doesn't exist.
No. That's not what i wanna do in my game. And i just figured out - using effect objects is more flexible for that.
My bad. I thought I had things mostly figured out, but obviously I didn't.
Now more on-topic, how do you make multiple bosses with a shared health bar? (i.e. the Prismrivers)
Just call SetCollisionA on every instance of the boss you want to receive damage. But if you want count separate damage for multiboss battle (like Seiga/Yoshika) you'd better use child enemies or override it somehow else.
-
Is anything wrong with this script. I have been studying MainLoop style scripting and this is what I got:
http://pastebin.com/8HhrHY9L
-
No. That's not what i wanna do in my game. And i just figured out - using effect objects is more flexible for that.
Well ok, it's kind of hard to give you advice if you aren't willing to say what your end goal is. And alternatively, if you don't want to replace it, you can still make it transparent by just using a blank image and naming it STG_Frame just the same. But whatever.
-
Well ok, it's kind of hard to give you advice if you aren't willing to say what your end goal is. And alternatively, if you don't want to replace it, you can still make it transparent by just using a blank image and naming it STG_Frame just the same. But whatever.
I mean i wanna release my game as a separate script, not a package including danmakufu defaults substitutions. Who knows wich already customized setup could it encounter?
Well. If even i decide to release it CtC style, still i dont wanna do that. And layer 8 objects work just fine to overdraw default frame with something ;)
-
Is anything wrong with this script. I have been studying MainLoop style scripting and this is what I got:
http://pastebin.com/8HhrHY9L
I think you forgot to put two brackets in the frame 150.
if( frame == 150 ){
ascent( i in 0..100){
CreateShot01( GetX, GetY, 5, 0+i*10-20, WHITE03, 10 );
}// <-- This
}// <--- This
and one bracket at the end of the script.
@Finalize {
DeleteGraphic( Boss_Meirin );
}
}// <--- this
-
Oh. Forgot that. I corrected some other stuff too. Thanks.
I don't get this though:
変数は関数やsubのようには呼べません(569行目)
↓
if( frame == 160 ) { frame == 10 }
}
@DrawLoop {
if(G
~~~
---------------------------
OK
---------------------------
That's the only problem left.
-
With that problem, it should be if(frame == 160 ) { frame = 10 }. Since you're changing the variable, you only use one equals.
-
Darnit. I used one more "="!
-
Just call SetCollisionA on every instance of the boss you want to receive damage. But if you want count separate damage for multiboss battle (like Seiga/Yoshika) you'd better use child enemies or override it somehow else.
Hmm, that solves one thing, but my main question was how to actually create the multiple bosses themselves without using familiars (which is what I've been doing).
-
I have a question about AppLocale , when I turn on AppLocale and set things to japanese and stuff, nothing happens. So now I can't open danmakufu v0.13 and my danmakufu v0.12 starts having bold fronts
When, I download it again, the icon is different and I can't install AppLocale again.
(http://i477.photobucket.com/albums/rr139/namethecool/1.png)
(http://i477.photobucket.com/albums/rr139/namethecool/2.png)
How u fix :(
-
There's a v0.13?
Well, try downloading it again or search the program to open it. OR, you can make another user and then transport the Danmakufu files to the new user. Are you using an old Windows or a Mac? This happened to me once, and I just made another user.
-
Hmm, that solves one thing, but my main question was how to actually create the multiple bosses themselves without using familiars (which is what I've been doing).
Exactly the same way as a "single" boss. Think of them as an "extended hitbox". Add more sprites to DrawLoop, controll their moving and shooting (note that such functions like GetX, GetAngleToPlayer will still return stuff from main boss so you need to store additional data) call SetCollisionA and B at their places and you'll get an illusion of multiple bosses with shared healthbar, while it's actually a single boss.
-
One Question, How do you make lasers rotate? I want to use Lasers like Keine's Last Word Lasers ( CreateLaserA right? ) to rotate.
-
Emperor of the East lasers don't actually move, they just get created at different times and aimed in different directions. Make a task that creates a laser, increases the angle, waits, and repeats itself until a circle is made.
-
I'm very sorry for asking stupid question along with spamming, but how do you make a boss move in a perfect star?
-
Well, you'd think if you wanted to move in a star, that would just be five angles in equal increments. You'll end up back at the start, so it just makes sense that you'll end up increasing the angle until you hit 360 degrees. 5 points, 360/5=72, so just increase angle by 72 each time you want to change direction.
-
By 2*72=144 actually. Adding 72 would make it a pentagon.
-
I just made a stage script designed to endlessly repeat a particular spellcard (in this case the last word that I developed) until a capture or timeout occurs, sort of like how spell practice works in IN and TD. However, the only problem I have is that the replay will contain all of the unsuccessful attempts in addition to the successful one. I'm wondering, is there a way to fix that? I know Concealed the Conclusion's replays somehow skip past the menu screen, but I have no idea how they did it.
Here's the code for the spell practice stage:
http://pastebin.com/MBdY32w5
I have the "repeat" common data being set to false in the @Finalize of the spell test when the card is captured or timed out.
-
You can try sticking Retry(); in instead of repeating the spellcard. That will cause the script to restart and clear any replay data. If you want anything more complicated, Azure had a system that worked for replays that can skip menus and stuff. It involved Retry() and common data, but I can't quite remember off the top of my head.
-
You can try sticking Retry(); in instead of repeating the spellcard. That will cause the script to restart and clear any replay data. If you want anything more complicated, Azure had a system that worked for replays that can skip menus and stuff. It involved Retry() and common data, but I can't quite remember off the top of my head.
Yeah I had thought of using Retry, but if that resets the entire script, then it would also reset the music from the beginning too, no? It's the resetting of the music that I wanted to avoid, honestly. I loved that the music would continue after each attempt in IN and TD.
-
It's the resetting of the music that I wanted to avoid, honestly. I loved that the music would continue after each attempt in IN and TD.
Unfortunately that cannot be avoided, as such are the limitations of the 0.12m engine. Maybe if Ph3 becomes stable (hopefully soon), you can set looping areas in the song and simply fade the music to lower volume and increase again while playing.
-
Man, I'm such a spammer >.>, but, this set of CreateShotA keep messing up,
PlaySE( BulletOrbShot01 );
CreateShotA( 1, GetX, GetY, 10 );
SetShotDataA( 1, 0, 3, 0, 0, 3.5, 4, 165 );
SetShotDataA( 1, 35, 3, 90, 0, 2.9, 3.1, 165 );
ascent( i in 1..60 ){
CreateShotA( 2, 0, 0, 30 );
SetShotDataA( 2, 0, 1, 0, 0, 1.1, 1.2, 17 );
SetShotDataA( 2, 30, 3, GetAngleToPlayer+i*10-20, 0, 3, 2.8, 17 );
AddShot( i*2, 1, 2, 0 );
SetAction( ACT_SHOT_A, 30 );
}
FireShot( 1 );
}
}
It won't display the boss sprite along with firing bullets -.-. Did I screw up somewhere?
EDIT: Fixed the Bullet problem, now how to fix the boss sprite problem? Also, new problem, only displays this shot not the other shots
-
We cannot guess what is wrong with your boss sprite since you are showing us createshoteA code and not a pastebin link with your entire script. Please post a pastebin link to your full script.
-
We cannot guess what is wrong with your boss sprite since you are showing us createshoteA code and not a pastebin link with your entire script. Please post a pastebin link to your full script.
Oops. Well I kinda solved the problem already. Sorry. Can you delete the post?
-
Hey, I'm new here, and I've recently gotten into Danmakufu. Still sort of a beginner, but I was wondering how you would do this:
-> 3 concentric circles, their center is the center of the game screen (NOT drawn, just so you know)
->bullets spawned from the middle, doesn't really matter atm
->when bullets collide with a point on a circle, they teleport to another point, and have the delay cloud thing where they come out (I know you can use Obj_SetPosition to reposition the bullet, but I can't figure out the delay cloud. Do I have to make an object effect?)
->the teleport order thing sorta goes like this:
(<-5 <-4(<-9 <-8(<-1 )<-3 <-2)<-7 <-6) ->10
with each number connecting to the next number in the sequence. And entering on the outside of the outermost circle would teleport it to the opposite side of the circle and have it move out.
if you could help with this much, I'd be very very VERY grateful, and I already think this is a lot to ask for. I'll try to figure out how to get the "circles"(although they aren't drawn and visible) to rotate so the teleporting isn't always to the complete opposite side.
-
http://pastebin.com/KPcC0m10 (http://pastebin.com/KPcC0m10)
Do I need to do a function of something? And in the script, do I need to include it as a function?
-
Hey, I'm new here, and I've recently gotten into Danmakufu. Still sort of a beginner, but I was wondering how you would do this:
-> 3 concentric circles, their center is the center of the game screen (NOT drawn, just so you know)
->bullets spawned from the middle, doesn't really matter atm
->when bullets collide with a point on a circle, they teleport to another point, and have the delay cloud thing where they come out (I know you can use Obj_SetPosition to reposition the bullet, but I can't figure out the delay cloud. Do I have to make an object effect?)
Not much of an expert, but if you want to shoot bullets from the middle, try doing it like this:
CreateShot01( GetCenterX, GetCenterY, speed, angle + ( OPTIONAL ) ascent, graphic, delay );
If your MainLoop style scripting, make 5 or less separate frames like this :
frame1++;
frame2++;
frame3++;
frame4++;
frame5++;
Include one of them with an infinite loop or just make the frame equal to a very high number for it too continue to 0
if( frame1 == 1300 ) { frame1 = 20 }
If your tasking, maybe try Objs or something, because I am not skilled with tasking.
( I will not know if this works though, ) If you want to make a delay cloud, use an image of a cloud, and set it as Obj_Effect. Same as using Yuyuko's Fan or Marisa's MasterSpark.
I really don't know what is a concentric circle, sorry >.>
Sorry I couldn't be much help, I am not a tasking person <.<
-
I can't be much help either, but for the delay cloud I'd say use ObjShot_SetDelay(id, frames).
-
ReiRei, it's quite alright. I know that it's already a lot to ask for. Concentric circles are basically circles that share the same center point. And umm yeah... I use tasks xD
It's not really the bullets that are the problem(well, technically, it IS...). It doesn't really matter how they're shot right now, all I want is 3 concentric circles that teleport the bullets to other points.
Here's what I have right now(hypothetical, I don't really know how to put it into code :\):
->The 3 circles have radii of 40 px, 90 px, and 180 px
->Bullets teleport (positions change) in a certain order(sequence posted in previous post)
->The inner and outer circles will be "rotating" clockwise, while the middle one(90 px) goes counterclockwise(which creates the effect of a more unpredictable maze of danmaku)
->the rotating will be managed frame by frame in the mainloop with a global variable?
for now, if a set of 2 circles can be made(bullets teleport from point a on Circle A to point b on Circle B, then from point a on Circle B to point b on Circle A), I can probably try to build off of it and make a third circle
@Trickysticks: Wouldn't ObjShot_SetDelay set the delay for when the bullet is created?
...unless I delete the old bullet and shoot a new object bullet in the new position? O.o
-
Since I am lazy explaining ObjShot_SetDelay, I'll let the wiki help you,
ObjShot_SetDelay
2 Parameters
1) object ID
2) delay frames
Set how many frames of delay will be applied to the bullet. Remember that the delay of a bullet will make a "cloud" similar to the bullet's color wherever it's going to spawn. For a laser, a thinner laser will be made where the laser is going to spawn. No collision detection is preformed during the delay process, for neither bullet clouds or laser guides.
You set how many frames of delay and the delay of the bullet will make a cloud.
-
sorry, I had bad wording in my post... ^^" What I meant to say was that using ObjShot_SetDelay would create the cloud effect, but only when the object bullet it spawned. Unless I deleted the bullet when it teleports and spawn a new bullet in the destination, I can't use ObjShot_SetDelay for this.
-
I have never tasked in my life since I cannot get the concept, but, try this:
NOTE: I really don't know if teleporting is possible on the old engine, but probably the new ph3 engine since they are making additions and drastic changes to most functions. I've tried scripting, but there is no clear English manual, so you probably want to stick to 0.12m first. Unless you get all the concepts >.>.
~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Vanish the Bullet and make it reappear at the destination
2. Make a small delay for the bullet
3. Redo
Sorry if it doesn't work out well. I never tasked but I have ideas of Obj Functions so. Maybe you can try it. You might wanna ask Helepolis or Drake for that matter though. Sorry ^^;
-
sorry, I had bad wording in my post... ^^" What I meant to say was that using ObjShot_SetDelay would create the cloud effect, but only when the object bullet it spawned. Unless I deleted the bullet when it teleports and spawn a new bullet in the destination, I can't use ObjShot_SetDelay for this.
Why not do exactly that? That was actually what I was going to suggest. It may not be the same bullet, but it will look like it is as long as the bullet graphic is the same. Otherwise, there is no way to get the delay cloud. Unless of course you made your own, but that seems unnecessarily annoying.
-
http://pastebin.com/KPcC0m10 (http://pastebin.com/KPcC0m10)
Do I need to do a function of something? And in the script, do I need to include it as a function?
No, and yes. You just use #include_function "filename" wherever you want those variables initialized. In most cases, it's fine at the very beginning of script_enemy_main. All that script does is allocate numbers to be used as shot IDs to more descriptive variables. It doesn't actually change anything in the script, just makes it easier to name bullet types.
->The 3 circles have radii of 40 px, 90 px, and 180 px
->Bullets teleport (positions change) in a certain order(sequence posted in previous post)
->The inner and outer circles will be "rotating" clockwise, while the middle one(90 px) goes counterclockwise(which creates the effect of a more unpredictable maze of danmaku)
->the rotating will be managed frame by frame in the mainloop with a global variable?
Haha, I find it pretty funny how you guys are like "what? Making a new bullet?!?!" when that's exactly what you would want to do. In any case, I'm still not exactly sure how you're going about this. Do all the points on each "wall" teleport the bullet on the opposite side of the next spot (plus rotation)? That sounds right so I'm going to assume that's the plan, but eh.
First thing is to make the rotation variables. All that's needed is a simple circle1=0; circle2=0; circle3=0;. You can then either directly use the MainLoop to change them or you can make an infinitely looping task that goes circle1++;circle--;circle3++; or however fast you want them to turn. Since it's a circle that's turning, you don't have to define anything other than those angle offsets.
Next is the bullet behaviour. You can make it really easy if you realize you only need to keep track of the time, instead of checking collision and such. You're going to want another task to fire and handle each bullet, and all you need is an angle parameter for now. Inside the task, make an angle=a; variable or something to keep track of the current angle because it'll be altered later. The task will fire a simple CreateShotA with whatever angle you want. You set it up just like any other shot, but you add SetShotKillTime(id, frames); before you fire it. That will just tell the bullet to delete itself after that time (or more relevantly, at that radius). After the FireShot call, loop a yield for the same amount of frames as the kill time. Then, you just write down another CreateShotA in the exact same fashion, except the difference is that the firing angle is now, according to your layout, angle+circle2. The shot location is also now middlex+cos(angle+180+circle2)*90, middley+sin(angle+180+circle2)*90. You similarly repeat this process until you've hit all the walls, every time you need to change the firing angle to angle=angle+circle#; and the "shot location" angle to angle+180+circle#. Also going to mention that the "entry" circle isn't important, it seems to be just the "exit" circle that you use.
Sorry if that was a bit complicated, but hopefully you get the idea.
-
Well, now, thanks for telling me I don't need to do a function thing Drake. Just wanna make sure I ain't missing anything before I release it. And, that is complicated. One such as I cannot get the concept, but hopefully he'll get it.
-
I'm making a Mamizou script, and for her spells, I'm spamming (destructible) familiars across the screen. Here, I came across a few problems...
1) After a while, the familiars just altogether stop spawning. I'm guessing this is because the game engine is being overburdened by too many familiars, since apparently the familiars don't go away when they leave the screen. This is a problem I've been dealing with for a while, but how can I get a familiar to self-terminate without causing weird crap to happen or causing that little explosion sound that familiars typically make when they're destroyed? I've experimented with a few methods, but it often results in really weird things, such as all on-screen familiars disappearing, or the boss itself disappearing.
2) As I mentioned, the familiars can be destroyed by shooting. However, each time I shot a familiar down, all other familiars on-screen turned invisible for a split second. How can I fix this?
-
1) After a while, the familiars just altogether stop spawning. I'm guessing this is because the game engine is being overburdened by too many familiars, since apparently the familiars don't go away when they leave the screen. This is a problem I've been dealing with for a while, but how can I get a familiar to self-terminate without causing weird crap to happen or causing that little explosion sound that familiars typically make when they're destroyed? I've experimented with a few methods, but it often results in really weird things, such as all on-screen familiars disappearing, or the boss itself disappearing.
Judging by the familiars using the generic enemy explosion sound, they're just enemies being spawned. VanishEnemy deletes the enemy without any trace, so by setting boundaries you should be able to limit the active enemies. In any case, that's bound to be extremely processing-heavy, and I would suggest investing in a different method if possible.
2) As I mentioned, the familiars can be destroyed by shooting. However, each time I shot a familiar down, all other familiars on-screen turned invisible for a split second. How can I fix this?
This is an issue with your drawing code, possibly due to using DeleteGraphic and then an immediate LoadGraphic. In any case, they're being connected somehow and without knowing how the drawing works it's hard to pinpoint the problem.
EDIT:
>dude with danmakufu problem
>no idea what caused problem
>guess solution at random
>fix everything like a boss
-
Judging by the familiars using the generic enemy explosion sound, they're just enemies being spawned. VanishEnemy deletes the enemy without any trace, so by setting boundaries you should be able to limit the active enemies. In any case, that's bound to be extremely processing-heavy, and I would suggest investing in a different method if possible.
This is an issue with your drawing code, possibly due to using DeleteGraphic and then an immediate LoadGraphic. In any case, they're being connected somehow and without knowing how the drawing works it's hard to pinpoint the problem.
Thanks! I tried messing around with VanishEnemy again (which caused said weird stuff for me in the past, probably due to improper use), and I finally managed to get it to work. As for the drawing code, I just removed "DeleteGraphic" from the familiars' scripts and it's fine now.
-
Haha, I find it pretty funny how you guys are like "what? Making a new bullet?!?!" when that's exactly what you would want to do. In any case, I'm still not exactly sure how you're going about this. Do all the points on each "wall" teleport the bullet on the opposite side of the next spot (plus rotation)? That sounds right so I'm going to assume that's the plan, but eh.
[insert big explanation here]
Sorry if that was a bit complicated, but hopefully you get the idea.
Thankyouthankyouthankyouthankyouthankyou! What you said worked perfectly, although I used Object bullets instead (for some reason SetShotDataA is more confusing to me for this than Obj bullets).
task TeleportDanmaku(x,y,v,dir,graphic,delay,tcount){
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,v);
Obj_SetAngle(obj,dir);
ObjShot_SetGraphic(obj,graphic);
ObjShot_SetDelay(obj,delay);
if(tcount==5){
wait(40/v);
angle=Obj_GetAngle(obj)+180;
dir=atan2(90*sin(angle-rotate),90*cos(angle-rotate))+180;
Obj_Delete(obj);
TeleportDanmaku(GetCenterX+90*cos(angle-rotate),GetCenterY+90*sin(angle-rotate),v,dir,graphic,delay,tcount-1);}
if(tcount==4){
wait(50/v);
angle=Obj_GetAngle(obj)+180;
dir=atan2(90*sin(angle-rotate),90*cos(angle-rotate));
Obj_Delete(obj);
TeleportDanmaku(GetCenterX+90*cos(angle-rotate),GetCenterY+90*sin(angle-rotate),v,dir,graphic,delay,tcount-1);}
if(tcount==3){
wait(90/v);
angle=Obj_GetAngle(obj)+180;
dir=atan2(180*sin(angle+rotate),180*cos(angle+rotate))+180;
Obj_Delete(obj);
TeleportDanmaku(GetCenterX+180*cos(angle+rotate),GetCenterY+180*sin(angle+rotate),v,dir,graphic,delay,tcount-1);}
if(tcount==2){
wait(90/v);
angle=Obj_GetAngle(obj)+180;
dir=atan2(40*sin(angle+rotate),40*cos(angle+rotate));
Obj_Delete(obj);
TeleportDanmaku(GetCenterX+40*cos(angle+rotate),GetCenterY+40*sin(angle+rotate),v,dir,graphic,delay,tcount-1);}
if(tcount==1){
wait(50/v);
angle=Obj_GetAngle(obj)+180;
dir=atan2(180*sin(angle+rotate),180*cos(angle+rotate));
Obj_Delete(obj);
TeleportDanmaku(GetCenterX+180*cos(angle+rotate),GetCenterY+180*sin(angle+rotate),v,dir,graphic,delay,tcount-1);}
}
That's what I made from this, and basically you enter all the basic values required for an object bullet as well as a tcount, which specifies how many teleportations are left for that bullet. When it is shot, depending on the tcount, it will wait a different time and then shoot another bullet at a certain position relative to the variable "rotate", with a tcount 1 less than it was this time. Doing it this way, I can create shots at other positions with different starting tcounts to follow the same teleport sequence.
...Did I overcomplicate the code? I feel like there's a ton of unnecessary stuff in there...
Oh and another question: for some reason, when I put that task almost anywhere else in the script(namely, lower than it's current place) I made, an error occurs O.o Do you know why this is? Also, why are all the tasks and stuff at the bottom one huge folder or whatever it is when I open it up in Notepad++? Does this have something to do with why it isn't working?
http://pastebin.com/b4iFu9Zn
EDIT: Oops! Forgot to say that you can comment out the drawing stuff (namely the include function the functions related to it). And I've put the TeleportDanmaku at the bottom to show you what I mean(it's supposed to be where the comment that says it works is).
EDIT2: Weird... now it works... ._." Nevermind about the problem then! But still, what's with the folder thingies in my script? All the tasks seem to be a part of 1 big folder or something... o-o
-
You can... simplify that ifstatement. Lemme type it out.
task TeleportDanmaku(x,y,v,dir,graphic,delay,tcount){
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj,x,y); Obj_SetSpeed(obj,v); Obj_SetAngle(obj,dir);
ObjShot_SetGraphic(obj,graphic); ObjShot_SetDelay(obj,delay);
ascent(i in 0..5) { if(tcount==1+i){
wait([50,90,90,50,40][i]/v);
angle=Obj_GetAngle(obj)+180;
dir=atan2([180,40,180,90,90][i]*sin(angle-rotate),[180,40,180,90,90][i]*cos(angle-rotate))+180;
Obj_Delete(obj);
TeleportDanmaku(GetCenterX+[180,40,180,90,90][i]*cos(angle-rotate),GetCenterY+[180,40,180,90,90][i]*sin(angle-rotate),v,dir,graphic,delay,tcount-1);
} }
}
-
You can... simplify that ifstatement. Lemme type it out.
task TeleportDanmaku(x,y,v,dir,graphic,delay,tcount){
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj,x,y); Obj_SetSpeed(obj,v); Obj_SetAngle(obj,dir);
ObjShot_SetGraphic(obj,graphic); ObjShot_SetDelay(obj,delay);
ascent(i in 0..5) { if(tcount==1+i){
wait([50,90,90,50,40][i]/v);
angle=Obj_GetAngle(obj)+180;
dir=atan2([180,40,180,90,90][i]*sin(angle-rotate),[180,40,180,90,90][i]*cos(angle-rotate))+180;
Obj_Delete(obj);
TeleportDanmaku(GetCenterX+[180,40,180,90,90][i]*cos(angle-rotate),GetCenterY+[180,40,180,90,90][i]*sin(angle-rotate),v,dir,graphic,delay,tcount-1);
} }
}
Hmm... Does this factor in the fact that sometimes rotate is added and sometimes subtracted? And that only sometimes 180 is added to dir to make it aimed at the center?
EDIT: Just tested it in the script, it doesn't factor those in. (although I should've noticed, since I didn't see anything with +rotate or without +180 xD)
EDIT2: I think I'll just use that and alter it a bit to suit my needs. I need to learn arrays better... >.< also, array values can be called that way? O.o It looks so simple and obvious, but I never knew you could just type up an array and do that...
-
How do I create object laser that reflects from walls (I want each shot reflect only once, not infinitely). I found a object laser help page on touhou wiki but that created still lasers, I want a moving one
-
CreateLaser01 moves. Sp does CreateLaserC if you want curvy ones. For reflecting, I am having the same problem.
-
CreateLaser01 or any of the CreateLaser series won't allow you to bounce the laser. You're going to need an object laser for that. The reason it doesn't move is that Obj_SetSpeed doesn't work on object lasers for some reason. You have to manually move the laser by constantly using Obj_SetPosition to move the laser.
-
Okay... hmm... let's see...
EDIT: If you want a better bouncing effect, use the sinuate laser code at the bottom rather than the regular laser code up here.
-Use ObjLaser functions
-Can't use Obj_SetSpeed,so must use Obj_SetPosition continuously
-Need to bounce laser off of walls once
Okay, let's do this:
function ObjLaser_Create(x, y, angle, length, width, graphic, delay){
let obj = Obj_Create(OBJ_LASER);
Obj_SetPosition(obj, x, y);
//Obj_SetSpeed is skipped because it is ignored by laser objects.
Obj_SetAngle(obj, angle);
ObjLaser_SetLength(obj, length);
ObjLaser_SetWidth(obj, width);
ObjShot_SetGraphic(obj, graphic);
ObjShot_SetDelay(obj, delay);
return obj;
}
Use the above for making an object laser and put the obj id value into a variable, code snippet is thanks to Blargel :3
Don't forget to use ObjLaser_SetSource to turn off the base source thingy.
task ObjLaser_SetSpeed(id, v){
while(!Obj_BeDeleted(id)){
Obj_SetPosition(id,Obj_GetX(id)+v*cos(Obj_GetAngle(id)),Obj_GetY(id)+v*sin(Obj_GetAngle(id)));
yield;}
}
Use the obj id variable from before to use this above snippet for speed and movement.
task Obj_Bounce(id){
while(!Obj_BeDeleted(id)){
if(Obj_GetX(id)<=GetClipMinX||Obj_GetX(id)>=GetClipMaxX){Obj_SetAngle(id,180-Obj_GetAngle(id)); return;}
if(Obj_GetY(id)<=GetClipMinY||Obj_GetY(id)>=GetClipMaxY){Obj_SetAngle(id,360-Obj_GetAngle(id)); return;}
yield;}
}
This would bounce the laser(er, any object, actually) once. If you want it to bounce an infinite number of times, remove the "return;" at the end of each if statement.
I feel like a curvy laser would have a better effect of bouncing, since it leaves a tail behind it. With this one, the laser suddenly snaps around when it "bounces" and changes direction.
Also, can anyone explain to ME how the angles are found using 180 for x boundaries and 360 for y boundaries? I don't get it... ._." Bouncing snippet of code was from Awe Striker.
EDIT: yeah, I just tested, a sinuate laser looks MUCH better than this. Use the sinuate laser create code by Blargel:
function ObjSinuateLaser_Create(x, y, speed, angle, length, width, graphic, delay){
let obj = Obj_Create(OBJ_SINUATE_LASER);
Obj_SetPosition(obj, x, y);
Obj_SetSpeed(obj, speed);
Obj_SetAngle(obj, angle);
ObjSinuateLaser_SetLength(obj, length);
ObjSinuateLaser_SetWidth(obj, width);
ObjShot_SetGraphic(obj, graphic);
ObjShot_SetDelay(obj, delay);
return obj;
}
Ignore my setspeed code, and use the bounce code from before. Just remember, sinuate lasers' length is based on its speed and the length value you give it, so if you want a short one moving slow, give it a small length value. If you want a long one moving slow, a large length value. Fast and long laser would be lower length value. Fast and short laser would be a very low length value.
-
How do you do CreateShotFromScript? Man, that is a dumbass question >.>
-
How do you do CreateShotFromScript? Man, that is a dumbass question >.>
I think it's similar to how you would make a bomb for a player? you need to put in a "script_" thingy after your script_enemy_main or whatever, although I'm not sure what the script is called... script_shot maybe? anyway, get that right, and then leave a space after that and name the script(you use that name to call the script in CreateShotFromScript). I think the rest of the parameters are pretty self-explanatory, except maybe for the user-defined argument. The argument is basically something you include that you can call in the bullet script, and then use the value(s) from it to do special things?
-
[attach=1]
-
[attach=1]
OH. Wow... Thanks! It was really helpful!
-
How do you do CreateShotFromScript? Man, that is a dumbass question >.>
CreateShotFromScript("name", x, y, v, angle, delay, argument);
script_shot name {
@Initialize {
SetDefault(RED01); //SetBombResist; (uncomment if you want to have it bomb resistant)
}
@MainLoop {
SetCollisionBDefault;
}
@DrawLoop {
DrawGraphicDefault;
}
@Finalize {
}
}
-
CreateShotFromScript("name", x, y, v, angle, delay, argument);
script_shot name {
@Initialize {
SetDefault(RED01); //SetBombResist; (uncomment if you want to have it bomb resistant)
}
@MainLoop {
SetCollisionBDefault;
}
@DrawLoop {
DrawGraphicDefault;
}
@Finalize {
}
}
Now I can use the familiars for Mokou's spell, thanks
Edit: A more question that may get me to being an official dumbass but how do you slow down time or freeze it? Like Sakuya's spells and when Youmu slows down time greatly.
-
A more question that may get me to being an official dumbass but how do you slow down time or freeze it? Like Sakuya's spells and when Youmu slows down time greatly.
Not too clued up here but there are "slow (http://dmf.shrinemaiden.org/wiki/index.php?title=Enemy_Script_Functions#slow)" and "time stop (http://dmf.shrinemaiden.org/wiki/index.php?title=Enemy_Script_Functions#TimeStop)" functions in the wiki
-
Oh. Well that'd be helpful. Just wanna know how to for a game I'm making ( Well, it won't be that great >.> ). Thanks.
Since Pastebin is under maintence right now >.>, I'll edit this post after it is out of maintence with a link to it, Now, This set of codes says "PhoenixShot" and
http://pastebin.com/0Wnv9zXh
Please forgive me for the inconvience
-
Extra bracket after the spawn task, which terminates the file so that anything after it isn't read by the program.
-
Extra bracket after the spawn task, which terminates the file so that anything after it isn't read by the program.
Did that but it says that PhoenixShot is:
---------------------------
PhoenixShotは未定義の識別子です(913行目)
It says Phoenix shot is an undentified identifier
-
GetAngleToplayer
obj_Create
Obj_Angle
GetAngleToThePlayer (see later)
are all misspelled.
You might need an extra closing bracket after the wait function to separate script_enemy_main and script_enemy, but I'm not sure. In any case, script_enemy matches all of its brackets but there is no closing bracket for script_enemy_main. Either put it before script_enemy or at the end of everything (again, unsure which is needed).
Deleting the FamiliarA graphic in the familiar's @Finalize will make all the other familiars disappear until it's loaded again, so I suggest not putting it there.
GetAngleToThePlayer * cos + 10, GetAngleToPlayer * cos + 20, GetAngleToPlayer * cos + 30 is also completely wrong. I think you want
cos(GetAngleToPlayer) * 10, cos(GetAngleToPlayer) * 20, cos(GetAngleToPlayer) * 30
-
Well now, I made such mistakes. Corrected it all but it says PhoenixShot is undentified. DAMN YOU TASKS! I just need to know that problem and maybe I can fix it.
-
Could you post the current script then? Also, more problems.
- I noticed that you're declaring MSpeed, Angle and Graphic as arrays, then passing them as parameters to SCARLET_SHOT_MOKOU which tries to use them as setters. That won't work. You do the same thing in FamShot and I'm not sure what you're trying to do there.
- MWay is probably supposed to be 5, not 56. I can't imagine you wanting 56 loops with wait(240) in each of them.
- You never defined the wait function for the familiar script.
- /-- Declaring the Variables ------------ isn't a comment, you're missing a slash.
-
Well, I blame myself. This is my Second time tasking so I've decided to make a new script. It's basically a remake of the exact same thing but with the mistakes corrected.
Well since my problem has been fixed with tasking, what about this for the event for Marisa
http://pastebin.com/SPyuUAw7
It cannot interpret MARGIN XL and stuff. Do I need to do a function or something? Just asking.
AND
http://pastebin.com/9Xm1Anqr
It says:
Routine and more of the same name is declared in the same scope (line 978)
↓
@ DrawLoop {
SetGraphicScale (1, 1);
SetTexture (MariFamA);
~ ~ ~
---------------------------
OK
---------------------------
I highly suggest you start using the EDIT button. This is the 3rd time in the same page I have to fuse your posts. There is absolutely no reason to double post. --Hele
My response: Man I've been screwing up
-
What in this code affects to how often bullets are spawned from laser?
ascent(i in 0..30){
ascent(j in 0..20){
CreateShotA(1, 0, 0, 10);
SetShotDataA(1, 0, 0, 90, 0, 0.1, 3, YELLOW11);
AddShot(i*3, 0, 1, j*15);
}
}
And how do I make the bullets spawn a specific angle based on LaserC's angle?
-
Well now, thought I've never seen this topic in the first page. I wonder, can you ascent in tasking?
-
@Trace: The i*3 in AddShot affects the frequency. More accurately, the 3. The 90 in SetShotDataA should be how many degrees the bullet is fired at in relation to the laser.
@Project Mokou: Yes you can. Now take it to the Q/A Thread.
-
Thanks Mewkyuu. Though I have no more questions to ask before I begin tasking, Thanks.
-
Idk if this is a silly question or not... but how do you enable or encorporate power items and power levels into characters?
-
Idk if this is a silly question or not... but how do you enable or encorporate power items and power levels into characters?
You are going to probably work with CommonData for that. You create CommonData in your player script and use that to track/update it. With that, you can create power items or w/e which drops from enemies and link them to the CommonData. After that is a matter of creating the correct statements for "level up" or "shot power".
SetCommonData("playerPower",0);
/////
if(GetCommonData("playerPower") > 8) {
// do stuff
}
Power items are probably made as EffectObjects, and you create statements to make the player collect these, increasing the playerPower etc. You can even save common data to make sure the data isn't lost when the player quits the game. (Useful for unlocks and stuff). Probably various methods of doing, this is the one I am familiar with.
-
Well since my problem has been fixed with tasking, what about this for the event for Marisa
http://pastebin.com/SPyuUAw7
It cannot interpret MARGIN XL and stuff. Do I need to do a function or something? Just asking.
You cannot put spaces in variable names. You weren't doing this after the first block; I'm not sure why you didn't catch this.
-
Idk if this is a silly question or not... but how do you enable or encorporate power items and power levels into characters?
I did it through common data too. Basically what you need to do is: Organize a queue for dropped items processing, make a task that creates an item and processes it (falling, getting collected), put some code in enemies scripts so they will drop items on death, store power level value in common data so player scripts can use it. I have this system working in my game, so PM me if you're interested.
-
I'm having an issue with object effects causing immense amounts of lag.
This task (subtask of a player shot object) is called every frame to create an effect object trail behind a player shot object. In-game, I can shoot for about 20 seconds before the FPS begins to start dropping, and it doesn't ever get faster afterward. The effect appears to delete, but the framerate shows otherwise.
The "return;" method from a topic on these forums didn't seem to help, so I tried isolating the counter into the if statements. No better. Commenting out the Trail(); task from calling will cause the lag to never show up, so I'm pretty sure it's just this task.
Tried searching around for a solution, but I haven't yet found anything that works.
http://pastebin.com/RNc8v7pW
I'd really love to have some nice effect trails, but I've tried my limited knowledge to it's limits and I still can't figure it out. Hopefully I haven't herp-a-derped someplace and I'm just overlooking it.
Pastebin for the whole player script. (Copy-pastad-code-from-other-scripts-inside alert)
http://pastebin.com/V4qCXy99 (http://pastebin.com/V4qCXy99)
-
I'm trying to make a curving LaserC spawn bullets from it so that the bullets will be spawned +90 and -90 degree from the lasers current angle (if laser's angle is 90 bullets are fired to 0 and 180). So how do I make danmakufu get the laser's angle when a new bullet is spawned from it?
here is the task. It will propably help you:
task laserC1 {
let x = 0;
let dir = 45;
loop {
while(x<3) {
CreateLaserC(1, GetCenterX, GetCenterY, 10, 50, RED01, 0);
SetLaserDataC(1, 0, 5, dir, 5, 0, 0);
SetLaserDataC(1, 15, 5, NULL, 4, 0, 0);
SetLaserDataC(1, 30, 5, NULL, 3, 0, 0);
SetLaserDataC(1, 45, 5, NULL, 2, 0, 0);
SetLaserDataC(1, 60, 5, NULL, 1, 0, 0);
SetLaserDataC(1, 75, 5, NULL, 0.5, 0, 0);
ascent(i in 0..100){
ascent(j in 0..1){
CreateShotA(2, 0, 0, 10);
SetShotDataA(2, 0, 0, dir+90, 0, 0, 0, RED04);
SetShotDataA(2, 5, 0, NULL, 0, 0.025, 1.5, RED04);
AddShot(i*3, 1, 2, j*15);
}
}
ascent(i in 0..100){
ascent(j in 0..1){
CreateShotA(2, 0, 0, 10);
SetShotDataA(2, 0, 0, dir-90, 0, 0, 0, RED04);
SetShotDataA(2, 5, 0, NULL, 0, 0.05, 1.5, RED04);
AddShot(i*3, 1, 2, j*15);
}
}
FireShot(1);
dir+=360/3;
x++;
}
x = 0;
dir = 45;
wait(300);
yield;
}
}
Oh yeah, and when I spawn bullets from laser how do I make the spawning rate a little smaller, the bullet trails it spawns are too thick and hard to get through (I copied the "ascent" thing so I don't know)
-
I'm having an issue with object effects causing immense amounts of lag.
This task (subtask of a player shot object) is called every frame to create an effect object trail behind a player shot object. In-game, I can shoot for about 20 seconds before the FPS begins to start dropping, and it doesn't ever get faster afterward. The effect appears to delete, but the framerate shows otherwise.
The "return;" method from a topic on these forums didn't seem to help, so I tried isolating the counter into the if statements. No better. Commenting out the Trail(); task from calling will cause the lag to never show up, so I'm pretty sure it's just this task.
Tried searching around for a solution, but I haven't yet found anything that works.
http://pastebin.com/RNc8v7pW
I'd really love to have some nice effect trails, but I've tried my limited knowledge to it's limits and I still can't figure it out. Hopefully I haven't herp-a-derped someplace and I'm just overlooking it.
Pastebin for the whole player script. (Copy-pastad-code-from-other-scripts-inside alert)
http://pastebin.com/V4qCXy99 (http://pastebin.com/V4qCXy99)
Hmm.. how can fcount go beyond 9 when loop ends on 5? Maybe it's better replace loop with while(!Obj_BeDeleted(obj_trail)) then you wont need return too (why do you need it in task?)
-
Hmm... Why is script_enemy an undefined? Tell me other problems too and I cannot use wait in the fam script
Defined the function of wait but cannot use wait.
http://pastebin.com/qUzakxQr
-
You have to close the bracket for task Marishot
-
I don't know how, but I just quitted it because if Marisa shoots her dynamic random hard nonspells from IN combined with that = impossible. Thanks anyway Mewkyuu.
-
I'm having an issue with object effects causing immense amounts of lag [...]
Fixed. I put in both the method you were probably looking for, and one that is surely less computationally expensive and is just shorter in text.
http://pastebin.com/GEXYfxRH
-
Hmm.. how can fcount go beyond 9 when loop ends on 5? Maybe it's better replace loop with while(!Obj_BeDeleted(obj_trail)) then you wont need return too (why do you need it in task?)
That loop (and return;) were vain attempts at solving this. It was originally an !Obj_BeDeleted, but that failed as well so I just started trying random things. They all looked the same, and produced the same results so I didn't ever change it back.
Fixed. I put in both the method you were probably looking for, and one that is surely less computationally expensive and is just shorter in text.
http://pastebin.com/GEXYfxRH
Thanks, Drake! Unfortunately, both solutions didn't work. The game still slows after a few seconds of firing. Tried adding return; to ensure the task was being finished (that's what it does, right?), but to no avail.
I can clearly see the object deleting (the "trail" doesn't sit on the last frame), but somehow it's not. Or something.
EDIT: Problem solved! It wasn't the task, but the while loop calling it. Turns out there was a loop in there, which upon removal also removed the lag.
-
return; isn't needed for a situation like this because once the object is deleted, the while loop ends and the task finishes. You're going to want to use return; for tasks that might not have a very well-defined end or multiple different ends.
Looking at the whole script, I think the problem might be your weird obj!bedeleted{loop{}} setup. The while(!Obj_BeDeleted) loop starts, sets the three variables, then starts up an indefinite loop. This loop won't ever finish, so even when the main shot object is deleted, the inner loop is still going and it won't ever get to read the !Obj_BeDeleted condition to break and finish off the task. If this is indeed the problem, you could fix it by first of all removing the first three variable sets because they won't ever change anyways, and then simply getting rid of the inner loop (and the extra yield). The while loop should take care of things.
If you want to test, you can keep track of a variable that increases when you create a trail object and decreases when it deletes, and then display it in the debug window. The debug window also keeps a number of total objects, so that might be useful too.
way to go man make me look around and type the correct solution for nothing >:C
-
ah the wonders of irc
Remember that while is already a loop that breaks when the condition is no longer true.
-
One Question. How do you use the CtC spell lines. I want to use a specific one. Do I have to use Drawloop or something ( ZUNish spell lines of course. )
-
way to go man make me look around and type the correct solution for nothing >:C
Well, it's the thought that counts. Thanks for the help!
-
INCOMING PROBLEM!!!)this must be fit in here, oh well
Here it goes:
http://i314.photobucket.com/albums/ll403/jed9876/Touhou/tojiko_trans.png
So basically, I have a coloring problem. Looks like the 0,0,0 RGB value is transparent on danmakufu. Not just Tojiko, it also includes the shoes of other characters as well. :V
How can I fix this?(using GIMP to recolor it is a mess, it catches the other colors.)
Thanks in advance(derp)
-
INCOMING PROBLEM!!!)this must be fit in here, oh well
Here it goes:
http://i314.photobucket.com/albums/ll403/jed9876/Touhou/tojiko_trans.png
So basically, I have a coloring problem. Looks like the 0,0,0 RGB value is transparent on danmakufu. Not just Tojiko, it also includes the shoes of other characters as well. :V
How can I fix this?(using GIMP to recolor it is a mess, it catches the other colors.)
Thanks in advance(derp)
Try finding sprites that has alpha channel on them. If that doesn't work, use gimp to select everything with 0, 0, 0 RGB color (nothing else) and then use fill tool to fill all that area with 1, 1, 1 RGB (there should be selection allows you to fill entire selection.
-
When i making a sprite containing pitch black (0,0,0) color, i just go to Image->Adjustments->levels in photoshop and change black level (the lower left on the gradient bar) from 0 to 1. This makes no visual affect to the image, but there's no pitch black anymore. And yes, i do alpha as alpha.
-
So, I have an Image for the fancy ZUN lines which came in a pack. Now, My question is, how the hell do I use them? I wanna use them for my game, "RoSD" ( Just some initials )
-
So, I have an Image for the fancy ZUN lines which came in a pack. Now, My question is, how the hell do I use them? I wanna use them for my game, "RoSD" ( Just some initials )
Just apply them as a textures to effect object, and you're done.
-
But I want to know, will it delete the default ugly ones. Because, the default one looks ugly.
-
But I want to know, will it delete the default ugly ones. Because, the default one looks ugly.
You mean spellcard names? Just be sure you have SetText(""); and it wont appear.
-
You mean spellcard names? Just be sure you have SetText(""); and it wont appear.
I'm using cutin ( function from helepolis script ). Will it work while using the ZUN lines? I really never used Object Effect. >.> Sorry for my low knowledge on Effect Objects.
-
Okay. I know this is a stupid question. But, why is it that when we use ascent, and we want it to loop "x" amount of times, we do 0.."x"? wouldn't that make it loop x+1 times, in the sense that it does it for 0,1,2,3...x? or does it skip the last one or something?
-
It skips the last one.
ascent(i in x..y) { a = i; } would be the code in the brackets y-x times looped.
-
ah. thanks for clearing that up. Is the same for descent? as in:
descent(i in x..y) {a=i;} would have the code in brackets looped x-y times, with the last one skipped?
-
No, it just runs in reverse order. Say...
descent(i in 0..5) { a = i; }
a = 4; a = 3; ..... a = 0;
-
oh. wow. So either way, you put them as smallest to largest value ._."
My last question for probably awhile, since it'll really answer something I need. When you use a custom bullet script, how are the hitboxes of each bullet created? Because I see that the bubbles have the white part on the outside safe to be inside, and the amulets with their weird hitboxes, yet things like the large orbs are almost completely hitbox ._. How are the hitboxes determined?
-
Unable to read file. Error message:
1.dnh
here's the script:
http://pastebin.com/FttWFWB2
I tried uploading it as a text file, but it won't even read the file. What the hell am I doing wrong?
EDIT: Shit! Forgot to do a task declared and some other stuff. FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
-
I see you're missing a closing bracket near the end of phoenixshot. It's the ascent loop that's missing it I think.
-
I see you're missing a closing bracket near the end of phoenixshot. It's the ascent loop that's missing it I think.
FFFFFF! Forgot to do a movement task which I declared.
EDIT: Did it now but cannot read the dnh file.
--------------------------- I changed my real account name to a random account name
ScriptError「C:UsersJigglypuffDownloadsTouhou Danmakufu + Concealed The ConclusionTouhou Danmakufu + Concealed The ConclusionConcealed the ConclusionConcealed the ConclusionscriptYuuka's ScriptsRequiem of Scarlet DevilCtCBossBattlesMokouMokouN1.dnh」
---------------------------
1.dnh」
---------------------------
OK
---------------------------
-
My last question for probably awhile, since it'll really answer something I need. When you use a custom bullet script, how are the hitboxes of each bullet created? Because I see that the bubbles have the white part on the outside safe to be inside, and the amulets with their weird hitboxes, yet things like the large orbs are almost completely hitbox ._. How are the hitboxes determined?
I've asked the same question some time ago. Looks like bullet's hitbox is defined by nothing but just the rectangle size declared. Seems like hitbox radius is about a half of the smallest dimension of it. So if you wanna big bullet with a small hitbox - leave less space around it's actual sprite (or dont leave it at all wich will result in the smallest hitbox possible), and if you wanna bullet with a bigger hitbox - increase the rectangle, leaving more free space around the bullet. But not too much, cause it can result in hitbox bigger than bullet itself!
P.S.: This script (http://www.shrinemaiden.org/forum/index.php/topic,9281.msg762867.html#msg762867) was created to show how the bullet's sprite to rectangle relation affects it's hitbox. You can replace user shot data file with yours to test your bullet.
-
So while trying to make menu options from effect objects using a letter sheet, I've attempted to construct an effect object that will display particular letters from the sheet. Unfortunately, the effect object code for some reason causes danmakufu to crash, and I've been struggling to find out why. Here's the code: http://pastebin.com/s2PLEASm
I've been really racking my brain over this one, so I hope it's not something stupid. Either way, thanks in advance.
Nevermind, I found the real problem. I had forgotten that effect objects cannot be created on the first initialization frame else the program crashes for some reason.
-
Welcome to my world Ozzy. Welcome to my world.
-
So while trying to make menu options from effect objects using a letter sheet, I've attempted to construct an effect object that will display particular letters from the sheet. Unfortunately, the effect object code for some reason causes danmakufu to crash, and I've been struggling to find out why. Here's the code: http://pastebin.com/s2PLEASm
I've been really racking my brain over this one, so I hope it's not something stupid. Either way, thanks in advance.
Doing stuff like this for menus is really cumbersome. If you want to do it for dialogue it's much more worth it, but if all you're doing is menus I would just suggest using static graphics. Less processing, less work, less problems. It's a good exercise if you want to go through with this though, I suppose.
Does the code crash just from being there, or is it only crashing when you're calling it or implementing it?
-
Doing stuff like this for menus is really cumbersome. If you want to do it for dialogue it's much more worth it, but if all you're doing is menus I would just suggest using static graphics. Less processing, less work, less problems. It's a good exercise if you want to go through with this though, I suppose.
Does the code crash just from being there, or is it only crashing when you're calling it or implementing it?
Thanks for getting back to me, but I've found the real problem. I had simply forgotten that effect objects cannot be created on the first initialization frame or else the program crashes for some reason. I never needed to create effect objects on the first frame before, so it slipped my mind. I had edited my post, but you must have missed it. And yeah, I know that making menus like this is cumbersome, but I thought that it would be preferable to making tons of separate images. I had planned a spell practice menu, so that would end up forcing me to make many more images than I would have wanted. Anyway, the code and letter sheet are done, so I don't need to worry about it anymore :V
-
I've got some question. Are those variables declared in ascent/descent local for the cycle? I found myself using same i and j all over the place, no matter is it a main script or some task, and it looks like they dont conflict with each other ::)
-
Thanks for getting back to me, but I've found the real problem. I had simply forgotten that effect objects cannot be created on the first initialization frame or else the program crashes for some reason. I never needed to create effect objects on the first frame before, so it slipped my mind. I had edited my post, but you must have missed it. And yeah, I know that making menus like this is cumbersome, but I thought that it would be preferable to making tons of separate images. I had planned a spell practice menu, so that would end up forcing me to make many more images than I would have wanted. Anyway, the code and letter sheet are done, so I don't need to worry about it anymore :V
If it's not a problem, are you using this for "Kingdom of Mushrooms"? ( I would like a link too the font script too. Cause, I mess up alot on mine. Though it is personal. )
-
Now, what the heck did I do wrong at Finalize?
---------------------------
ScriptError「C:\Users\Jigglypuff\Downloads\Touhou Danmakufu + Concealed The Conclusion\Touhou Danmakufu + Concealed The Conclusion\Requiem of Scarlet Devil\Requiem of Scarlet Devil\script\RoSD\SanaeN1.dnh」
---------------------------
イベントを深い階層に記述することはできません(993行目)
↓
@Finalize {
DeleteGraphic( CL_BOSS_SANAE );
DeleteGraphic( CL_MAGIC_CIRCLE_IMG );
}
}
~~~
---------------------------
OK
---------------------------
-
I've got some question. Are those variables declared in ascent/descent local for the cycle? I found myself using same i and j all over the place, no matter is it a main script or some task, and it looks like they dont conflict with each other ::)
I've come to the same conclusion. I used to declare the i variable before all ascents until I forgot to do it once and it worked fine without it. So yeah, it looks like those variables never leave the ascent/descent.
-
It's like that for basically every programming language ever. Yes, they are locally defined variables.
イベントを深い階層に記述することはできません(993行目)
This sort of error can't be identified just with what you posted, all it's doing is pointing at @Finalize which doesn't give you any information. Error is like "Event cannot be described in deep hierarchy" which honestly I don't think I've seen before.
-
It's like that for basically every programming language ever. Yes, they are locally defined variables.
This sort of error can't be identified just with what you posted, all it's doing is pointing at @Finalize which doesn't give you any information. Error is like "Event cannot be described in deep hierarchy" which honestly I don't think I've seen before.
Fixed the problem, magiccircle has too many if statements
-
Okay, now let me keep track of all this nonsense and post them at one single comment:
Script (http://pastebin.com/GmYGerPj)
Here are the problems:
- wait function is undefined indentifier
- will it load
- torment
-
Okay, now let me keep track of all this nonsense and post them at one single comment:
Script (http://pastebin.com/GmYGerPj)
Here are the problems:
- wait function is undefined indentifier
- will it load
- torment
It's not recognizing the wait function because you have it defined outside script_enemy_main. In other words, you have too many end brackets for the number of start brackets. In fact, I count 4 more end brackets than start brackets. I suggest you go over your bracket placement again and make sure that they line up. Not sure about your other problems, but this may be the cause of them too.
-
It's not recognizing the wait function because you have it defined outside script_enemy_main. In other words, you have too many end brackets for the number of start brackets. In fact, I count 4 more end brackets than start brackets. I suggest you go over your bracket placement again and make sure that they line up. Not sure about your other problems, but this may be the cause of them too.
wait, wait, what? What do you mean outside of script_enemy_main?
-
script_enemy_main{
- includes and variable inits
- script events
- SanaeTask{}
- Moriyashot{
-- ascent{
--- ascent{
--- }
-- }
- }
- loop{
-- ascent{
-- }
- }
} // end of script_enemy_main
setmovepositions
} // -1 brackets
} // -2 brackets
wait{ loop{} }
} // -3 brackets
} // -4 brackets
-
Few questions:
1. How do I aim bullets to playfield center
2. If I create LaserA, LaserB or LaserC cetrain radius of the enemy:
CreateLaserA(1, GetEnemyX+25*cos(dir), GetEnemyY+25*sin(dir), 25);and then change angular velocity in SetLaserDataA, does the laser rotate around the point it was created or aroung the boss with the given radius (25 pixels in this case)
-
1. How do I aim bullets to playfield center
atan((240 - bullety) / (224 - bulletx)); or atan2(240 - bullety, 224 - bulletx);
2. If I create LaserA, LaserB or LaserC cetrain radius of the enemy:
CreateLaserA(1, GetEnemyX+25*cos(dir), GetEnemyY+25*sin(dir), 25);and then change angular velocity in SetLaserDataA, does the laser rotate around the point it was created or aroung the boss with the given radius (25 pixels in this case)
The laser fires from that point at the angle you specify but it turns at the angvel you specify, so probably "rotate around the point it was created"; but with careful angle planning you can get it to rotate around the boss.
-
script_enemy_main{
- includes and variable inits
- script events
- SanaeTask{}
- Moriyashot{
-- ascent{
--- ascent{
--- }
-- }
- }
- loop{
-- ascent{
-- }
- }
} // end of script_enemy_main
setmovepositions
} // -1 brackets
} // -2 brackets
wait{ loop{} }
} // -3 brackets
} // -4 brackets
Oh. What the fuck have I just done. Guess I'll go correct it.
-
Okay then, how do I "kill" (delete and respawn later with sub spawn) a familiar
-
Okay then, how do I "kill" (delete and respawn later with sub spawn) a familiar
There were two ways.
The first one by giving it SetLife(-5000) or similar, however I believe this counts as a player score, and will add score. The 2nd method without the negative life I forgot and hoping someone can refresh both our memories.
-
VanishEnemy will delete the enemy without any additional effects (no score, no explosion).
-
VanishEnemy will delete the enemy without any additional effects (no score, no explosion).
/me slaps face
And how could I ever forget about that simple function. ORZ
-
INCOMING PROBLEM!!!this must be fit in here, oh well
Here it goes:
http://i314.photobucket.com/albums/ll403/jed9876/Touhou/tojiko_trans.png
So basically, I have a coloring problem. Looks like the 0,0,0 RGB value is transparent on danmakufu. Not just Tojiko, it also includes the shoes of other characters as well. :V
How can I fix this?(using GIMP to recolor it is a mess, it catches the other colors.)
Thanks in advance(derp)
looks like I found a solution on this by myself. I just have to adjust its brightness by 1. Oh silly me.
Anyway, how can I make those . . . what should I call on those. . . timed shots? Something like on Futo's 3rd nonspell, most of Orin's nonspells, and etc.
-
[18:43:16] <HyperMario> you see, the last bullet becomes the first one to move
[18:43:24] <Kyuu> CreateShotA
[18:43:39] <Kyuu> SetShotDataA(id, frametomanipulate, speed, angle.......
[18:43:46] <Kyuu> You would want to play around with frametomanipulate
[18:44:16] <HyperMario> might need a bombard of SetShotDataA's, I guess
[18:44:39] <Kyuu> Certainly it's easy to make.
[18:44:44] <Kyuu> Come to #danmakufu why don't you sometime
[18:45:17] <HyperMario> there's no people in there
[18:45:24] <Kyuu> on ppirc
[18:45:31] <HyperMario> oh
[18:45:43] <Kyuu> it's better than #gensokyo lol
[18:45:52] <HyperMario> maybe I should wait for the answer on the forums
[18:45:56] <Kyuu> i tell you
[18:46:01] <Kyuu> it's setshotdataa
[18:46:18] <HyperMario> I know
[18:46:26] <HyperMario> but I want to reverse the frame
[18:46:30] <Kyuu> uh
[18:46:43] <Kyuu> just have frametomanipulate be lower number every time you shoot
[18:46:58] <HyperMario> as in ascent?
[18:47:10] <Kyuu> suuuuuuuuure
[18:47:15] <Kyuu> lemme try it
[18:47:28] <HyperMario> ok
[18:49:01] <Kyuu> let time = 240;
[18:49:01] <Kyuu> loop(15) {
[18:49:01] <Kyuu> CreateShotA(0, GetX, GetY, 10);
[18:49:01] <Kyuu> SetShotDataA(0, 0, 4, GetAngleToPlayer, 0, -4/30, 0, BLUE21);
[18:49:01] <Kyuu> SetShotDataA(0, time, 0, NULL, 0, 2/45, 2, RED21);
[18:49:01] <Kyuu> FireShot(0);
[18:49:01] <Kyuu> time-=15; loop(10){yield;}
[18:49:01] <Kyuu> }
[18:49:02] <Kyuu> try this
[18:49:05] <Kyuu> i didn't test it yet
[18:51:27] <HyperMario> oh cool
[18:51:30] <HyperMario> thanks
-
Futo's 3rd nonspell (well, all her nonspells) is basically
ascent(i in 0..number_of_rings){ //
ascent(j in 0..(360/bullets_in_ring)){
CreateShotA(0, x, y, delay);
SetShotDataA(0, 0, speed, 360/j, 0, negative_accel, 0, graphic);
SetShotDataA(0, frame, NULL, NULL, 0, positive_accel), maxspeed, othergraphic;
FireShot(0);
}
loop(4){yield;}
}
but sometimes the bullets fired last come first which is just like maxwait-(i*frames) and stuff
-
Futo's 3rd nonspell (well, all her nonspells) is basically
ascent(i in 0..number_of_rings){ //
ascent(j in 0..(360/bullets_in_ring)){
CreateShotA(0, x, y, delay);
SetShotDataA(0, 0, speed, 360/j, 0, negative_accel, 0, graphic);
SetShotDataA(0, frame, NULL, NULL, 0, positive_accel), maxspeed, othergraphic;
FireShot(0);
}
loop(4){yield;}
}
but sometimes the bullets fired last come first which is just like maxwait-(i*frames) and stuff
I tried this but only shoots a wave (and is very ugly, doesnt look like the original)... I did something wrong
btw, how I can replicate the Futo 3rd spellcard... the one of the fire? "xxxxxxxx in flames" or something ... looks hard to make
Also, how I can make the Miko's spellcard: Secret Treasure "Armillary Sphere of Ikaruga-dera"? do not even know where to start ^^U
-
btw, how I can replicate the Futo 3rd spellcard... the one of the fire? "xxxxxxxx in flames" or something ... looks hard to make
Also, how I can make the Miko's spellcard: Secret Treasure "Armillary Sphere of Ikaruga-dera"? do not even know where to start ^^U
Try to understand this if you can for Futo's nonspells (just calling the Shots task, assuming 250 is the id graphic for an arrow) : Corresponding Video (http://www.youtube.com/watch?v=9-XKU3MT70g)
It won't work for you though since it's ph3, but you should be able to understand the task.
task Shots{
let a=0;
loop(120){yield;}
loop{
ascent(k in 0..12){ascent(i in 0..20){CustomShotC(GetX,GetY,5,a+360/20*i,-0.08,0,90,0.03,3,0,250);}a=a+0.30*(k+4);loop(5){yield;}}
loop(180){yield}
ascent(k in 0..24){ascent(i in 0..20){CustomShotC(GetX,GetY,5,a+360/20*i,-0.08,0,90,0.03,3,0,250);}a=a+0.40*(k+4);loop(5){yield;}}
loop(180){yield}
ascent(k in 0..12){ascent(i in 0..20){CustomShotC(GetX,GetY,5,a+360/20*i,-0.08,0,150-10*k,0.03,3,0,250);}a=a+0.36*(k+4);loop(5){yield;}}
loop(240){yield}
}
}
task CustomShotC(x,y,s,a,ds,s2,delay,ds2,s3,da,g){
let obj=ObjShot_Create(OBJ_SHOT);
ObjMove_SetPosition(obj,x,y);
ObjShot_SetGraphic(obj,g);
ObjMove_SetAngle(obj,a);
ObjMove_SetSpeed(obj,s);
ObjShot_Regist(obj);
let t=0;
let ph=0;
while(GetLife>0 && !Obj_IsDeleted(obj)){
yield;
if((ds > 0 && ObjMove_GetSpeed(obj)>s2)||(ds < 0 && ObjMove_GetSpeed(obj)<s2)){
ObjMove_SetSpeed(obj,s2);loop(delay){yield;};
CreateShotA2(ObjMove_GetX(obj),ObjMove_GetY(obj),s2,a+da,ds2,s3,g,0);Obj_Delete(obj);
}
ObjMove_SetSpeed(obj,ObjMove_GetSpeed(obj)+ds);
}
Obj_Delete(obj);
}
Futo's spellcard is very simple, the red fireballs are immobile at first, then accelerate in a random direction, and the yellow fireballs are immobile at first, then move in a increasing angle for each fireball in the column
All you need is a task with two parameters (graphics and angle) and one object shot.
Miko's fourth spellcard is also simple, just make object bullets for which you disable collision, then activate collision and change graphics, the movement is easier with position-controlled bullets.
-
I tried this but only shoots a wave (and is very ugly, doesnt look like the original)... I did something wrong
I would have been surprised if it had looked anything like the original. This is just the general format of her nonspells; all three of them are made using a similar format. Several rings of bullets fire in some increasing/decreasing offset angle, slow down to a stop, then start moving again, sometimes in a different order. That's all there is there.
-
I have a question.
What return and break do?
-
I have a question.
What return and break do?
return returns a function value or ends the task. Break exits the loop (wait, loop, etc)
Corresponding Video (http://www.youtube.com/watch?v=9-XKU3MT70g)
lololol Suwako shooting arrows :]
-
return returns a function value or ends the task.
There are two versions of return.
function funcname(parameters) { dostuff; return value1; }
This does whatever dostuff; does, and then gives a return value of value1. So you can use the above code for things like:
let variable = funcname(parameters);
return when used in like a task: return;
You can use it to exit out of a loop, like break.
Also, ScarletKnives,
task Shots{
let a=0;
SetMovePosition02(GetCenterX, GetCenterY/2, 75);
loop(120){yield;}
loop {
ascent(k in 0..12){ascent(i in 0..20){CustomShotC(GetX,GetY,5,a+360/20*i,-0.08,0,90,0.03,3,0,BLUE21);}a=a+0.30*(k+4);loop(5){yield;}}
loop(180){yield}
ascent(k in 0..24){ascent(i in 0..20){CustomShotC(GetX,GetY,5,a+360/20*i,-0.08,0,90,0.03,3,0,BLUE21);}a=a+0.40*(k+4);loop(5){yield;}}
loop(180){yield}
ascent(k in 0..12){ascent(i in 0..20){CustomShotC(GetX,GetY,5,a+360/20*i,-0.08,0,150-10*k,0.03,3,0,BLUE21);}a=a+0.36*(k+4);loop(5){yield;}}
loop(240){yield}
}
}
task CustomShotC(x,y,s,a,ds,s2,delay,ds2,s3,da,g){
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj,x,y);
ObjShot_SetGraphic(obj,g);
Obj_SetAngle(obj,a);
Obj_SetSpeed(obj,s);
let t=0;
let ph=0;
while(!Obj_BeDeleted(obj)){
yield;
if((ds > 0 && Obj_GetSpeed(obj)>s2)||(ds < 0 && Obj_GetSpeed(obj)<s2)){
Obj_SetSpeed(obj,s2); loop(delay){yield;}
CreateShot02(Obj_GetX(obj),Obj_GetY(obj),s2,a+da,ds2,s3,g,0); Obj_Delete(obj);
}
Obj_SetSpeed(obj,Obj_GetSpeed(obj)+ds);
}
}
-
I forgot the formula for calculating radius, for example I'd need it to check if an item is within a radius surrounding the character so that the item will be automatically auto route to the player.
I was wondering if anyone else uses or remembers the radius/circle collission detection formula
-
Common method is just checking distance, which naturally equates to a radius.
((oy-py)^2 + (ox-px)^2) < (distance^2)
of course there are methods to speed this stuff up though but yeah
-
Is there a way on how to play 2 sounds?
Let's say: PlaySE(Laser) will play Laser1 and Laser2
is that possible?
-
Is there a way on how to play 2 sounds?
Let's say: PlaySE(Laser) will play Laser1 and Laser2
is that possible?
Why not just play them at the same time?
-
Or just create a function ...
-
Is there a way to create gravity bullets using CreateShot02? I remember seeing something like that a long time ago. It's that my stage 3 boss's gimmick bullets make heavy use of gravity bullets when they explode.
-
Is there a way to create gravity bullets using CreateShot02? I remember seeing something like that a long time ago. It's that my stage 3 boss's gimmick bullets make heavy use of gravity bullets when they explode.
here (http://www.shrinemaiden.org/forum/index.php/topic,9281.msg753249.html#msg753249) i've answered the same question. And here (http://pastebin.com/Vf2gqDRY) is a test script i made.
-
What does ceil do? Just wondering.
-
Rounds up always.
ceil(1.7) = 2
ceil(1) = 1
ceil(1.1) = 2
-
Thanks, Naut!
-
How to replicate the effect of Yukari's "Border between Humans and Youkai"?
At the Final Phase, all the lasers close towards the player. I want to do the same.
My current code is this:
let dir = 0;
let dir2 = 0;
let dir3 = 180;
wait(60);
loop
{
CreateShot01(GetX + dir3 * cos(dir), GetY + dir3 * sin(dir), 1, dir - 180, 14, 10);
CreateShot01(GetX - dir3 * cos(dir), GetY - dir3 * sin(dir), 1, dir - 180, 14, 10);
CreateShot01(GetX + dir3 * cos(dir2), GetY + dir3 * sin(dir2), 1, dir2 - 180, 14, 10);
CreateShot01(GetX - dir3 * cos(dir2), GetY - dir3 * sin(dir2), 1, dir2 - 180, 14, 10);
dir++;
dir2--;
dir3--;
wait(1);
}
Code may be wrong, as I type this from memory
-
Quick question on reflecting things: How would you reflect objects in a circle? As in, if a circle's center is on point X and Y, and an object bullet reached a certain distance R from the center point, what's the basic formula for bouncing them? I know that on the vertical walls it's 180-angle, while it's 360-angle for the horizontal walls... :\
<><><><>360<><><><>
180<><><><><><>180
<><><><>360<><><><>
...180 between each 90 degree increment :\
set angle to Angle-Bullet, where Angle is the angle from X and Y, and Bullet is the trajectory of the bullet?
only i'd have to change Angle to accomodate the formula? like, Angle=2*(Angle-180)+180?
...I'm testing this on paper as I'm typing it, and it looks promising :\ Dunno yet. What I has is:
let Bullet=Obj_GetAngle(obj); //(irrelevant in real script situations probably, just using it for simpler show)
let Angle=atan2(Obj_GetY(obj)-GetCenterY,Obj_GetX(obj)-GetCenterX);
Angle=2*(Angle-180)+180; //(this is how I'm thinking of accommodating the angle calculation thing, where its 360 up and down, and 180 left and right)
SetAngle(obj,Angle-Bullet); //(final thing, basically how a reflected angle is determined)
Starting to think asking this was redundant since I've probably figured it out by now. Oh well. Test it in the morning I guess...
Another thing, I've been thinking about the hitbox thing endlessly again, and I still don't see how a bubble bullet can have such a small hitbox compared to the sprite when it was stated that a custom sprite's hitbox radius is about 1/2 to 1/3 of the rectangle's smallest dimension. If you put the borders right up close to the bubble's edges, that would make the sprite almost all hitbox, right? And if it were larger, wouldn't it make it larger than the sprite itself? Or am I confusing myself...? O.o
-
Another thing, I've been thinking about the hitbox thing endlessly again, and I still don't see how a bubble bullet can have such a small hitbox compared to the sprite when it was stated that a custom sprite's hitbox radius is about 1/2 to 1/3 of the rectangle's smallest dimension. If you put the borders right up close to the bubble's edges, that would make the sprite almost all hitbox, right? And if it were larger, wouldn't it make it larger than the sprite itself? Or am I confusing myself...? O.o
Yeah, it's not the radius but the diameter. If your bullet definition borders match the sprite's borders, only half the radius of the bullet will be deadly.
If a bullet hits your circle at (X+R*cos(u),Y+R*sin(u)) and that bullet has angle v, it will bounce with angle 2*u-v.
You can put 2*(u-180)-v, or 2*(u-900)-v if you like that, though :?).
-
Hi... Well I'm new here D:. I've known this forum for long time since, but never registered until now. First, english is not my principal language so if you see some errors, sorry D:.
Wel... I'm here because I'm making a stage, so I made it, I'm at the boss part and I wanted to make a dialogue. I made it, but it crashes... I've tried everything so I hope you can help me t.t. Here is the dialogue code. It crashes just when it ends...
http://pastebin.com/BaMdLe6b
So what am I doing bad?
Welcome to the forum, also please use pastebin when posting big code. --Hele
-
Hi... Well I'm new here D:. I've known this forum for long time since, but never registered until now. First, english is not my principal language so if you see some errors, sorry D:.
Wel... I'm here because I'm making a stage, so I made it, I'm at the boss part and I wanted to make a dialogue. I made it, but it crashes... I've tried everything so I hope you can help me t.t. Here is the dialogue code. It crashes just when it ends...
So what am I doing bad?
Well first off, I suggest putting large blocks of code like that into pastebin links in the future. It's kind of a rule here.
As for your problem, I believe it's caused by the fact that your script calls GetEventStep while an event isn't running, which causes a crash immediately for some reason. Doing something like this for when you call it should fix the problem:
if(OnEvent == true) {
if(GetEventStep == 1) { DoStuff; }
}
With this, the program should only call GetEventStep when it's ok to do so.
-
I want to track if two moving straight lasers intersect, and if they do - get the coordinates of intersection. I know that it could be easily calculated cause object lasers always offer coordinates of both endpoints. The problem is how to organize laser per laser comparsion when there are a lot of them at the same time, as every laser "lives on it's own" by an instance of the same task ??? Do i need to store a dynamic array containing coordinates of all lasers present at the moment or something?
-
either that or create your objects outside your task.
-
either that or create your objects outside your task.
Hmm.. how do i manage them then? I always imagined that if i need some uncertain ammount of dynamic objects (that need some processing, not just creation) it should be done through calling every new object as an instance of a task. It's easy and flexible for all kind of objects from bullets to menus. And how could it be done without tasking? Through an array of objects? :wat:
-
Either that or just be exhaustive. I dunno how many lasers at a time you need, though.
And just go to ph3, man.
-
And just go to ph3, man.
I heard that in ph3 objects are objects and you can retreive any of their data when you want. But how a swarm of independent objects could be managed there?
-
Best answer I can give to that is arrays or a task per object.
-
Hey, I wanted to say thanks for the answer and sorry about the code I didnt know I had to use pastebin D:. Well it worked so thanks again ^^
-
Ok. I'll try to do it with array of coordinates. But i've got another question. If i use erase command to remove a certain entry from array, does that mean all entries after it will get their indexes decreased? This totally breaks the plan, cause task must keep the correct index of an array cell it refers to. The only other way to manage an uncertain "cloud" of objects that comes in mind is common data, wich is ridiculous, but might work (it works well for processing power items, but that was in case of necessity of data exchange between the scripts).
-
Uh well instead of erasing that entry, just overwrite it then ...
-
Uh well instead of erasing that entry, just overwrite it then ...
Wat? U seem not getting the process i want to perform. Imagine i have a bunch of lasers flying and an array containing coordinates of all their endpoints. Each laser refers to a certain cell of that array and it's task updates the value until laser is gone. What do i need to do when laser is gone and it's cell is not in use? How could i overwrite it, or i mean how new instances of task for new lasers spawned could know about any unused cells? That sounds too complicated for such an easy goal. I think i'll try to use common data for it...Wait a minute... there will be the some problems too, cause that power items routine i made does just the opposite i want here. But screw it, i'll try anyway :colonveeplusalpha:
-
Use null/default values. I did this exact technique in the pixel contest, and although my entry was awful, it's basically what you're trying to do.
-
Like Drake says, overwrite it with an arbitrary default value, like (-1000), and check if your value is (-1000) before doing your stuff.
-
Use null/default values. I did this exact technique in the pixel contest, and although my entry was awful, it's basically what you're trying to do.
Hmm.. You mean just "forget" those unused cells so array will grow with every new entry no matter of how many of them actually are? I think it will work since there will be not very much lasers spawned during the spellcard i'm working on, though it's such a waste.
Also, speaking of danmakufu contests. Will there be any new ones? Noone happened since i've joined MoTK but i want to participate so much :3
-
Uh well no you don't *have to* always expand your array, you can just overwrite the unused indexes, especially if you know the maximal number of array at a time.
-
Uh well no you don't *have to* always expand your array, you can just overwrite the unused indexes,
But to find if there is any unused cell i have to parse the array from the beginning? Well it's not a big problem when array isnt really big. Thanks for advices, though, as i said before, i'll try "fake common data indexing" first, cause deleting an entry from CD doesnt affect the rest. It only will return "No data" on next parse.
especially if you know the maximal number of array at a time.
Do you mean length function?
-
Instead of storing the coordinates in the array, store the object ids. You can grab the coordinates from the object ids. That way you don't need to constantly update the array, nor do you need to worry about which index belongs to what object. You can then use the erase function without worrying about the indexes.
-
Instead of storing the coordinates in the array, store the object ids. You can grab the coordinates from the object ids. That way you don't need to constantly update the array, nor do you need to worry about which index belongs to what object. You can then use the erase function without worrying about the indexes.
Oh geez! Why havent i thought about it? So an object can actually "put" itself into array? like
array=array~[obj];
How do i need to define the array first then? like
let tmp=Obj_Create(OBJ_LASER);
let array=[tmp];
Oh shi-- tried just now and it works! Thanks a lot, that was the best idea ever :*
So now my task looks like that
task Laser(x,y,aim){
let obj=Obj_Create(OBJ_LASER);
lasers=lasers~[obj];
let laserid=length(lasers)-1;
* * *
Obj_Delete(obj);
erase(lasers,laserid);
}
Hmm.. But calling erase function doesnt affect array length for some reason :wat:
-
lasers = erase(lasers, laserid)
-
lasers = erase(lasers, laserid)
Yeah already fixed this :facepalm: It works now, but causes an error sometimes and crashes danmakufu. I smell erase decreases length of an array causing other later erases go out of bounds :qq:
Oh well. I've got it. Looks like i dont need to erase an array entry from the task, but while parsing it for laser data comparsion. Just one question: what will array cell contain when i call Obj_Delete in task? NULL? Screw this. I forgot about Obj_BeDeleted function.
But damn again it causes error 126 and crashes danmakufu. Here's the task testing this
task ParseLasers{
let num=0;
loop{
num=length(lasers);
if (num>1){
ascent(i in 1..num){
if(Obj_BeDeleted(lasers[i])){
lasers=erase(lasers,i);
num--;
}
}
}
yield;
}
}
I'm curious, does decreasing of num affect ascent, or should i use while?
UPD: Just as planned! Replacing ascent (i in 1..num) with while (i<num) fixes the problem. Maaan, make another note on danmakufu weird bugs list (http://www.scenemusic.net/static/emoticons/facepalm.gif)
Oh and it's so fun to answer own questions in the thread yourself :D
-
Why did you not actually look at my entry like I advised instead of asking all these questions that would have been answered by looking at my entry.
-
Yeah already fixed this :facepalm: It works now, but causes an error sometimes and crashes danmakufu. I smell erase decreases length of an array causing other later erases go out of bounds :qq:
Oh well. I've got it. Looks like i dont need to erase an array entry from the task, but while parsing it for laser data comparsion. Just one question: what will array cell contain when i call Obj_Delete in task? NULL?
It will be unaffected. You aren't storing the object in the array, you're storing a number that identifies the object, thus why I refer to it as an object id. When the object is deleted, the id is still stored in the array. Any attempt to use that id won't cause any errors, but won't return any meaningful information either. Instead of using erase(lasers,laserid); at the end of your task, which actually causes major problems, you can call Obj_BeDeleted on each element in the array before grabbing the coordinates. If it has been deleted, go ahead and erase it.
As a sidebar, if you do plan to erase elements in an array, make sure you are iterating through the array with descent instead of ascent. If you want to know why, imagine this scenario.
array = [0, 1, 2, 3, 4 ,5]
ascent(i in 0..length(array)){
if(i == 3){
array = erase(array, i);
}
let blah = i;
}
This would raise an error. Why? Because when i goes from 0 to 5 in order, array[5] no longer exists by the time it gets to the last iteration of the ascent loop. Incidentally, this also causes it to skip over an element in the array. However, if you replace ascent with descent, it'll start with the last element first, which definitely will not be deleted already. It also will not skip over anything anymore.
-
Why did you not actually look at my entry like I advised instead of asking all these questions that would have been answered by looking at my entry.
Because Blargel posted a more interesting idea. Thanks for your advice too ;)
Well guys'n'gals. Seems like it works like it should for now so i wont flood the thread until some new shit happens.
And again big thanks for all suggestions and answers, it helped me a lot ;)
-
This would raise an error. Why? Because when i goes from 0 to 5 in order, array[5] no longer exists by the time it gets to the last iteration of the ascent loop. Incidentally, this also causes it to skip over an element in the array. However, if you replace ascent with descent, it'll start with the last element first, which definitely will not be deleted already. It also will not skip over anything anymore.
Not only on the last but on every iteration. Looks like ascent limits get fixed once it's called. So yeah, descent or while cycles are needed for this.
Fuck. Doublepost. Moderators, please merge or delete this nonsense :fail:
-
I have a question for Danmakufu 0.12
Let's say I have a script for a Spellcard. I can run it, but only if I input either REIMU or MARISA in the #PLAYER selection stuff in the script. If I put FREE, Danmakufu suddenly shut down with no message. So in shorts, I cannot use custom player script. How do I fix these kind of problem? I guess that I haven't modify something yet in Danmakufu after I installed it but i don't know. And it's worse when I need to run a full-bossfight script. I cannot play it at all.
PS: Yes, the custom player script is still in the Player folder. So I think the problem came from
Sorry, it's hard to word all of these problems easily. English isn't really my native languege. Let's just say I cannot run bossfight-script at all since Danmakufu just suddenly shut down when I select the boss-script.
Thanks for replying.
-
If I put FREE, Danmakufu suddenly shut down with no message.
That's weird. Try to reinstall danmakufu and be sure to run it through applocale.
Meanwhile: The script with intersecting lasers i was asking before is complete and works well. Though i've noticed one thing - it causes massive memory leak. Through method of exclusion i've found that it's caused by array concatenation
lasers=lasers~[obj];Even when i erase unused cells and reset array on every new wave it keeps eating megabytes like it's no thing. And dnh doesnt free them away after script ends, so it may cause some HUEG memory invasion after lots of restarts.
So i dunno, am i doing something wrong, or it's just common way danmakufu works with arrays?
-
How would one make a curvy laser-esque player shot? ._." If it's even possible.
-
How would one make a curvy laser-esque player shot? ._." If it's even possible.
Yes, it's possible. Use Obj_Create(OBJ_SINUATE_LASER)and then process it with proper functions (http://dmf.shrinemaiden.org/wiki/index.php?title=Object_Control_Functions#ObjSinuateLaser_SetLength)
-
I have a question for Danmakufu 0.12
Let's say I have a script for a Spellcard. I can run it, but only if I input either REIMU or MARISA in the #PLAYER selection stuff in the script. If I put FREE, Danmakufu suddenly shut down with no message. So in shorts, I cannot use custom player script. How do I fix these kind of problem? I guess that I haven't modify something yet in Danmakufu after I installed it but i don't know. And it's worse when I need to run a full-bossfight script. I cannot play it at all.
The problem is likely that you aren't running Danmakufu under Japanese locale, and it's trying to read japanese characters from the Rumia scripts, but it can't.
Please go through these steps.
http://www.shrinemaiden.org/forum/index.php/topic,4138.0.html
-
Yes, it's possible. Use Obj_Create(OBJ_SINUATE_LASER)and then process it with proper functions (http://dmf.shrinemaiden.org/wiki/index.php?title=Object_Control_Functions#ObjSinuateLaser_SetLength)
Hmm... So I create an Object Sinuate Laser... But then how does the damage work? I'm guessing I'd have to set Player Collision to false, and then object collision to true? I'm still confused about how the damage would work properly, since using AddLife with negative numbers would be a set amount of damage... I'd like it if damage rates could be factored in O.o (I'm guessing that commondata could be used to do this per enemy, but that seems so tedious x.x)
-
Hmm... So I create an Object Sinuate Laser... But then how does the damage work? I'm guessing I'd have to set Player Collision to false, and then object collision to true? I'm still confused about how the damage would work properly, since using AddLife with negative numbers would be a set amount of damage... I'd like it if damage rates could be factored in O.o (I'm guessing that commondata could be used to do this per enemy, but that seems so tedious x.x)
Wat? Doesn't ObjShot_SetDamage work for curvy lasers? :wat: Man, i never scripted something with curvy lasers (especially player script lol) and there's a word on wiki that not all functions working with regular lasers will work with curvy, so try ObjShot_SetDamage on your laser (remember it sets damage rate per frame it collides an enemy, so dont enter much) and tell if it works. Also regular player's lasers may need ObjShot_SetPenetration defined, but i dunno if it works for curvy lasers. Try to set it too.
-
Hmm... I'll be sure to try that the next time I get on danmakufu(been busy trying to beat Marine Benefit and stuff). Btw, how can you make angled rotation around a point? I know you can do rotation in a perfect circle around a point with sin and cos functions. I'm guessing that to angle it a certain way you'll have to adjust the "radius" when sin and cos are performed to make it more of an oval-like shape than a sphere? I must learn how to accurately do this, so I can make a spell similar to the one Marine Benefit where there's a rotating sphere of glowy bullets with the ones "in the back" not having hitbox detection(that part I know, it's just the rotation I need help on @@).
-
Hmm... I'll be sure to try that the next time I get on danmakufu(been busy trying to beat Marine Benefit and stuff). Btw, how can you make angled rotation around a point? I know you can do rotation in a perfect circle around a point with sin and cos functions. I'm guessing that to angle it a certain way you'll have to adjust the "radius" when sin and cos are performed to make it more of an oval-like shape than a sphere? I must learn how to accurately do this, so I can make a spell similar to the one Marine Benefit where there's a rotating sphere of glowy bullets with the ones "in the back" not having hitbox detection(that part I know, it's just the rotation I need help on @@).
That spell you're talking about is not about just "rotation". It's just a projection of rotating 3D sphere with points on it's surface. You need to process all 3D coordinates in array of points as if you managed a real 3D sphere, but use only x and y for onscreen projection and z for detecting if point is on foreground or background.
Also i dont get what do you mean by "angeled rotation" aroud the point. If you mean tilting the virtual plane in wich point goes in circle - yeah, that's another way to do the same pattern. But i'd prefer first method cause once scripted it allows you manipulate any array of 3D points in that way, not only sphere.
Well. After playing some time with danmakufu i've made this sample (http://www.mediafire.com/?ckwdk4kkug7tgsj) It uses spherical coordinates for initial sphere points enumerating and then rotation matrix for rotating it around two axises. See links in the script comments. Those bullets meant to be on backside of sphere are drawn as effect objects.
Also, i'm not sure that in original spell from MB extra those "background" bullets have no hitboxes. Afair i've tried to dodge them all.
And i've adjusted it a little to make it a fun spellcard download (http://www.mediafire.com/?w1c0fnv0kac52pv)
-
Whoa. I just tested that script, and it looks just like the spellcard *O* But I think I'll stick to using only bomb resistant object bullets that change alpha value and character detection in accordance to its z-value(like you did, except you switched the places of the effect and shot is all).
But the problem is that I'm not that great with advanced math yet @@. I've read the articles that you've linked to, but I'm confused by the symbols used in the diagrams/formulas. If it's possible, could you briefly explain some of the logic behind doing r * sin(a) * cos(b) and all of that stuff to find the coordinates? Rotation I'm not even going into yet, prolly. I'm the type of learner that learns best when I know the use of it, or how it's being applied or however you say it, apparently ._." Teachers get annoyed when I ask about the logic behind every single concept x.x
And who knows? Maybe understanding the mechanics of 3-d rotation will be easier once I manage to grasp 3-d placement/coordinates ^^
-
But I think I'll stick to using only bomb resistant object bullets that change alpha value and character detection in accordance to its z-value
Hmm.. How can an object bullet change it's alpha value (without changing graphics) and interaction with player's hibox? :wat:
But the problem is that I'm not that great with advanced math yet @@. I've read the articles that you've linked to, but I'm confused by the symbols used in the diagrams/formulas. If it's possible, could you briefly explain some of the logic behind doing r * sin(a) * cos(b) and all of that stuff to find the coordinates? Rotation I'm not even going into yet, prolly. I'm the type of learner that learns best when I know the use of it, or how it's being applied or however you say it, apparently ._." Teachers get annoyed when I ask about the logic behind every single concept x.x
And who knows? Maybe understanding the mechanics of 3-d rotation will be easier once I manage to grasp 3-d placement/coordinates ^^
Oh well. It's not necessary to understand some advanced math just to use the formulas to calculate stuff. But ok, i'll try to describe "easily" how those functions work.
First, spherical coordinates. Imagine a globe where you have latitude and longitude to define a location on it's surface. Those are actually two angles, like shown on this picture
(http://upload.wikimedia.org/wikipedia/commons/thumb/c/c0/Spherical_with_grid.svg/220px-Spherical_with_grid.svg.png) One - between Z axis and radius to point, another - between projection of that radius on XY plane and X axis.
So with two cycles for two angles and a given radius you can easily arrange them on a sphere surface (radius is processed in point task)
ascent(i in 0..30){
ascent(j in 0..15){
Point(i*12,j*12);
}
}And to derive onscreen coordinates for those bullets (and their z for depth effect) here's a formula for coordinate conversion:
(http://upload.wikimedia.org/wikipedia/ru/math/1/d/b/1dbfa1e8824d92cb0d5d003d9c0bed01.png) If you're confused how it works, it's pretty easy 2-step operation. r * sin(a) is actually a length of radius projection on XY plane. And to find X coordinate of it you have to multiply it by cos(b) (and by sin(b) for Y). Just look one more time at the picture and you'll get it. This way the initial coordinates of bullets are calculated:
if(rad<272){
//Definition of sphere points. See http://en.wikipedia.org/wiki/Spherical_coordinate_system#Cartesian_coordinates
x0=rad*sin(a)*cos(b);
y0=rad*sin(a)*sin(b);
z0=rad*cos(a);
}As i dont do any manipulation with them, and dont change the radius once it reaches maximum, there's no need to calculate them always, so there goes if.
Now we can proceed to rotation. From this point it doesnt matter if we have a perfect sphere of points or whatever. You can draw a cube if you want or something else (try to add a+=rand(-2,2); b+=rand(-2,2); before while in a task ;) )
The most common way to rotate a 3D point around one of axises is using rotation matrices as described here http://en.wikipedia.org/wiki/Rotation_matrix#In_three_dimensions
(http://upload.wikimedia.org/wikipedia/ru/math/1/d/7/1d7e48006b428fed418986fddfa4fb1e.png) (http://upload.wikimedia.org/wikipedia/ru/math/b/7/a/b7a0598963cda234801a7f1f2f3b73dc.png)
If you dont know what is vector multiplication by matrix i'll describe it like that: Your certain point you want to rotate around some axis is represented by it's initial coordinates [x0, y0, z0]. To rotate it around X axis for example by an angle of a you have to do following equations:
x = M1,1 * x0 + M1,2 * y0 + M1,3 * z0
y = M2,1 * x0 + M2,2 * y0 + M2,3 * z0
z = M3,1 * x0 + M3,2 * y0 + M3,3 * z0 where M1,2 is a value from 1st row and 2nd column of rotaion matrix and so on.
The first one above is a rotation matrix for rotation around X axis, wich controlled by ang1 value in my script. Omiting zeros, we'll get this
x=x0;
y=y0*cos(ang1)-z0*sin(ang1);
z=y0*sin(ang1)+z0*cos(ang1);By applying this we'll get our sphere (or whatever bunch of points) rotatin around X axis on screen.
And then we're doing the same thing but for rotating around Y axis. Just use second matrix for it:
xtmp=x; // Needed to save x value for z calculation
x=x*cos(ang2)+z*sin(ang2);
z=-xtmp*sin(ang2)+z*cos(ang2);I used an additional variable xtmp to store x value so it wont get corrupt on z calculation.
And that's it! Now the complexity of the pattern highly depends on how are you going to rotate it. It can easily go from "omg it's so fun and confusing!" to "how the fuck should i dodge this mindfuck?!" Hope you understood my wall of text i've written here, cause i cant describe it any easier :yukkuri:
-
I see... so the one on the XY plane is like longitude, going from each pole of the earth, and the one between the z-axis and the radius to point is like latitude, distance from the equator, only this time it starts at the top and goes down.
from what I see, the Ascent loop with "i" represents the number of bullets that are in each "circle" of the "sphere", while the ascent with "j" represents the number of "circles" that are spawned in the "sphere", with the multipliers determining the space between each bullet or circle.
Oh and it's really simple to change alpha really. Unless your bullet is custom-defined with a certain alpha value, you can just use "Obj_SetAlpha(id,alpha);" to set the alpha value to either 255(solid) or 128(about halfway transparent?). As for the bullets at the "poles", they overlap each other, so a special exception can be made with them by using an if statement (if a==0||a==180, which are the beginning and midway-points on the "circles") and setting the alpha to 128/j, j being the same number used in the ascent loop before(this is just for aesthetics, unless you want a solid-looking bullet in the background messing up your mind). Hitbox detection for object bullets are defaulted to on, but you can use "ObjShot_SetCollisionToPlayer(id,true/false);" to set it yourself, and it can be set again and again.
I think I'm pretty much good on the creation of "3-d" bullets, but I'm gonna look over the rotation stuff just a little bit more ^^"
EDIT: Ooops! I forgot to tell you how much this has been of use to me O: Thank you SO much~
-
I see... so the one on the XY plane is like longitude, going from each pole of the earth, and the one between the z-axis and the radius to point is like latitude, distance from the equator, only this time it starts at the top and goes down.
from what I see, the Ascent loop with "i" represents the number of bullets that are in each "circle" of the "sphere", while the ascent with "j" represents the number of "circles" that are spawned in the "sphere", with the multipliers determining the space between each bullet or circle.
Oh and it's really simple to change alpha really. Unless your bullet is custom-defined with a certain alpha value, you can just use "Obj_SetAlpha(id,alpha);" to set the alpha value to either 255(solid) or 128(about halfway transparent?). As for the bullets at the "poles", they overlap each other, so a special exception can be made with them by using an if statement (if a==0||a==180, which are the beginning and midway-points on the "circles") and setting the alpha to 128/j, j being the same number used in the ascent loop before(this is just for aesthetics, unless you want a solid-looking bullet in the background messing up your mind). Hitbox detection for object bullets are defaulted to on, but you can use "ObjShot_SetCollisionToPlayer(id,true/false);" to set it yourself, and it can be set again and again.
I think I'm pretty much good on the creation of "3-d" bullets, but I'm gonna look over the rotation stuff just a little bit more ^^"
EDIT: Ooops! I forgot to tell you how much this has been of use to me O: Thank you SO much~
Yeah, you got it pretty right. Except it's i cycle that enumerates circles and j wich "draws" half a circle (to avoid redundant bullets).
Hmm i'm using CtC shotsheet as a shotreplace. Seems like it has no predefined alpha in shotdata, but i dont remember if i ever sucessfully changed it that way. Thanks for the tip, i'll try. Also i've never thought of SetCollisionToPlayer (never used it) so here comes object doubling nonsense you can see in my script :blush:
You're welcome! Now make something cool with this knowledge ;)
-
Oh! I see now. That makes much more sense with the latitude/longitude idea~ Oh and yeah, I see how the j cycle works know (stupid brain didn't process the fact that j cycle would run "twice" for each time the i cycle ran (in reality it just runs all "x" times per loop of i), and the i cycle draws twice the number of "circles" since j draws half circles.
-
Oh! I see now. That makes much more sense with the latitude/longitude idea~ Oh and yeah, I see how the j cycle works know (stupid brain didn't process the fact that j cycle would run "twice" for each time the i cycle ran (in reality it just runs all "x" times per loop of i), and the i cycle draws twice the number of "circles" since j draws half circles.
More correct i cycle goes all around 360 degrees so there's no need for j cycle to draw full circles as it will make bullets double. So it draws half a circle wich been rotated 360* produces full sphere.
-
Quick question: If you had an if statement of some sort like this:
if(A && B || C && D){}
would the requirement be met if:
A and B, or C and D were met?
OR
A, B or C, and D were met?
I know it'd be safer to just use brackets, but I was wondering this~
-
It's nearly always NOT then AND then OR. I'm sure Danmakufu is no exception.
-
At the risk of coming off as a jackass:
Why ask when you can easily test this yourself?
-
It's nearly always NOT then AND then OR. I'm sure Danmakufu is no exception.
I remember encountering this one time where AND worked with same priority as OR. It was like (x || y || z && a) and worked exactly like (x || y || z) && a for some reason. Though i've neved done any investigations to prove or deny this.
-
Shell scripting, for one, I think is leftright in terms of logic. Most languages have priorities, but I'd imagine contexts where syntax is parsed on the fly it reads left to right. However, due to how logical OR works, that statement seems to be equivalent to (z && a). OR doesn't take priority, so it should just continue regardless of the results of x and y. This is why AND usually takes priority in the first place. In this case, (x || y || z && a) would test x, then regardless of return value it would test y, then regardless it would test z, then if z returned true it would test a, and if a returned true then the statement would execute. If everything's kept at the same priority I'm not sure how your situation would have worked.
-
Shell scripting, for one, I think is leftright in terms of logic. Most languages have priorities, but I'd imagine contexts where syntax is parsed on the fly it reads left to right. However, due to how logical OR works, that statement seems to be equivalent to (z && a). OR doesn't take priority, so it should just continue regardless of the results of x and y. This is why AND usually takes priority in the first place. In this case, (x || y || z && a) would test x, then regardless of return value it would test y, then regardless it would test z, then if z returned true it would test a, and if a returned true then the statement would execute. If everything's kept at the same priority I'm not sure how your situation would have worked.
I should do some tests to see what actually happens with different statement layouts. As for mine issue, at first i had something like if(x || y || z) and then i wanted it to perform if only like a is true. So i actually wanted it to be something like if((x || y || z)&&a) but instead i wrote it like if(x || y || z && a) and it worked the same way.
Ah. Found it. That one in inner brackets.
if(GetEnemyInfo(id,ENEMY_LIFE) && GetEnemyInfo(id,ENEMY_LIFE)!=666666 && !(id==laseraims[0] || id==laseraims[1] || id==laseraims[2] || id==laseraims[3] && GetEnemyNum-GetCommonData("dummies") > num))
It executed with every id==laseraims not only the last one.
Oh. Here some test that does same shit http://pastebin.com/EmKGTJbK The blue one shouldn't been shot considering your logic, right?
Also, just added to it
if(true || false || false && false){CreateShot01(GetX,GetY,3,90,PURPLE03,0);}And guess what happens?
-
Here's a bit of weird question, I saw that Shoot the Bullet mechanics are possible in danmakufu but what about the Fairy Wars mechanics? Iv'e been thinking of some fun Fairy Wars patterns that are meant to be frozen rather than 100% dodging. My current project's world also includes Yetis in the canon which works well with the freezing gimmick, and I have some potential boss characters planned for essentially a short side project for when I'm stumped on my actual project.
My theory is that even if Danmakufu has available tools for making a player with the danmaku freezing mechanic, that it might be too much for it to handle, and might lag during more intensive freezes.
But I just wanted to know what the higher ups thought, if they tackled or even succeeded making a character with a danmaku freezer a-la Fairy Wars.
Looking forward to hearing from you guys.
-
It's possible in the exact same way that an StB system is, but you basically need to script up the whole system and it's very likely that it'll lag DNH to hell because of its object management. It lags when ZUN codes it from scratch, so it's almost certain that it'll lag DNH.
-
It's possible in the exact same way that an StB system is, but you basically need to script up the whole system and it's very likely that it'll lag DNH to hell because of its object management. It lags when ZUN codes it from scratch, so it's almost certain that it'll lag DNH.
Yeah a thoery I had would be to have the ice dissapear as it chains, so there would be a limit, but this would make the ice significantly more challenging to use on patterns that depends on using the ice specifically as a shield rather than getting rid of walls and lines...I dunno, really wanting to execute this side game XD
-
Danmaku freezing is possible to do in danmakufu, but it's mostly not about player's script, but the patterns themselves. You cant create some "universal Cirno" player wich can freeze every danmaku script. If you wanna make a full game from it, you should start from coding object bullets wich can be freezed.
-
I haven't tested this myself, but object management and such should be a lot easier and a lot faster on ph3. If you want to try something that complicated, I'd advise you to start learning the newer version.
-
Plus, you can actually get all the bullet objects on the screen in ph3 with the GetShotIdInCircle functions, IIRC.
-
Plus, you can actually get all the bullet objects on the screen in ph3 with the GetShotIdInCircle functions, IIRC.
Oh what! you can? Ive been missing out aparently! this side game might be in the new version while my current project will remain in the old version, speaking of which I really need to finish prepping that demo...
-
I have a few questions here:
Is it possible to "ALPHA blend" the lasers instead of "ADD blend" it?
How do you make the spellcard background look like Mamizou/Kyoukou's background...as in the picture seems to come out from a point. For example, Mamizou's background has those bird-like things coming out from the moon.
-
I have a few questions here:
Is it possible to "ALPHA blend" the lasers instead of "ADD blend" it?
How do you make the spellcard background look like Mamizou/Kyoukou's background...as in the picture seems to come out from a point. For example, Mamizou's background has those bird-like things coming out from the moon.
I'm still working on those types of backgrounds too, I tried making one using danmakufu's effect objects, I got close a couple of times bit it always looks very off. But I know it's done with effect objects, it's the only way I know of to distort image files in danmakufu. I'd post some kind of example if mine worked~ XD
-
I'm still working on those types of backgrounds too, I tried making one using danmakufu's effect objects, I got close a couple of times bit it always looks very off. But I know it's done with effect objects, it's the only way I know of to distort image files in danmakufu. I'd post some kind of example if mine worked~ XD
I thought of making the picture scale bigger and bigger and fade off, then add the same picture with 0 scale, then repeat the process, but it will look kind of untidy... :X
-
I feel really bad about asking this question because it's something that should be really basic, I actualy read several tutorials for this but no matter what nothing works.
I'm trying get my stage script to limit the use of the two protagonists of my game, so I wrote down #PLAYER[.\Player\Player.txt] where it should go, but gives me an error each time, I tried with the full path, I tried with the same kind of path as the tutorials, but it keeps doing the same thing, it tells me the player script isnt in the Script folder, because it's not, it's in the Player folder, which is outside the script folder, where it should be right?
I just wonder what others did different ><
-
Hey everyone, just registered to ask a couple questions:
1. Is it possible for me to use snippets of a SFX file with different voices? (I got a voice pack I found with the voices seperated. I don't wanna have to cut it all apart, seeing as it takes hours).
2. Any possible way to make the character say something when they die and respawn?
Thanks in advance :D.
-
#Player[..playerpathplayer.txt] will work
-
Is it possible to "ALPHA blend" the lasers instead of "ADD blend" it?
Only if you draw and it yourself, i.e. you aren't using the included laser functions.
How do you make the spellcard background look like Mamizou/Kyoukou's background...as in the picture seems to come out from a point. For example, Mamizou's background has those bird-like things coming out from the moon.
I'd guess it's a rectangular image (it is rectangular btw) that's warped around (strip) to make a ring, and is just expanded outwards. If you actually had a circle image all you could really do is make it bigger, so that's probably it.
-
So I'm trying to get a code framework in place to put stage backgrounds into my current project. However, something isn't working.
Code (http://pastebin.com/x72k4MN1)
Then, when I run the code, it looks like this:
(http://i.imgur.com/XIVjv.png)
I know that ".\bg.png" is legitimate, because I'm using it under #Image, and it shows up there, but all I get in execution is a black void. Is there a step I'm missing here?
-
Use GetCurrentScriptDirectory. When you use .\ in a header it links relative to the file's directory, but inside script_enemy the path defaults to danmakufu's script directory. I'd imagine it's looking for script\bg.png currently.
-
How do you make an object bullet/laser move in a certain angle only with the command Obj_SetPosition(obj,x,y); ? For example, I want the base of the object laser to follow the player with the speed of 1 pixel per second. Another example is that I wish to create 6 object lasers in 6 different directions.
-
How do you make an object bullet/laser move in a certain angle only with the command Obj_SetPosition(obj,x,y); ? For example, I want the base of the object laser to follow the player with the speed of 1 pixel per second. Another example is that I wish to create 6 object lasers in 6 different directions.
I asked the same question a time ago. Lasers can only be moved with Obj_SetPosition like this
task lazor(x0,y0,ang,speed){
let obj=Obj_Create(OBJ_LASER);
//some laser setup goes here
Obj_SetPosition(obj,x0,y0);
Obj_SetAngle(obj,ang);
let count=0;
while(!Obj_Bedeleted(obj)){
Obj_SetPosition(obj,x0+cos(ang)*count*speed,y0+sin(ang)*count*speed);
count++;
yield;
}
}This will move laser straight in a given direction. You may control angle and speed from a task for some fancy movements.
-
Use GetCurrentScriptDirectory. When you use .\ in a header it links relative to the file's directory, but inside script_enemy the path defaults to danmakufu's script directory. I'd imagine it's looking for script\bg.png currently.
Yup, that was it. Thanks, everything's looking good now.
-
I'm trying to learn how to use Danmakufu, and I read the tutorials. Heck, I even learned a bit of Java!
But still, I am completely lost.
Thanks to some analysis (and copying) of the samples included with the game, I can get a simple stage to work.
-
Which tutorials did you read? Was there anything unclear? Maybe watching the video tutorials (http://www.shrinemaiden.org/forum/index.php/topic,2852.0.html) may help you more.
-
Before I answer your question, just know that questions like these belong in the Q/A thread, located here (http://www.shrinemaiden.org/forum/index.php/topic,9281.0.html). Next time you have a question, be sure to post there instead of a new topic.
1. Is it possible for me to use snippets of a SFX file with different voices? (I got a voice pack I found with the voices seperated. I don't wanna have to cut it all apart, seeing as it takes hours).[quote
No, unfortunately the only way to play sound effects is with PlaySE which always plays the file from the beginning. StopSE could be used to stop the sound effect before it reached the next sound in the file, but you still wouldn't have any way to play any sounds other than the first on on the file without playing the ones before it. You have no choice but to make each sound a separate file. Exactly how many voices are on the file that will make it take hours to separate anyway?
2. Any possible way to make the character say something when they die and respawn?
Yes, you should be able to do that by simply adding PlaySE to the @Missed portion of the player script. Just be aware that that segment loops for as long as the player is dead and respawning so if you just stick it there with no other activation condition, it will loop every frame until the player completely respawns. Also know that @Missed is called when the player is hit, even if they deathbomb. I don't really know what you could do to avoid accidentally playing the sound effect on deathbombs that, but perhaps someone else here knows.
-
The way I would do it is to set flags in @MainLoop and @Missed because they don't run at the same time:
let dFlag=0;
@MainLoop{
if(dFlag==75){ PlaySE(se_respawn); }
dFlag=0;
}
@Missed{
if(dFlag<GetRebirthFrame){ dFlag++; }
else if(dFlag==GetRebirthFrame){ PlaySE(se_death); dFlag=75;}
}
1. Using 75 is simply because regardless of how high your counterbomb period is, @Missed only runs for 75 frames)
2. GetRebirthFrame gets your available deathbomb window, in number of frames (it varies depending if you've already deathbombed, etc)
Or throw it in a task and run it at @Init:
task dTask{
let dFlag=0;
loop{
if(OnMissed){
if(dFlag<GetRebirthFrame){ dFlag++; }
else if(dFlag==GetRebirthFrame){ PlaySE(se_death); dFlag=75;}
}else{
if(dFlag==75){ PlaySE(se_respawn); }
dFlag=0;
}
yield;
}
}
@Initialize{
dTask;
}
@MainLoop{
yield;
}
@Missed{
yield;
}
-
Video tutorials? Thanks! Also, I finally managed to make a basic spell card!
Any advice for how to improve? My only problem right now is that I can't get my background to work.
http://pastebin.com/3JtapP6P
Large code goes in Pastebin -Hele
-
Please use pastebin (http://pastebin.com/) when posting large segments of code.
Also get rid of the quotes in the BackGround declaration.
EDIT: Wait you're using ph3. You're in the wrong thread, man. (http://www.shrinemaiden.org/forum/index.php/topic,10181.0.html) It says it in thread title, come on.
#BackGround no longer takes the same arguments as in 0.12. It now links to a background script that you create separately. If you want a simple scrolling background, learn to use the @BackGround loop.
-
Oh? I tried to start a new topic, but when the post was "mod-approved", they moved the it here.
-
So I'm working on my stage 4 boss which is a battle against two characters at once, and here's how it's done: I have a nonexistant boss who acts as the referee basically while two child scripts manage the two bosses. But now I'm wondering how do I get the health of the main boss enemy, the one who isnt doing anything, to drop when either one of the child scripts get hit, hit boss_A the main script takes damage, hit boss_B, the main script takes damage.
Tried several methods but no success thus far. ><
-
So I'm working on my stage 4 boss which is a battle against two characters at once, and here's how it's done: I have a nonexistant boss who acts as the referee basically while two child scripts manage the two bosses. But now I'm wondering how do I get the health of the main boss enemy, the one who isnt doing anything, to drop when either one of the child scripts get hit, hit boss_A the main script takes damage, hit boss_B, the main script takes damage.
Tried several methods but no success thus far. ><
SetDamageRateEx may work. Called in the child enemy's script, this function lets you set damage rate values for the damage done to the child boss and damage transferred from the child to the main boss. It works just like SetDamageRate, only it has 2 extra parameters which set the damage rate for damage given to the main boss.
SetDamageRateEx(0,0,<damage rate from normal shots>, <damage rate from bombs>);
Calling this function with the first 2 parameters as 0 and the second 2 parameters as something else should transfer all of the damage done to the child enemies to the main boss.
-
SetDamageRateEx may work. Called in the child enemy's script, this function lets you set damage rate values for the damage done to the child boss and damage transferred from the child to the main boss. It works just like SetDamageRate, only it has 2 extra parameters which set the damage rate for damage given to the main boss.
SetDamageRateEx(0,0,<damage rate from normal shots>, <damage rate from bombs>);
Calling this function with the first 2 parameters as 0 and the second 2 parameters as something else should transfer all of the damage done to the child enemies to the main boss.
Wow! Easy fix, thanks ^^ Now I just need to find out how to deal with this next problem, when a spell ends the two bosses explode like normal enemies, I tried vanishing them at the last minute but it does the same, how can you get rid of a child enemies popping explosion?
-
Wow! Easy fix, thanks ^^ Now I just need to find out how to deal with this next problem, when a spell ends the two bosses explode like normal enemies, I tried vanishing them at the last minute but it does the same, how can you get rid of a child enemies popping explosion?
That I've never actually done myself but I think you can do it by, first off, deleting the delete the default enemy explode sound effect from memory so it won't play (if you haven't done that already). Of course that may not be an option if you're actually using that sound effect. Then I think you can make the illusion of the boss enemies sticking around by instantly creating them again at the same coordinates that it was at previously in the next boss attack. You may have to store the coordinates of the enemy in common data or something for that. Then call the the last known coordinates of the enemies from the common data and respawn the bosses at those locations in @Initialize of the next attack. It should be seamless.
Of course, there might be another way with VanishEnemy, but I don't know of it.
-
So I'm having a problem with the FadeOutMusic function - specifically, the problem that it doesn't work. No matter what I put for the frames to fade, the music just cuts out immediately.
Has anyone ever gotten this function to work like it's supposed to?
-
That's not in frames, it's more like "quickness of fade". 1 gives the slowest fade-out, higher numbers make it quicker.
-
That's not in frames, it's more like "quickness of fade". 1 gives the slowest fade-out, higher numbers make it quicker.
That... would explain a lot, actually. So when I'm putting FadeOutMusic(Song1A, 240), it IS fading, just so fast that it might as well be an instant cut.
-
One question. Might be stupid, but how to use a font at danmakufu?
-
One question. Might be stupid, but how to use a font at danmakufu?
I do not believe that version 0.12m supports alternate fonts. If you want to use other types of text, then unfortunately you are going to have to use effect objects to make them. I think that Ph3 supports additional fonts though I'm not completely sure.
-
Here again, but with a new request. I wanted to make a script w/ Yukari (almost done) and one for Koishi. The problem is, I want Koishi to sway like she does ingame. I can't have my Koishi without swaying D:. She looks stupid without it. Help please >.<!
EDIT: I also want her to throw her hands up like she does when she attacks. Thanks :D. And could someone also tell me (and I need this really bad) why when I make a shot fire shots from it and then delete the initial shot, random shots come from the top-left of the screen. It lags danmakufu horribly...
-
You mean you want her to be animated? Maybe this would help you:
http://www.shrinemaiden.org/forum/index.php/topic,4711.0.html
Also, for the lag part, That depends on how fast your computer is( I think... ). If your computer is slow, try to delete junk stuff( NOT SYSTEM32!! ). If it's a fast computer, then maybe you ascent bullets too much, or spawn them too slow. Sorry I could not be much help.
-
OK, I got the image working but my swaying looks too...rough. i looked at the way Nue sways and it looks believable but mine doesn't. I CAN'T HAVE MY LOLI WITHOUT SWAYING >.<! It's like Suwako without her hat D:!
EDIT: Heres the code if anyone can help.
http://pastebin.com/x1ENNBwk
MOAR EDITS: Nvm has another problem. When I make her move, she moves, but she cant move after that. any suggestions on how to fix? (i'll update link w/ new code).
-
And could someone also tell me (and I need this really bad) why when I make a shot fire shots from it and then delete the initial shot, random shots come from the top-left of the screen. It lags danmakufu horribly...
I'm not quite sure what you mean, perhaps you can pastebin your code so we can take a look?
-
I already emptied that code, seeing as it became way too hard how it was turning out anyways. Rotating stars + those walls (even if they woudlve been fixed) + a narrow line to get through + the boss moving around = way too hard of a spell. I made it a lot more simpler. XD. But in the future, it'd be nice to know how it happens and how to prevent it. It happens when i do something along the lines of...
task Bullet(x,y,v,angle,graphic,delay){
object crap goes here...
wait(60);
loop(8){
CreateShot01(get object position X, get object position Y, speed, dir , graphic, delay); dir+=360/8; dir++;
yield;
}
i couldn't remember if i added dir++; or not. Could you tell me the results if I did/didn't?
Now, it usually works first few times, but they come from the top-left of screen as well. to the point where i have to close danmakufu after about 5 waves of these.
-
You shouldn't be using dir++; if you're already increasing dir, what you have there is just dir += (360/8)+1;. Also, the information you omitted is exactly the information that we wanted to know, so uh, try typing out the script again.
-
mmm i see. well what information do you need? ive got the basic object bullet setupd if you need that :l.
-
Yeah. It's likely that the problem is either the original object position, or how you're getting said position.
-
ah i see. Well hold on.
task Bullet(x,y,v,angle,graphic,delay){
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, x, y);
Obj_SetAngle(obj, angle);
Obj_SetSpeed(obj, v);
ObjShot_SetGraphic(obj, graphic);
ObjShot_SetDelay (obj, 0);
ObjShot_SetBombResist (obj, true);
this is what i use. i dont change anything at all, but someone said i needed to delete the child bullets. any idea on how i could do that?
-
The problem is that if you're getting the first object's position when firing the child bullets, and you delete the first object, it's going to default to 0,0.
Instead,
task Bullet(x,y,v,angle,graphic,delay){
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, x, y);
Obj_SetAngle(obj, angle);
Obj_SetSpeed(obj, v);
ObjShot_SetGraphic(obj, graphic);
ObjShot_SetDelay (obj, 0);
ObjShot_SetBombResist (obj, true);
let ox = Obj_GetX(obj);
let oy = Obj_GetY(obj);
let dir = #;
wait(60);
loop(8){
CreateShot01(ox, oy, # , dir , # , # );
dir+=360/8;
}
}
As you can see, even if the first bullet is deleted for some reason, ox and oy still exist to reference. I'm still only guessing what you were doing before though, and this doesn't seem like it would cause the problem by itself unless you were deleting the first bullet before firing the rest for whatever reason. I can only really assume this is right until you run into the problem again.
-
Thanks! ill try this and hope it works!
-
There's something wrong with a task I made, and I know what it is, but I don't know how to solve it.
Here's a simplified version that emulates the problem:
task Boolat(xpos,ypos,speed,angle){
let frame=0;
let red=Obj_Create(OBJ_SHOT);
Obj_SetPosition(red,xpos,ypos);
Obj_SetAngle(red,angle);
Obj_SetSpeed(red,speed);
ObjShot_SetGraphic(red,RED02);
while(!Obj_BeDeleted(red)){
if(frame==60){
let blue=Obj_Create(OBJ_SHOT);
Obj_SetPosition(blue,Obj_GetX(red),Obj_GetY(red));
Obj_SetAngle(blue,angle+40);
Obj_SetSpeed(blue,1);
ObjShot_SetGraphic(blue,BLUE01);
while(!Obj_BeDeleted(blue)){
if(Obj_GetX(blue)<=minx){
Obj_SetAngle(blue,180-Obj_GetAngle(blue));
Obj_SetX(blue,minx);
}
if(Obj_GetX(blue)>=maxx){
Obj_SetAngle(blue,180-Obj_GetAngle(blue));
Obj_SetX(blue,maxx);
}
wait(1);
}
}
Obj_SetAngle(red,angle+(frame*3));
frame++;
wait(1);
}
}
The RED02 bullet has to spin around, and the BLUE01 bullet has to bounce off the screen.
60 frames after the RED02 bullet is made, a BLUE01 bullet is created on RED02's current location.
When that happens, I don't want it to, but RED02 stop spinning, and the script only pays attention to BLUE01, which will bounce off the edges of the screen.
I know that's because there are two "while" statements inside each other, but how do I make them independent from each other, so the RED02 bullet will keep on spinning, and the BLUE01 bullet appears on RED02's location and will still bounce?
This is just an example, in reality I want to make the player's familiars shoot bouncing bullets, but the same thing goes wrong (the familiars that shoot bouncing bullets get stuck in place until said bullets are deleted)
Also, Danmakufu crashes if you forget to write ObjShot_SetGraphic *near-ragequit*
-
I know that's because there are two "while" statements inside each other, but how do I make them independent from each other, so the RED02 bullet will keep on spinning, and the BLUE01 bullet appears on RED02's location and will still bounce?
This is just an example, in reality I want to make the player's familiars shoot bouncing bullets, but the same thing goes wrong (the familiars that shoot bouncing bullets get stuck in place until said bullets are deleted)
Also, Danmakufu crashes if you forget to write ObjShot_SetGraphic *near-ragequit*
Better create a common tasks for all bullet types you have so you can call one from another to run them simultaneously. You can adjust the inner while if you want too, but that's the wrong way ;)
-
Better create a common tasks for all bullet types you have so you can call one from another to run them simultaneously. You can adjust the inner while if you want too, but that's the wrong way ;)
But if I make them into two tasks, I can't write Obj_SetPosition(blue,Obj_GetX(red),Obj_GetY(red));
That will just give me an error telling me red doesn't exist in this task.
So how can I make blue spawn on red's position?
-
But if I make them into two tasks, I can't write Obj_SetPosition(blue,Obj_GetX(red),Obj_GetY(red));
That will just give me an error telling me red doesn't exist in this task.
So how can I make blue spawn on red's position?
As i see from your script you only need to pass red's coordinates to blue once on it creation, so just make two tasks like this:
task RedBullet(x,y,spd,ang){
let red=Obj_Create(OBJ_SHOT);
let frame=0;
//bullet setup goes here
while(!Obj_BeDeleted(red)){
//do stuff
if(frame==60){BlueBullet(Obj_GetX(red),Obj_GetY(red),1,ang+40);}
frame++;
yield;
}
}
task BlueBullet(x,y,spd,ang){
}
-
As i see from your script you only need to pass red's coordinates to blue once on it creation, so just make two tasks like this:
task RedBullet(x,y,spd,ang){
let red=Obj_Create(OBJ_SHOT);
let frame=0;
//bullet setup goes here
while(!Obj_BeDeleted(red)){
//do stuff
if(frame==60){BlueBullet(Obj_GetX(red),Obj_GetY(red),1,ang+40);}
frame++;
yield;
}
}
task BlueBullet(x,y,spd,ang){
}
I see now, the blue bullet's task is still called from within the red one (At least I got that right).
But was trying to call red's x and y from inside the blue bullet's task, and that didn't work as expected.
Thanks, that solved my problems. :D I can probably also use this for some other things I had trouble with before.
-
For future reference: you could also have passed red as a parameter into blue's task, so Obj_GetX(red) would still work in the blue task. That's not needed in this case, though.
-
Ok. So I've been having this problem... I made this stage boss, and everytime I make a replay of him, it has some kind of bug like the one from SA (when you reach utsuho and she kills you even through you beat her). I don't know why this happens :S. I wonder if someone here knows why this happens. Ty
-
Danmakufu sucks at recording replays? I dunno, I can't give a much better explanation than that.
-
A few things can cause that. Replays only save your input and the random number seed, so if there's anything that's not determined by that, it will mess up. For example, using GetTime.
-
On some of my more complicated scripts, I've seen replays desync as well and I don't really have any good explanation for that. Saving just the inputs and random seed should work for all my scripts, but it doesn't a lot of the time.