#TouhouDanmakufu
#Title[Marksman]
#Text[Prybetier has been gaming too much...]
#PlayLevel[Oni]
#BackGround[User(\script\Slackin\GapBridge.png, 0, 0)]
#BGM[\script\Slackin\Necrofantasia.mp3]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main {
let frame = 0;
@Initialize {
SetLife(1000);
SetEnemyMarker(true);
MagicCircle(true);
SetDamageRate(30, 10);
SetTimer(60);
SetInvincibility(20);
}
@MainLoop {
SetCollisionA(220, 120, 32);
SetCollisionB(220, 120, 24);
if(frame==60){
CreateLaser01(GetX, GetY, 2.5, GetAngleToPlayer, 100, 10, WHITE02, 5);
CreateLaser01(GetX, GetY, 2.5, GetAngleToPlayer, 100, 10, YELLOW02, 15);
CreateLaser01(GetX, GetY, 2.5, GetAngleToPlayer+40, 100, 10, WHITE02, 5);
CreateLaser01(GetX, GetY, 2.5, GetAngleToPlayer+40, 100, 10, YELLOW02, 15);
CreateLaser01(GetX, GetY, 2.5, GetAngleToPlayer-40, 100, 10, WHITE02, 5);
CreateLaser01(GetX, GetY, 2.5, GetAngleToPlayer-40, 100, 10, YELLOW02, 15);
CreateLaser01(GetX, GetY, 2.5, GetAngleToPlayer+15, 100, 10, WHITE02, 5);
CreateLaser01(GetX, GetY, 2.5, GetAngleToPlayer+15, 100, 10, YELLOW02, 15);
CreateLaser01(GetX, GetY, 2.5, GetAngleToPlayer-15, 100, 10, WHITE02, 5);
CreateLaser01(GetX, GetY, 2.5, GetAngleToPlayer-15, 100, 10, YELLOW02, 15);
CreateLaser01(GetX, GetY, 5, GetAngleToPlayer, 100, 8, ORANGE02, 5);
CreateLaser01(GetX, GetY, 5, GetAngleToPlayer, 100, 8, RED02, 10);
CreateLaser01(GetX, GetY, 5, GetAngleToPlayer+3, 100, 8, ORANGE02, 5);
CreateLaser01(GetX, GetY, 5, GetAngleToPlayer+3, 100, 8, RED02, 10);
CreateLaser01(GetX, GetY, 5, GetAngleToPlayer-3, 100, 8, ORANGE02, 5);
CreateLaser01(GetX, GetY, 5, GetAngleToPlayer-3, 100, 8, RED02, 10);
CreateLaser01(GetX, GetY, 10, GetAngleToPlayer, 100, 5, BLUE02, 5);
CreateLaser01(GetX, GetY, 10, GetAngleToPlayer, 100, 5, PURPLE02, 8);
CreateLaser01(GetX, GetY, 6.5, GetAngleToPlayer+2, 100, 7, AQUA02, 5);
CreateLaser01(GetX, GetY, 6.5, GetAngleToPlayer+2, 100, 7, GREEN02, 10);
CreateLaser01(GetX, GetY, 6.5, GetAngleToPlayer-2, 100, 7, AQUA02, 5);
CreateLaser01(GetX, GetY, 6.5, GetAngleToPlayer-2, 100, 7, GREEN02, 10);
frame = 30;
}
frame++;
}
@DrawLoop {
}
@Finalize {
}
}
Yes. Because you didn't tell the boss to move somewhere, the lasers get spawned outside of the playing field where they get deleted instantly.
Just put SetMovePosition02(GetCenterX, 128, 30); or something into your @Initialize.
let time = 60;
if(frame==time){do stuff; time--;}
if(time<21){time=20;}
ascent(i in 1..6){ CreateShot01(GetX, GetY, i/2, GetAngleToPlayer, RED21, 0); }
ascent(i in 0..10){Stuff;}
let i = 0;
while(i<10)
{
Stuff;
i++;
}
ascent(i in 0..5){CreateShot01(GetX,GetY,1+i,GetAngleToPlayer,RED01,10);} //A line of 5 bullets.
ascent(i in -2..3){CreateShot01(GetX,GetY,1,GetAngleToPlayer+i*5,RED01,10);} //A wall of 5 bullets.
ascent(i in 0..18){CreateShot01(GetX,GetY,1,GetAngleToPlayer+i*20,RED01,10);} //A ring of 18 bullets.
Is there any trick to getting music to loop right? It has something to do with the file length, but I'm lost on the specifics. Worst case scenario I can just loop everything twice then fade out, but I'd like to not have double the filesize if I can prevent it...
Is there any trick to getting music to loop right? It has something to do with the file length, but I'm lost on the specifics.That is only on the sound effects, not on music. (assuming you are not trying to load music with playSE.) (( Unless I am missing the point then you can ignore this ))
If you find a music file that loops perfectly in DMF, link it here so I can examine it a bit...
script_enemy_main {
#include_function ".\function_cutin.txt";
LoadUserShotData("stuff\supershot_v4.1\supershot.txt");
let frame=0;
let cut="script\tutorial\Nazrin.png";
@Initialize {
LoadGraphic(cut);
cutin("NAZRIN","sc",cut,0,0,291,472);
@Initialize {
SetLife(1000);
SetTimer(320);
SetScore(10000000);
SetMovePosition01(GetCenterX,GetCenterY,5);
LoadGraphic(imgBoss);
LoadGraphic(cut);
LoadGraphic(bg);
CutIn(YOUMU,"Red icicle - Fail -",cut,0,0,300,384);
mainTask;
}
@Initialize {
SetLife(1000);
SetTimer(320);
SetScore(10000000);
SetMovePosition01(GetCenterX,GetCenterY,5);
LoadGraphic(imgBoss);
LoadGraphic(cut);
LoadGraphic(bg);
CutIn(YOUMU,"Red icicle - Fail -",cut,0,0,300,384);
}
// main task, activates stuff
task mainTask; {
yield;
fire;
movement;
}
Sacchi - Danmakufu crashes because of most likely an infinate loop. try putting : loop(1){yield;} in each task, fire and movement.No. That is not how it's done...
Here it is: http://www.pastebin.org/360788Ok, just as I expected. The Cutin function (regular or my custom) can only be seen if the card is a spell card. A spell card is triggered in Danmakufu by setting a score: SetScore(value);
Alrighty Then,here it is:
http://www.pastebin.org/360831 (http://www.pastebin.org/360831)
I wonder...what happens to the graphics that you don't delete? Are they deleted anyway? Lets say that perhaps you forgot to put DeleteGraphic(what ev); in Finalize, would that cause the image to remain there forever?I believe it stays loaded into memory until you close danmakufu or at least until you reach the main menu again, wasting processing power.
task fire{
superbullet(GetEnemyX,GetEnemyY,3,GetAngleToPlayer,Aqua01,30);
superbullet(GetEnemyX,GetEnemyY,3,GetAngleToPlayer-20,Aqua01,30);
superbullet(GetEnemyX,GetEnemyY,3,GetAngleToPlayer+20,Aqua01,30);
}
}
task fire{
loop{
superbullet(GetEnemyX,GetEnemyY,3,GetAngleToPlayer,Aqua01,30);
superbullet(GetEnemyX,GetEnemyY,3,GetAngleToPlayer-20,Aqua01,30);
superbullet(GetEnemyX,GetEnemyY,3,GetAngleToPlayer+20,Aqua01,30);
wait(20);
}
}
Thanks a lot Hele. That worked like a charm :)
Oh, another thing. Why is the score displayed in-game always approx. three times the number I used in SetScore() ? For example, SetScore(2000000) gave a random number between 6000000 and 6027997. And shooting the enemy increases the number unless SetTimer() is also included :/
I thought I messed up my code somewhere, but it happened to this piece (http://www.shrinemaiden.org/forum/index.php?topic=30.msg178#msg178) as well.
delta+=angv;
if(speedtime>5){ speedtime--; }
SetMovePosition02(GetPlayerX+rad*cos(delta), GetPlayerY+rad*sin(delta), speedtime);
script_enemy starFam{
let CSD = GetCurrentScriptDirectory;
let imgFam = CSD ~ "system\familiar.png";
let dir = 0;
let r = 100;
let famAngle = GetArgument;
let spin = 0;
@Initialize{
SetLife(2000);
SetDamageRateEx(1,1,30,20);
LoadGraphic(imgFam);
mainTask;
}
@MainLoop{
SetCollisionA(GetX,GetY,16);
SetCollisionB(GetX,GetY,16);
yield;
}
@DrawLoop{
SetTexture(imgFam);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(0.3,0.3);
SetGraphicAngle(spin,0,0);
SetGraphicRect(0,0,128,128);
DrawGraphic(GetX,GetY);
SetTexture(imgFam);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(0.3,0.3);
SetGraphicAngle(0,spin,0);
SetGraphicRect(0,0,128,128);
DrawGraphic(GetX,GetY);
spin-=3;
}
@Finalize{
DeleteGraphic(imgFam);
}
task mainTask{
yield;
movement;
wait(60);
fire;
}
task movement{
loop{
SetMovePosition03(GetEnemyX+r*cos(dir+famAngle),GetEnemyY+r*sin(dir+famAngle),20,10);
dir++;
yield;
}
}
task fire{
loop{
CreateShot01(Obj_GetX(starFam),Obj_GetY(starFam),3,0,PURPLE23,10);
CreateShot01(Obj_GetX(starFam),Obj_GetY(starFam),3,72,PURPLE23,10);
CreateShot01(Obj_GetX(starFam),Obj_GetY(starFam),3,144,PURPLE23,10);
CreateShot01(Obj_GetX(starFam),Obj_GetY(starFam),3,216,PURPLE23,10);
CreateShot01(Obj_GetX(starFam),Obj_GetY(starFam),3,288,PURPLE23,10);
wait(10);
yield;
}
}
task lazor(x,y,v,dir,length,width,graphic,delay){
let lobj = Obj_Create(OBJ_LASER);
Obj_SetPosition(lobj,x,y);
Obj_SetSpeed(lobj,v);
Obj_SetAngle(lobj,dir);
ObjLaser_SetLength(lobj,length);
ObjLaser_SetWidth(lobj,width);
ObjShot_SetGraphic(lobj,graphic);
ObjShot_SetDelay(lobj,delay);
ObjLaser_SetSource(lobj,true);
}
}
Mmmm, where to start from?
I've various problems with danmakufu and I'd like you to help me if you can, please.
1) BGM -> I've found me totally unable to put a damn bgm into the game. I've tried LoadMusic & PlayMusic, the #BGM at the start of the script, and even attempted to play it like a SE in the mainTask (when I went mad about it). Please help me stop my headache.
2) Delete Bullets after a time -> I've attempted to make a "spellcard" (not sure if "that" deserves to be called spellcard) that make the enemy to follow the player, while shooting "bombs" of bullets that explode and then form swirls of bullets, but these swirls don't disappear so after escaping the enemy for a while the screen is filled with bullets and it's impossible to dodge. I don't know if it's possible to make bullets disappear after a time.
3) Make the familiars shoot -> Well, this is what's making me rage the most. I can't make the familiar shoot. I've tried GetEnemyX-Y, Obj_GetX-Y(starFam) (being starFam the name of the familiar script) but I keep receiving error messages THAT TELL ME THE MISTAKE IS IN THE WAIT FUNCTION, WTF. Here is the script if it can help...Code: [Select]bunch of code
Ignore the lazor task because I'm not using it in the fire task.
4) Shot replacement -> I've tried to do it and miserably failed. U_U
Please forgive my ignorance, and my poor english.
I've solved the familiars' problem, thank you very much.( '.')b
My failure with the shot replacement was not declaring the ShotData variable ^^U. By the way, can I use the standard bullets while having the shot replacement? (I mean mix both bullets in a same spellcard). Ah, I guess I've to declare again the ShotData and LoadUserShotData in the familiar script, right?Afaik, shot data is somehow shared between both the familiar and the boss. You just need to load it in the main section.
And with DeleteEnemyShot (It's CreateShotA so I suppose it has to be with that one), I've no idea of how it works.
There is a huge difference between shotreplacement and shotsheet. Read it here in the FAQ (http://www.shrinemaiden.org/forum/index.php?topic=6181.msg345024#msg345024) (click to read)
Well, I didn't remember that ^^U
And with the DeleteEnemyShot, I've already read the wiki when I asked, but the wiki says 1 parameter and is the type of bullet. What I want is erasing the bullets after a while, what I don't know how to do with a function that doesn't have a time parameter.
#TouhouDanmakufu
#Title[1]
#Text[1]
#Player[FREE]
#ScriptVersion[2]
#BGM[]
#PlayLevel[Normal]
script_enemy_main{
let SupaShot = GetCurrentScriptDirectory~"\c6shots.txt";
let BossImage = GetCurrentScriptDirectory~"\enem1.png";
let frame = 0;
let angle = 0;
let move = 0;
let s = 0;
@Initialize{
LoadGraphic(BossImage);
LoadUserShotData(SupaShot);
SetLife(2500);
SetTimer(60);
SetInvincibility(30);
Concentration01(100);
MagicCircle(true);
SetMovePosition02(GetCenterX, GetCenterY - 100, 120); //Move the boss to the top center of the screen.
}
@MainLoop{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
frame++;
omg++;
move++;
if(frame==100){
function wow;
frame = 0;
}
if(move== 500){
SetMovePosition03(rand(100,400), 200, 5, 5);
move = 0;
}
yield;
}
@DrawLoop {
SetTexture(BossImage);
SetGraphicRect(0,0,100,100);
DrawGraphic(GetX, GetY);
DrawText("I'm a boss", 50, 50, 12, 255);
}
@Finalize {
}
task Bullet(x, y, v, angle) {
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, x, y);
Obj_SetAngle(obj, angle);
Obj_SetSpeed(obj, v);
ObjShot_SetGraphic(obj, RED01);
ObjShot_SetDelay (obj, 0);
ObjShot_SetBombResist (obj, true);
while(Obj_BeDeleted(obj)==false) {
if(Obj_GetX(obj)<GetClipMinX) {
Obj_SetAngle(obj, 180 - Obj_GetAngle(obj) );
Obj_SetX(obj, Obj_GetX(obj) + 0.1);
}
if(Obj_GetX(obj)>GetClipMaxX) {
Obj_SetAngle(obj, 180 - Obj_GetAngle(obj) );
Obj_SetX(obj, Obj_GetX(obj) - 0.1);
}
yield;
}
}
function wow(x, y){
ascent(i in 0..10){
ascent(k in 0..6){
Bullet(x, y, 0.5*(1+k), i*40);
}
}
}
}
function wow;
when it's supposed to be like thiswow;
if(Obj_GetY(obj)<GetClipMinY) {
Obj_SetAngle(obj, 0 - Obj_GetAngle(obj) );
Obj_SetY(obj, Obj_GetY(obj) + 0.1);
}
omg++
function wow(x, y){
ascent(i in 0..10){
ascent(k in 0..6){
Bullet(x, y, 0.5*(1+k), i*40);
}
}
}
if(frame==100){
function wow;
frame = 0;
}
other than that... I'm too lazy to look at your code right nowThankyou for you time :)
omg++
*facepalmfunction wow(x, y){
Ohhhh I believe I remember someone a while back mentioning that you didn't need applocale to run danmakufu if you went to certain files and changed Japanese text into something else? Does anyone know what to change or if it works?
I'm trying to use danmakufu on this new computer and I don't want to have to go through the hassle of getting all that stuff to work again.
Sorry, I dunno. I've actually come here with a question of my own.
When you kill a boss familiar or just any enemy that isn't the boss, Danmakufu automatically makes that "shhk" (you know what I mean) sound. Is there any possible way I can get rid of it and replace it with another sound?EDIT: Another question. How would one go about stopping background music set using PlayMusic?
EDIT AGAIN: Forget the second. I just inserted a blank .wav file right after the song ended. I had trimmed it down to exactly 2:23, so it was relatively easy.
if (Obj_BeDeleted(CertainObject)==true){
wait(90);
CreateCertainObject();
}
work if I'd never created a CertainObject before?
let timer = 0;
while( Obj_BeDeleted(CertainObject) == false && timer >= 0){
if(timer == 90){
CreateCertainObject();
}
timer++;
}
This is how I usually do it in object bullets. This way, the timer will stop counting (and running the function inside the task) when the object is deleted, saving processing power and reducing lag.
#UserShotData
ShotImage = ".\img\Coinstrans.png"
ShotData {
id = 1
rect = (0, 0, 20, 20)
render = ALPHA
delay_color = (255, 128, 255)
angular_velocity = rand(-5, 5)
}
}
if(spawn==1){
CreateEnemyFromFile(Crystal1);
CreateEnemyFromFile(Crystal2);
}
CreateEnemyFromFile, Create a child enemy which behavior is defined in the 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
#TouhouDanmakufu
#Title[Spellcard 1]
#Text[A spellcard I made just for fun.]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "images\img1.png";
let cut = CSD ~ "images\img2.png";
let bg = CSD ~ "images\bg1.png";
let bgm = CSD ~ "sound\track.mp3";
@Initialize{
LoadUserShotData(CSD ~ "\shots\supershot.png");
SetLife(10000);
SetTimer(99);
SetScore(200000);
SetMovePosition01(GetCenterX,GetCenterY,5);
LoadGraphic(imgBoss);
LoadGraphic(cut);
LoadGraphic(bg);
LoadMusic(bgm);
PlayMusic(bgm);
CutIn(YOUMU,"XXXXXXXXXX - XXXXX",cut,0,0,300,384);
mainTask;
}
@MainLoop{
SetCollisionA(GetX,GetY,32);
SetCollisionB(GetX,GetY,16);
yield;
}
@DrawLoop{
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,300,300);
SetGraphicScale(0.25,0.25);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);
}
@BackGround{
SetTexture(bg);
SetRenderState(ALPHA);
SetAlpha(100);
SetGraphicRect(0,0,512,512);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetCenterX,GetCenterY);
}
@Finalize{
DeleteGraphic(imgBoss);
DeleteGraphic(cut);
DeleteGraphic(bg);
DeleteMusic(bgm);
}
task mainTask{
yield;
fire;
fire_laser;
fire_laser_2;
movement;
}
task movement{
loop{
SetMovePosition01(rand_int(GetCenterX-100,GetCenterX+100),rand_int(90,140),5);
wait(60);
SetMovePosition01(rand_int(GetCenterX-100,GetCenterX+100),rand_int(90,140),5);
wait(60);
yield;
}
}
task fire_laser{
loop{
CreateLaser01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer,100,10,BLUE02,0);
wait(60);
yield;
}
}
task fire_laser_2{
loop{
CreateLaser01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-10,50,8,BLUE02,0);
CreateLaser01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+10,50,8,BLUE02,0);
CreateLaser01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-15,50,8,BLUE02,0);
CreateLaser01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+15,50,8,BLUE02,0);
wait(10);
yield;
}
}
task fire{
loop{
CreateShot01(GetEnemyX,GetEnemyY,3,0,134,10);
CreateShot01(GetEnemyX,GetEnemyY,3,45,134,10);
CreateShot01(GetEnemyX,GetEnemyY,3,90,134,10);
CreateShot01(GetEnemyX,GetEnemyY,3,135,134,10);
CreateShot01(GetEnemyX,GetEnemyY,3,180,134,10);
CreateShot01(GetEnemyX,GetEnemyY,3,225,134,10);
CreateShot01(GetEnemyX,GetEnemyY,3,270,134,10);
CreateShot01(GetEnemyX,GetEnemyY,3,315,134,10);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer,AQUA01,10);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-10,AQUA01,10);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+10,AQUA01,10);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-20,AQUA01,10);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+20,AQUA01,10);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-30,AQUA01,10);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+30,AQUA01,10);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-5,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+5,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-15,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+15,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-25,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+25,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-35,AQUA01,10);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+35,AQUA01,10);
wait(30);
yield;
}
}
function wait(w){
loop(w){yield;}
}
}
Code: [Select]LoadUserShotData(CSD ~ "\shots\supershot.png");
I'm not sure if this is the only problem, but you should remove the "\" before "shots." GetCurrentScriptDirectory includes the last slash, so that would double it up and make the directory incorrect.I've modified that, but it's still not working.
Your loading an image, not a shotdataIndeed, that's what was going wrong. Many, many thanks.
Shotdata must be a .txt, you can't load a image and call it shotdata
Code: [Select]CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-5,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+5,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-15,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+15,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-25,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+25,AQUA01,20);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer-35,AQUA01,10);
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+35,AQUA01,10);
wait(30);
yield;
let i = -35;
while(i <= 35)
{
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+i,AQUA01,10);
i += 5;
}
Can replace the bunch of CreateShot01s in the quote.ascent(i in -3..4){
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+(i*10),AQUA01,10);
}
wait(10);
ascent(i in -7..8){
if( (| (i*5)%10 |) == 5 ){
CreateShot01(GetEnemyX,GetEnemyY,4,GetAngleToPlayer+(i*5),AQUA01,10);
}
}
@DrawLoop {
DrawAnimatedSprite("reimu", GetX, GetY);
DrawText("Minoriko Aki", 50, 50, 12, 255);
}
@BackGround
{
LoadGraphic(BossImage2);
SetGraphicScale(5, 5);
SetTexture(BossImage2);
SetGraphicRect( 0, 0, 256, 256 );
SetGraphicAngle(0, 0, rotation);
DrawGraphic(GetCenterX , GetCenterY );
}
@Finalize {
DeleteGraphic(BossImage2);
}
Sum more questions :]
I don't know why but why does the background and the drawloop connects to each other ?
http://s477.photobucket.com/albums/rr139/namethecool/Games/?action=view¤t=b5.pngCode: [Select]@DrawLoop {
DrawAnimatedSprite("reimu", GetX, GetY);
DrawText("Minoriko Aki", 50, 50, 12, 255);
}
@BackGround
{
LoadGraphic(BossImage2);
SetGraphicScale(5, 5);
SetTexture(BossImage2);
SetGraphicRect( 0, 0, 256, 256 );
SetGraphicAngle(0, 0, rotation);
DrawGraphic(GetCenterX , GetCenterY );
}
@Finalize {
DeleteGraphic(BossImage2);
}
And why can't you have backgrounds for non- spell cards ?Because it is Danmakufu. If you want background for non-spells, you need to work with stage scripts.
I have an idea, but it would depend on how many bullets you wanted to do the caterpiller affect too
He's using Blargel's Animation Library.
In any case, don't load the background graphic in the BG loop. Load it in Initialize.
Have you even tried resetting the values to normal during DrawLoop? SetGraphicScale(1, 1);? SetGraphicAngle(0, 0, 0);?
I tried moving LoadGraphic(BossImage2); to @Initialize and did what you said, it's still connected :/
Have you tried setting back the Angle and Scale like Drake also said?
SetGraphicScale(5, 5);
SetTexture(BossImage2);
SetGraphicRect( 0, 0, 256, 256 );
SetGraphicAngle(0, 0, rotation);
DrawGraphic(GetCenterX , GetCenterY );
SetGraphicScale(1, 1);
work?I'm trying to make a caterpillar-like effect for a chain of object bullets/effects.Eh.....
In other words, one bullet/effect will lead, and the others will follow its exact path with a set time and/or distance between them.
How would I properly code that in danmakufu? It has left me clueless!
Eh.....
Why not just use a sinuate laser...?
Wouldn't something likeCode: [Select]SetGraphicScale(5, 5);
work?
SetTexture(BossImage2);
SetGraphicRect( 0, 0, 256, 256 );
SetGraphicAngle(0, 0, rotation);
DrawGraphic(GetCenterX , GetCenterY );
SetGraphicScale(1, 1);
That way, it doesn't matter if the loops are connected or not.
Edit : Oops Drake already said it long time ago. What are you trying to achieve by making them not connect though?
Edit : Nvm thankyou all for your time helping me :)
Almost >_< the background is working now but, minoriko is still spinning even though she doesn't have rotation. Do not want them to connect because it looks weird if the boss is huge and spinning.
This is why I can't script nice things :colonveeplusalpha:
SetGraphicScale(5, 5);
SetTexture(BossImage2);
SetGraphicRect( 0, 0, 256, 256 );
SetGraphicAngle(0, 0, rotation);
DrawGraphic(GetCenterX , GetCenterY );
SetGraphicScale(1, 1);
SetGraphicAngle(0, 0, 0);
I need help on making events different depending on which character you use.
I have found the GetPlayerType function but I don't know how I would use it for
a custom player and not Reimu or Marisa.
if ((GetPlayerType == REIMU_A) || (GetPlayerType == REIMU_B))
else if ((GetPlayerType == MARISA_A) || (GetPlayerType == MARISA_B))
and if it's not reimu and it's either marisa A or marisa B then stuff happens else
{
So I got Dnamakufu 0.12m, installed East Asian language files, tried to run it with Applocale... and still it crashes on opening.
Probably running it under the wrong language? Japanese should be the very bottom option. If it doesn't work, you can switch your whole computer's locale to Japanese in the Control Panel, restart, then run Danmakufu normally. It should work fine. Switching your computer to Japanese locale will change almost nothing, so don't worry about it screwing with other programs.
EDIT: Problem solved - I had to remove the EX Rumia and player Rumia files. Thanks puremrz!Then Applocale isn't working right, because the reason Rumia crashes it and the reason Applocale fixes it is Danmakufu doesn't like scripts with moonrunes in them when running english settings.
ydist=GetPlayerY-GetY;
// get y distance between enemy and player
yratio=(GetX-GetClipMinX)/((GetX-GetClipMinX)+(GetPlayerX-GetClipMinX));
// get ratio of distance from wall for enemy and player (assuming left wall here)
ypoint=GetY+(ydist*yratio);
// apply ratio to y distance to get how far down the wall it needs to bounce
angle=atan2(GetClipMinX-GetX,ypoint-GetY);
// get the angle to that point
pointdist=((GetX-GetClipMinX)^2)+((GetY-ypoint)^2);
pointdist=pointdist^0.5;
// gets distance from enemy to that point
pointdist=floor(pointdist/2);
// divides by two for number of frames travelled, to know when to reflect (speed 2)
CreateShotA(0,GetX,GetY,0);
SetShotDataA(0,0,2,angle,0,0,0,65);
SetShotDataA(0,pointdist,2,180-angle,0,0,0,65);
FireShot(0);
[quote]
let yratio2=(GetX-GetClipMaxX)/((GetX-GetClipMaxX)+(GetPlayerX-GetClipMaxX));
let ypoint2=GetY+(ydist*yratio2);
let angle2=atan2(ypoint2-GetY,GetClipMaxX-GetX);
let pointdist2=((GetX-GetClipMaxX)^2)+((GetY-ypoint2)^2);
let pointdist2=pointdist2^0.5;
let pointdist2=floor(pointdist2/2);
USER_PLAYER, I have no idea what that does
GetPlayerScriptName works by getting the name of the player script that the player is currently using.
for example
if(GetPlayerScriptName == enter_name_of_player.txt){ SetStuff; DoStuff; Whatever;}
note, that you will need to know the name of the player script before hand.
USER_PLAYER, I have no idea what that does
How to make screen Shake :o ? Like when you use master sparkThere is a command in danmakufu that does that, but I believe it screwed up replays and various other things.
@DrawLoop {
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(0.6,0.6);
if(int(GetSpeedX())==0) {
if(f<=10) { SetGraphicRect(0,0,35,120); }
if(f>10 && f<=20) { SetGraphicRect(39,0,74,120); }
if(f>20 && f<=30) {SetGraphicRect(78,0,113,120); }
f2=0;
}
if(GetSpeedX()>0) {
if(f2<=5) { SetGraphicRect(170,0,220,120); }
if(f2>=5) { SetGraphicRect(222,0,279,120); }
f2++;
}
if(GetSpeedX()<0) {
SetGraphicAngle(180,0,0);
if(f2<=5) { SetGraphicRect(170,0,220,120);
DrawGraphic(GetEnemyX, GetEnemyY);
}
if(f2>=5) { SetGraphicRect(222,0,279,120);
DrawGraphic(GetEnemyX, GetEnemyY);
}
f2++;
}
DrawGraphic(GetX,GetY);
f++;
if(f == 30){f=0;}
}
@BackGround {
SetTexture(bg);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,500,333);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetCenterX, GetCenterY);
}
@DrawLoop {
SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(0.6,0.6);
if(int(GetSpeedX())==0) {
SetGraphicAngle(0,0,0);
if(f<=10) { SetGraphicRect(0,0,35,120); }
if(f>10 && f<=20) { SetGraphicRect(39,0,74,120); }
if(f>20 && f<=30) {SetGraphicRect(78,0,113,120); }
f2=0;
}
if(GetSpeedX()>0) {
SetGraphicAngle(0,0,0);
if(f2<=5) { SetGraphicRect(170,0,220,120); }
if(f2>=5) { SetGraphicRect(222,0,279,120); }
f2++;
}
if(GetSpeedX()<0) {
SetGraphicAngle(180,0,0);
if(f2<=5) { SetGraphicRect(170,0,220,120);
DrawGraphic(GetEnemyX, GetEnemyY);
}
if(f2>=5) { SetGraphicRect(222,0,279,120);
DrawGraphic(GetEnemyX, GetEnemyY);
}
f2++;
}
DrawGraphic(GetX,GetY);
f++;
if(f == 30){f=0;}
}
@BackGround {
SetTexture(bg);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,500,333);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetCenterX, GetCenterY);
}
There is a command in danmakufu that does that,
But why do I need to change the code in the Drawloop? Also because my script has no SetScore?
Thats pretty annoying for those who want to create their own bosses in Danmakufu :(
Damn I knew it would happen...my english sucks -.-
My last question was intended to be like this one, but I messed it up, so you understood it wrong (I don't blame you...it was my fault):
Why did I also have to change the code for the bossgraphic (not the background) in the Drawloop?
task Option(position){
let objoption=Obj_Create(OBJ_EFFECT);
Obj_SetAlpha(objoption,200);
ObjEffect_SetTexture(objoption,img_sakuya);
ObjEffect_SetRenderState(objoption,ALPHA);
ObjEffect_SetPrimitiveType(objoption,PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(objoption,4);
ObjEffect_SetVertexUV(objoption,0,145,1);
ObjEffect_SetVertexUV(objoption,1,159,1);
ObjEffect_SetVertexUV(objoption,2,159,15);
ObjEffect_SetVertexUV(objoption,3,145,15);
if(position=="LEFT"){
while(!Obj_BeDeleted(objoption)){
ObjEffect_SetVertexXY(objoption,0,GetPlayerX-optionxpos-8,GetPlayerY+optionypos-7);
ObjEffect_SetVertexXY(objoption,1,GetPlayerX-optionxpos+6,GetPlayerY+optionypos-7);
ObjEffect_SetVertexXY(objoption,2,GetPlayerX-optionxpos+6,GetPlayerY+optionypos+7);
ObjEffect_SetVertexXY(objoption,3,GetPlayerX-optionxpos-8,GetPlayerY+optionypos+7);
if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
if(count%6 == 3){
JackTheRipper(GetPlayerX-optionxpos-1,GetPlayerY+optionypos-8,12);
}
}else{
if(count%8 == 4){
i=-2;
while(i<=2){
CreatePlayerShot01(GetPlayerX()-optionxpos-1, GetPlayerY()+optionypos-8, 10, 254+(i*8), 1.5, 1, 2);
i++;
}
}
}
yield;
}
}else{
while(!Obj_BeDeleted(objoption)){
ObjEffect_SetVertexXY(objoption,0,GetPlayerX+optionxpos-7,GetPlayerY+optionypos-7);
ObjEffect_SetVertexXY(objoption,1,GetPlayerX+optionxpos+7,GetPlayerY+optionypos-7);
ObjEffect_SetVertexXY(objoption,2,GetPlayerX+optionxpos+7,GetPlayerY+optionypos+7);
ObjEffect_SetVertexXY(objoption,3,GetPlayerX+optionxpos-7,GetPlayerY+optionypos+7);
if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
if(count%6 == 3){
JackTheRipper(GetPlayerX+optionxpos,GetPlayerY+optionypos-8,12);
}
}else{
if(count%8 == 4){
i=-2;
while(i<=2){
CreatePlayerShot01(GetPlayerX()+optionxpos, GetPlayerY()+optionypos-8, 10, 286+(i*8), 1.5, 1, 2);
i++;
}
}
}
yield;
}
}
}
Stupid question: Does Obj_SetSpeed and Obj_SetAngle work for obj Effects?
ObjEffect_SetAngle changes the angle of the graphic, while Obj_SetAngle changes the angle of movement. Yes, Obj_SetSpeed works with effect objects.Thanks.
Thanks.
Now if I want my effect object to hurt the player should I use SetCollisionB or what?
It has three parameters - X, Y, and size. Who says X and Y need to be centered on the boss? You can use more than one, so it won't interfere with boss-player collision.
Dumb Question #234980012a
ZUNsuns
ADD render or ALPHA render? (I know there are two layers)
Thanks
Both ADD. Be sure to give both files a black background if they don't have it yet.
I know this is lolfacepalm but how do you call tasks?
And also, because I know it involves tasks, how do you make lasers move, like in Flandre's Laevetinn(or however the hell you spell it)?
task Ha ha, old chap!{
ShootDownPlayer;
}
task main{
loop{
Ha ha, old chap!;
yield;
}
}
I know this is lolfacepalm but how do you call tasks?
And also, because I know it involves tasks, how do you make lasers move, like in Flandre's Laevetinn(or however the hell you spell it)?
task Ha ha, old chap!{
ShootDownPlayer;
}
task main{
loop{
Ha ha, old chap!;
yield;
}
}
task AutoMoveLaser(obj)
{
while(!Obj_BeDeleted(obj))
{
Obj_SetPosition(obj,Obj_GetX(obj)+cos(Obj_GetAngle(obj))*Obj_GetSpeed(obj),Obj_GetY(obj)+sin(Obj_GetAngle(obj))*Obj_GetSpeed(obj));
yield;
}
}
ObjShot_FadeDelete(obj);
ObjLaser_FadeDelete(obj);
Obj_FadeDelete(obj);
I have some questions :ohdear:
So recently I've been trying to master spark. But epic failed , How do I make my spell fade after using it? I tried (obj)Code: [Select]ObjShot_FadeDelete(obj);
Code: [Select]ObjLaser_FadeDelete(obj);
Code: [Select]Obj_FadeDelete(obj);
It's a player's spell. Obj_Delete just erase it and it looks kinda arkward. :V
and also, the supershot only has 1 colour (white), how do I make it change colour without having to change the supershot sheet
SetColor for ADD blend
ObjEffect_SetRenderState(obj,ADD);
SetColor(rand(0,255),rand(0,255),rand(0,255));
Master Spark should be an effect object, not a laser object. Can get the rainbow, fading, multiple image blends, etc.
///////////////////////////////////////////////////
task Star(s,angle,l){
let obj = Obj_Create(OBJ_EFFECT);
let counter = 0;
let counterb = 0;
Obj_SetPosition(obj,GetPlayerX,GetPlayerY);
Obj_SetSpeed(obj,s);
//ObjLaser_SetWidth(obj, 10);
//ObjLaser_SetLength(obj, l);
Obj_SetAlpha(obj,100);
ObjEffect_SetRenderState(obj,ALPHA);
//ObjEffect_SetLayer(obj,3);[color=pink] // I don't see the difference between any numbers[/color]
ObjEffect_SetTexture(obj,img_spell);
ObjEffect_CreateVertex(obj,4);
ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLEFAN);
ObjEffect_SetVertexUV(obj,0,1,514);
ObjEffect_SetVertexUV(obj,1,514,514);
ObjEffect_SetVertexUV(obj,2,514,767);
ObjEffect_SetVertexUV(obj,3,514,767);
ObjEffect_SetVertexColor(obj,0,100,rand(0,255),rand(0,255),rand(0,255));
ObjEffect_SetVertexColor(obj,1,100,rand(0,255),rand(0,255),rand(0,255));
ObjEffect_SetVertexColor(obj,2,100,rand(0,255),rand(0,255),rand(0,255));
ObjEffect_SetVertexColor(obj,3,100,rand(0,255),rand(0,255),rand(0,255));
Obj_SetAngle(obj,angle);
//ObjShot_SetGraphic(obj,254);
ObjShot_SetDamage(obj,5);
ObjShot_SetPenetration(obj,1000);
while(!Obj_BeDeleted(obj)){
Wait(1);
counter+=1;
counterb+=1;
if(counter==1){
Obj_SetPosition(obj,GetPlayerX,GetPlayerY);
//ObjLaser_SetWidth(obj, 500);
ObjEffect_SetVertexColor(obj,0,100,rand(0,255),rand(0,255),rand(0,255));
ObjEffect_SetVertexColor(obj,1,100,rand(0,255),rand(0,255),rand(0,255));
ObjEffect_SetVertexColor(obj,2,100,rand(0,255),rand(0,255),rand(0,255));
ObjEffect_SetVertexColor(obj,3,100,rand(0,255),rand(0,255),rand(0,255));
counter=0;}
if(counterb==300){ObjShot_FadeDelete(obj);}
}
///////////////////////////////////////////////////
I think the vertex should be correct [(0,514,122,767)]task LightningRipple(xpos){
let objlightning=Obj_Create(OBJ_SPELL);
Obj_SetAlpha(objlightning,50);
Obj_SetAngle(objlightning,90);
ObjEffect_SetTexture(objlightning,lightning);
ObjEffect_SetRenderState(objlightning,ALPHA);
ObjEffect_SetScale(objlightning,2,2);
ObjEffect_CreateVertex(objlightning,4);
ObjEffect_SetPrimitiveType(objlightning,PRIMITIVE_TRIANGLEFAN);
ObjEffect_SetVertexUV(objlightning,0,0,0);
ObjEffect_SetVertexUV(objlightning,1,160,0);
ObjEffect_SetVertexUV(objlightning,2,160,600);
ObjEffect_SetVertexUV(objlightning,3,0,600);
while(!Obj_BeDeleted(objlightning)){
ObjEffect_SetVertexXY(objlightning,0,0+xpos,0);
ObjEffect_SetVertexXY(objlightning,1,52+xpos,0);
ObjEffect_SetVertexXY(objlightning,2,52+xpos,464);
ObjEffect_SetVertexXY(objlightning,3,0+xpos,464);
ObjSpell_SetIntersecrionLine(objlightning,0,0,52+xpos,464,464,5,true);
yield;
}
}
task run{
SetPlayerInvincibility(300);
ForbidShot(true);
loop(45){yield;}
while(spellcount<31){
if (spellcount%10==0){
LightningRipple(xpos1);
LightningRipple(xpos2);
xpos2+=25;
xpos1-=25;
PlaySE(lightningwav);
if(spellcount==31){
Flash;
PlaySE(crash);
}
}
spellcount++;
yield;
}
ForbidShot(false);
SetSpeed(3.5,2.5);
loop(90){yield;}
End();
}
Result: (http://img228.imageshack.us/img228/2682/bombflub.jpg) ascent(i in 0..4){
ObjEffect_SetVertexColor(objlightning, i, the_alpha_you_want, 255, 255, 255);
}
let death=30;
let visibility = 100;
...
ascent(i in 0..4){
ObjEffect_SetVertexColor(objlightning, i, the_alpha_you_want, 255, 255, 255);
}
death--;
if(death<=0){ visibility-=10; }
if(visibility<=0){ Obj_Delete(objlightning); }
If you want to change the alpha value of an effect object, you need to set it for each vector seperately, like this:Code: [Select]ascent(i in 0..4){
ObjEffect_SetVertexColor(objlightning, i, the_alpha_you_want, 255, 255, 255);
}
If you want the object to be removed after some time, you need to create a variable at the beginning of the task, let's call it "death", and give it a value. Then you have it decrease the value of "death" by 1 during each run of the while{} part and then, if it is below 0, remove the object. Although removing it instantly usually looks back, so I'd advise you to create two variables instead: "death" and "visibility". Visibility starts out at the alpha value the object should have and decreases drastically every frame once "death" is below 0. Then you delete the object once "visibility" reaches zero.Code: [Select]let death=30;
let visibility = 100;
...
ascent(i in 0..4){
ObjEffect_SetVertexColor(objlightning, i, the_alpha_you_want, 255, 255, 255);
}
death--;
if(death<=0){ visibility-=10; }
if(visibility<=0){ Obj_Delete(objlightning); }
Question question, can Danmakufu draw the screen flickering effect ? (like what happens behind those MoF/SA/UFO bosses)
Oh, it's the wavering background.
#TouhouDanmakufu
#Title[spellcard]
#Text[blablabla]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main {
let frame = 0;
let angle = 0;
let sword = "img\SwordandStuff.bmp";
@Initialize {
SetLife(1000);
SetEnemyMarker(true);
SetScore(500000);
}
@MainLoop {
CreateShotA(1, GetX, GetY, 20);
SetShotDataA(1, 0, 2, 90, 0, 0, 2, GREEN03);
SetShotDataA(1, 30, NULL, NULL, 0, -0.025, 0, YELLOW03);
SetShotDataA(1, 90, 0, 45, 0, 0.05, 2, YELLOW02);
SetShotKillTime(1, 240);
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 24);
if(frame==300){
let obj = Obj_Create(OBJ_SHOT));
Obj_SetPosition(obj, GetX, GetY);
Obj_SetSpeed(obj, 4);
Obj_SetAngle(obj, GetAngleToPlayer);
ObjShot_SetDelay(obj, 10);
ObjShot_SetGraphic(obj, sword);
FireShot(1);
frame = 0;
}
frame++;
}
@DrawLoop {
}
@Finalize {
}
}
It was something along the lines of...Oops, I placed the variables at the beginning of the spell script...didn't know it would make a difference if I put it locally in the task. It works now, but say what if I wanted the effect object to have an additive blend? That, or I'd have to shave off more of the black in the texture 'cause it still looks ugly. If only there's a site somewhere that contains good textures to use, especially scrolling scenery textures.
Make a render target. Draw everything related to backgrounds onto this render target. Use the render target as the graphic for an effect object. Give the object zig vertices. Make them behave accordingly.
Yeah, it is difficult...
And @ Sparkling Orange: If you have a single task that creates, manages and removes one of your effect objects, calling this task several times should not cause any problems at atll because the variable that holds the id of the object, in your case "objlightning", is created withing the task and thus is unaffected by code outside of it, even the code of seperate other running instances of the same task.
Did you put the code I posted at the right places? Both parts should go in task LightningRipple(xpos){, the first one before the while{} brackets, the second one inside the while{} brackets just before the yield;.
The ~ character can be used to concatenate strings. "string1"~"string2" would return "string1string2". However, function/sub/task/variable names are not strings, so if I'm understanding your question correctly, you'll have to use a switch.
Is it possible to make a game with Danmakufu that doesn't require the engine? I plan to eventually sell something I make and I won't make much money if all my customers had to do that "app locale" thing.
task testShot(x,y,v,dir,xacc,yacc,maxXacc,maxYacc,kleur,delay){
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,v);
Obj_SetAngle(obj,dir);
ObjShot_SetGraphic(obj,kleur);
ObjShot_SetDelay(obj,delay);
while(!Obj_BeDeleted(obj)) {
Obj_SetX(obj,Obj_GetX(obj)+v*cos(dir));
Obj_SetY(obj,Obj_GetY(obj)+v*sin(dir));
dir++;
yield;
}
}
task testShot(x,y,xv,yv,xacc,yacc,maxXacc,maxYacc,kleur,delay){
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,0);
ObjShot_SetGraphic(obj,kleur);
ObjShot_SetDelay(obj,delay);
while(!Obj_BeDeleted(obj)) {
Obj_SetX(obj,Obj_GetX(obj)+xv);
Obj_SetY(obj,Obj_GetY(obj)+yv);
xv+=xacc;
yv+=yacc;
Obj_SetAngle(obj,atan2(yv,xv));
yield;
}
}
For problem 2, have separate X and Y velocities.Code: [Select]< code >
This is untested, but it should work unless I'm still too tired to think. This won't cap the numbers at the maximum, but I'm sure you can figure that out on your own. The bullet's display angle might be reversed too, but that should also be easy to fix.
function something(par1,par2){
DoSomething;
loop(3){
loop(10){
Bullet;
var++;
}
DoSomethingElse;
}
}
You can just set up everything so there's only one selectable script, then tell the user "press Z repeatedly until you get to a screen that's not blue." If you delete the default Rumia scripts and don't use any Japanese characters in yours, they won't need applocale.
what about the fact that everything on the main menu is described in japanese?Look, if you want to make a commercial game, maybe you should use an engine that is made for that ordeal, not an unoptimized, discontinued beta version released by people who designed everything in their mother tongue. Preferrably, use an engine that either explicitly says that you may use it for commercial purposes, or one that you programmed yourself.
//Header stuff
let factor = 1.0;
let count = 0;
let score = 0;
let lives = 4;
scorekeeperMake;
loop
{
if (c < 10)
{
pickCard(factor);
}
else
{
pickBoss(factor);
c = 0;
}
loop(lives == GetPlayerLives && score == scorekeeperValue)
{}
if (c == 10 && lives == GetPlayerLives)
lives++;
else
{
lives = GetPlayerLives;
score = scorekeeperValue;
factor += 0.05;
count++;
}
}
Your second loop command has a boolean parameter where it should have a number. ==, <, >, <=, >=, &&, !=, and ! will all yield boolean values. One of your if statements is also missing it's braces, but I'm pretty sure you can still do that anyway so it probably doesn't matter.
Um, the boolean parameter is to make it loop until either score or lives change, i.e. the current card ends; kinda like an indefinite wait loop.
Um, the boolean parameter is to make it loop until either score or lives change, i.e. the current card ends; kinda like an indefinite wait loop. And also I'm kinda new to danmakufu but don't you not need braces for single line statements? Sorry if I'm completely wrong, I probably coded this like a Java program :V
;_;Your code is weird. I would have coded it differently, but this way works just as well if you just fix this little error:
You always set the speed to "calcspeed+acc", yet never change the value of "calcspeed".
I'm no expert myself, but it sounds like you're after a "while" loop, not a regular one.
if(forse==no){DeleteEnemyShot(ALL); Concentration02(60);no=0;si++;forse-rand(-10, 10);}
no, si and forse are variables (yea I let them).forse-=rand(-10, 10);thanks [I'm going to kill me....this mistake is so ⑨ (⑨=stupid;)
I'm new round here so bear with me.
Kay, so for a bout a year now I've been working on my own fullgame, called Eternal Twilight. I don't really neeed to say much cept this.
In stage three, I have two bosses, and I want them to fight simultaneously, so, how do I make it so they both appear as destructable enemies, yet still are under the Boss class?
In stage three, I have two bosses, and I want them to fight simultaneously, so, how do I make it so they both appear as destructable enemies, yet still are under the Boss class?
You'll spawn one boss as an enemy during the boss script. So you'll spawn your boss using CreateEnemyBossFromFile, and then inside the boss script, you'll use CreateEnemyFromFile (or CreateEnemyFromScript) to spawn the other boss. To make it so they both operate under the same health bar, you'll use SetDamageRate() for the "main" boss, and SetDamageRateEx() for the "sub" boss. SetDamageRateEx allows the main boss to take the same damage as the sub boss (and since the main boss will automatically kill the sub boss when it dies, there is no reason to transfer damage the other way). If you want the sub boss to be at the same point at the start of the following attack, you'd need to set its coordinates in common data at the end of the previous attack and then respawn it in the next script at those coordinates, in @Initialize.Ah, I think this may be the best route to take.
Wait(120);
(http://img838.imageshack.us/img838/1185/problemr.jpg)Sorry...I've lots of problems.....Can someone tell me how "wait" works?Code: [Select]Wait(120);
(http://img838.imageshack.us/img838/1185/problemr.jpg)
Please help me Eirin!
function Wait(t){ loop(t){ yield; } }
(...) task mainTask{
wait(120);
yield;
movement;
fire;
}
task movement{
loop{
SetMovePositionRandom01(100, 80, 5, GetCenterX-120, GetCenterY-130, GetCenterX+120, GetCenterY-50);
wait(90);
yield;
}
}
task fire{
let y = 0;
let dir = 0;
loop{
while(y<10){
?
CreateShotA(01,GetEnemyX+20*cos(dir),GetEnemyY+20*sin(dir),0);
SetShotDataA(01,0,6,dir,-0.2,-2,1,RED09);
FireShot(01);
CreateShotA(02,GetEnemyX+20*cos(dir),GetEnemyY+20*sin(dir),5);
SetShotDataA(02,0,6,dir,0.2,-1,4.5,RED09);
FireShot(02);
wait(5);
dir+=360/36;
y++;
}
y = 0;
dir = 0;
yield;
}
}
function wait(w){
loop(w){yield;}
}
} // This bracket is for script_enemy_main...
<snip>
let y = 0;
while(y<10){
CreateShotA(01,GetEnemyX+20*cos(dir),GetEnemyY+20*sin(dir),0);
SetShotDataA(01,0,6,dir,-0.2,-2,1,RED09);
FireShot(01);
CreateShotA(02,GetEnemyX+20*cos(dir),GetEnemyY+20*sin(dir),5);
SetShotDataA(02,0,6,dir,0.2,-1,4.5,RED09);
FireShot(02);
wait(5);
dir+=360/36;
y++;
}
y = 0;
loop(10){
CreateShotA(01,GetEnemyX+20*cos(dir),GetEnemyY+20*sin(dir),0);
SetShotDataA(01,0,6,dir,-0.2,-2,1,RED09);
FireShot(01);
CreateShotA(02,GetEnemyX+20*cos(dir),GetEnemyY+20*sin(dir),5);
SetShotDataA(02,0,6,dir,0.2,-1,4.5,RED09);
FireShot(02);
wait(5);
dir+=360/36;
}
loop{
while(y<10){
? //THIS RIGHT HERE
CreateShotA(01,GetEnemyX+20*cos(dir),GetEnemyY+20*sin(dir),0);
SetShotDataA(01,0,6,dir,-0.2,-2,1,RED09);
FireShot(01);
let obj1=Obj_Create(OBJ_SHOT);
let obj2=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj1, x, y);
Obj_SetAngle(obj1, angle);
Obj_SetSpeed(obj1, v);
ObjShot_SetGraphic(obj1, graphic);
ObjShot_SetDelay (obj1, 10);
ObjShot_SetBombResist (obj1, true);
while(Obj_BeDeleted(obj1)==false) {
if(Obj_GetX(obj1)<GetClipMinX+4) {
Obj_Delete(obj1);
Obj_SetPosition(obj2,Obj_GetX(obj1),Obj_GetY(obj1));
Obj_SetSpeed(obj2, Obj_GetSpeed(obj1));
ObjShot_SetGraphic(obj2, graphic);
ObjShot_SetDelay(obj2,0);
ObjShot_SetBombResist(obj2,true);
Obj_SetAngle(obj2, 180 - Obj_GetAngle(obj1) );
Obj_SetX(obj2, Obj_GetX(obj1) + 0.1);
}
if(Obj_GetX(obj1)>GetClipMaxX-4) {
Obj_Delete(obj1);
Obj_SetPosition(obj2,Obj_GetX(obj1),Obj_GetY(obj1));
Obj_SetSpeed(obj2, Obj_GetSpeed(obj1));
ObjShot_SetGraphic(obj2, graphic);
ObjShot_SetDelay(obj2,0);
ObjShot_SetBombResist(obj2,true);
Obj_SetAutoDelete(obj2,true);
Obj_SetAngle(obj2, 180 - Obj_GetAngle(obj1) );
Obj_SetX(obj2, Obj_GetX(obj1) - 0.1);
}
yield;
}
This creates indestructible bullets that bounce off walls only once. Is there any way to make it shorter ? Another problem is that the bullets don't get erased when they go off-screen (even with Obj_SetAutoDelete set to "true"). Can anyone check this for me as well ?
let obj1=Obj_Create(OBJ_SHOT);
let bounced = false;
Obj_SetPosition(obj1, x, y);
Obj_SetAngle(obj1, angle);
Obj_SetSpeed(obj1, v);
ObjShot_SetGraphic(obj1, graphic);
ObjShot_SetDelay (obj1, 10);
ObjShot_SetBombResist (obj1, true);
Obj_SetAutoDelete(obj1,true);
while(!bounced) {
if(Obj_GetX(obj1)<GetClipMinX+4) {
Obj_SetAngle(obj1, 180 - Obj_GetAngle(obj1) );
Obj_SetX(obj1, Obj_GetX(obj1) + 0.1);
bounced = true;
}
if(Obj_GetX(obj1)>GetClipMaxX-4) {
Obj_SetAngle(obj1, 180 - Obj_GetAngle(obj1) );
Obj_SetX(obj1, Obj_GetX(obj1) - 0.1);
bounced = true;
}
yield;
}
let laser=Obj_Create(OBJ_LASER);
...blah blah...
@MainLoop{
frame++;
if(frame==1){
ObjLaser_SetSource(laser, false);
}
...blah blah....
}
would actually work
fire(WHITE01);
if(frame==30){
SetMovePosition02(***, ***, 10);
}yield;
if(frame==60){
yield;
SetMovePosition02(**,***, 10);}yield;
if(frame==90){
yield;
SetMovePosition02(***, **, 10);}yield;
if(frame==120){
yield;
SetMovePosition02(***,***, 10);}yield;
if(frame==150){
yield;
SetMovePosition02(***,***, 10);}yield;
if(frame==180){
yield;
SetMovePosition02(***,***, 10);}yield;
if(frame==210){
yield;
SetMovePosition02(***,***, 10);
frame=0;yield;
}yield;
frame++;
(xs and ys are top secret)task fire(graphic){
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, GetEnemyX, GetEnemyY);
ObjShot_SetDelay(obj, 30);
ObjShot_SetGraphic(obj, graphic);
Obj_SetAngle(obj, -90);
Obj_SetSpeed(obj, 0);
yield;}
If I want that after 210 frames(the movement) ALL objs TOGETHER IN THE SAME TIME go up (for example) changing the velocity to 3 (about).But even with Wait(210); Some bullet will move, then others and then.... well I think you have understood. I tried with stop time and works, but I have other bullet that doesn't have to stop...Well I hope you have understand, I tried to speak English as better I can but... It's warm and I'm in holiday, I can't speak correctly any language....
(xs and ys are top secret)
SetAlpha([150, 255][(isHC)]);
I just know that isHC is a boolean. What are the square brackets for ?
Code: [Select]SetAlpha([150, 255][isHC]);
task fire01{
loop{
CreateShotA(1,GetEnemyX,GetEnemyY,5);
SetShotDataA(1,0,2,45,0,0,2,BLUE12);
CreateShotA(2,0,0,5);
SetShotDataA(2,0,2,135,0,0,2,BLUE12);
CreateShotA(3,0,0,5);
SetShotDataA(3,0,2,315,0,0,2,BLUE12);
AddShot(60,1,2,0);
AddShot(60,1,3,0);
CreateShotA(4,0,0,5);
SetShotDataA(4,0,2,45,0,0,2,BLUE12);
CreateShotA(5,0,0,5);
SetShotDataA(5,0,2,225,0,0,2,BLUE12);
AddShot(60,2,4,0);
AddShot(60,2,5,0);
AddShot(60,3,4,0);
AddShot(60,3,5,0);
FireShot(1);
wait(120);
yield;
}
}
The idea is that shot 1 fires shots 2 and 3, and 2 and 3 each fire shots 4 and 5. However, while shot 1 fires shots 2 and 3 fine, shots 2 and 3 do not fire shots 4 and 5. Can anyone please explain how to change this so that it works like I want it do?
Holy fuck the engrishhhhhYEEEESSSS!!!!
Sorryyyy T_T that things it's so lunatic?No, Extra?Phatasm?No it's kefir... T_T sorrryyyy.....Make a variable equal GetAngleToPlayer. Shoot bullets using that variable for the angle. If you don't update the variable, it will shoot at where the player WAS.
However, how about make some bullet at GetAngleToPlayer but if the player move the bullet won't change angle?
task ShootLine
{
let angle = GetAngleToPlayer; //Variable "angle" equals the angle to player.
loop(10)
{
//Shoots the bullet towards "angle".
CreateShot01(GetX,GetY,4,angle,RED01,10);
loop(3){yield;}
}
}
let frame = -60;
let angle;
@MainLoop
{
if(frame==0)
{
//Variable "angle" equals the angle to player.
angle = GetAngleToPlayer;
}
if(frame%3==0 && frame>=0)
{
//Shoots the bullet towards "angle".
CreateShot01(GetX,GetY,4,angle,BLUE01,10);
}
if(frame==30)
{
frame =- 30;
}
frame++;
}
@DrawLoop{
SetTexture(spr);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
if(int(GetSpeedX())==0){
if(f<10){ SetGraphicRect(0,0,96,96); }
if(f>=10 && f<20){ SetGraphicRect(96,0,192,96); }
if(f>=20 && f<30){ SetGraphicRect(192,0,288,96); }
if(f>=30 && f<40){ SetGraphicRect(288,0,384,96); }
f2=0;
}
if(GetSpeedX()>0){
if(f2<5){ SetGraphicRect(0,96,96,192); }
if(f2>=5 && f2<10){ SetGraphicRect(96,96,192,192); }
if(f2>=10 && f2<15){ SetGraphicRect(192,96,288,192); }
if(f2>=15){ SetGraphicRect(288,96,384,192); }
f2++;
}
if(GetSpeedX()<0){
if(f2<5){ SetGraphicRect(0,192,96,288); }
if(f2>=5 && f2<10){ SetGraphicRect(96,192,192,288); }
if(f2>=10 && f2<15){ SetGraphicRect(192,192,288,288); }
if(f2>=15){ SetGraphicRect(288,192,384,288); }
f2++;
}
DrawGraphic(GetX,GetY);
f++;
if(f==40){f=0;}
}
Need some help here, I have made my own sprites...
I have the idle, left, and right animations working I just need help getting the firing sprites to show when it's firing bullets.
let attack = 0;
. . .
if(int(GetSpeedX())==0){
// idle animation
if(attack == 0) {
if(f<10){ SetGraphicRect(0,0,96,96); }
if(f>=10 && f<20){ SetGraphicRect(96,0,192,96); }
if(f>=20 && f<30){ SetGraphicRect(192,0,288,96); }
if(f>=30 && f<40){ SetGraphicRect(288,0,384,96); }
f2=0;
}
// attack animation
if(attack == 1) {
<< Here SetGraphicRect ranges for the attack animation. >>
f2=0;
}
}
task testLaser(x,y) {
let obj = Obj_Create(OBJ_LASER);
let c = 0;
Obj_SetPosition(obj,x,y);
Obj_SetSpeed(obj,22);
Obj_SetAngle(obj,270);
ObjShot_SetGraphic(obj,254);
ObjLaser_SetSource(obj,false);
ObjLaser_SetLength(obj, 1000);
ObjShot_SetDelay(obj,0);
ObjShot_SetDamage(obj,0.5);
ObjShot_SetPenetration(obj,25);
ObjLaser_SetWidth(obj,15);
while(!Obj_BeDeleted(obj)) {
Obj_SetPosition(obj,GetPlayerX,GetPlayerY);
c++;
if(c>=30) { Obj_Delete(obj); }
yield;
}
}
Penetration isn't working. Somehow Danmakufu calculates the first target as a hit and the laser will keep penetrating that target continuously.
if(frame%3==0)
What does it means?
Code: [Select]if(frame%3==0)
What does it means?
the % is called a Modulus, this statement says, if frame divided by 3 equals 0, then codeNot exactly. It says, if frame divided by 3 has a REMAINDER of 0, then code.
Not exactly. It says, if frame divided by 3 has a REMAINDER of 0, then code....whoops, my bad, thanks for the correction.
Also how can you divide something and end up with 0? :V
...whoops, my bad, thanks for the correction.
Dividing it by 0 of course :V
Object lasers don't use Obj_SetSpeed or ObjShot_SetPenetration, don't include them. There's also no reason to set delay to zero.Oh, thought penetration worked, because if I would put penetration to 1, the laser would hit once then immediately disappear (brrr sound also confirms this).
My Remilia lasers use both lasers to damage the enemies and enemy enumeration loops to spawn explosions on their position. You can just copy either code for your laser.
Dividing it by 0 of course :VWrong. START with 0.
let x=0;
let ANG=270;
let z=0;
let v=1;
while(x<6){
CreateLaserC(11+x,GetX,GetY,10,80,188,0);
SetShotDirectionType(PLAYER);
SetLaserDataC(11+x,0,2+z,ANG*v,2*v,0,2);
SetLaserDataC(11+x,40,0,0,0,0,2);
SetLaserDataC(11+x,50,4,0,0,0,2);
y=y+10;
z++;
if(y>20){y=0;z=0;v=-1;}
x++;
}
FireShot(11);FireShot(12);FireShot(13);FireShot(14);FireShot(15);FireShot(16);
z and v are just arbitrary values that change :V
I'd do it with OBJ_SINUATE_LASER. Parse the player's position to the laser at the beginning of the task, then make it hom in on him.I suppose via the maths route I could set it back to Absolute and then sort it that way. It'd be a bit fun mind. Time to look up a function~ Even if I don't use it :3c
Alternatively, you could do the math. Gimme some minutes...
what causes the plural, single, stage, etc. selections to not work? I can still use directory, but the other options crash. any ideas on what it could be?You mean you entire danmakufu main menu is crashing?
Explanations.Thanks a lot ! I was wondering why that wasn't mentioned anywhere in the tutorials (though I probably have overlooked it).
Is there a function to detect the collision between an effect object and a bullet (any kind of bullet except for lasers) ? (you could've guessed what I was trying to accomplish now:You can check the collision manually, for example with the GetPointToLine function I posted in the Miscelleanous Code Snippets thread.is it possible to code a reflective barrier at all ?)
And uh, what are the differences between a task, a subroutine and a function ?A subroutine is just you taking a block of code you need to use several times in a script, so you substitute a single command for this block to save time.
Is there a function to detect the collision between an effect object and a bullet (any kind of bullet except for lasers) ? (you could've guessed what I was trying to accomplish now:I suppose you could, but it sucks to work properly. It would be better off using math. What shape is it? Are you placing it anywhere in particular; are you moving it around?is it possible to code a reflective barrier at all ?)
is it possible to code a reflective barrier at all ?
while(Obj_BeDeleted(obj) == false)
{
if(Obj_GetX(obj) < GetClipMinX)
{
Obj_SetAngle(obj, 180 - Obj_GetAngle(obj));
Obj_SetX(obj, Obj_GetX(obj) + 0.1);
}
if(Obj_GetX(obj) > GetClipMaxX)
{
Obj_SetAngle(obj, 180 - Obj_GetAngle(obj));
Obj_SetX(obj, Obj_GetX(obj) - 0.1);
}
}
task fire01{
let dir = 0;
let i = 0;
loop{
bullet01(GetEnemyX,GetEnemyY,3,dir,PURPLE12,5);
if(dir>=0 && i==0 && dir!=45){
dir++;
}
if(dir==45 && i==0){
dir--;
i = 1;
}
if(dir<=45 && i==1 && dir!=0){
dir--;
}
if(dir==0 && i==1){
dir++;
i = 0;
}
wait(2.5);
}
}
function bullet01(x,y,s,dir,g,d){
let obj01 = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj01,x,y);
Obj_SetSpeed(obj01,s);
Obj_SetAngle(obj01,dir);
ObjShot_SetGraphic(obj01,g);
ObjShot_SetDelay(obj01,d);
while(!Obj_BeDeleted(obj01)){
if(Obj_GetX(obj01)>GetClipMaxX){
Obj_SetAngle(obj01,rand(105,179));
}
yield;
}
}
However, the problem is that, once one bullet is fired, the next bullet won't be fired until the first bullet has been deleted. Is there a way to make it so that the next bullet will fire before first is deleted?
I don't see how that would be better in this situation.
let barrier_angle=0;
let barrier_width=20;
...
task bullet(blah, blah){
let obj=Obj_Create(OBJ_SHOT);
blah blah blah
while(!Obj_BeDeleted(obj)){
if(Collision_Line_Circle(GetPlayerX+barrier_width*cos(barrier_angle), GetPlayerY+barrier_width*sin(barrier_angle), GetPlayerX+barrier_width*cos(barrier_angle+180), GetPlayerY+barrier_width*sin(barrier_angle+180), barrier_width, Obj_GetX(obj), Obj_GetY(obj), object_radius)==true){
*insert reflection code here depending on barrier_angle*
}
yield;
}
}
@MainLoop{
barrier_angle++; //blah
}
angle=atan2(Obj_GetY(obj)-GetPlayerY, Obj_GetX(obj)-GetPlayerX);
if(angle>=barrier_angle-45 && angle<barrier_angle+45){angleb=barrier_angle;}
if(angle>=barrier_angle+45 && angle<barrier_angle+135){angleb=barrier_angle+90;}
if(angle>=barrier_angle+135 && angle<barrier_angle+225){angleb=barrier_angle+180;}
if(angle>=barrier_angle+225 && angle<barrier_angle+315){angleb=barrier_angle+270;}
Obj_SetAngle(obj, angleb*2-Obj_GetAngle(obj)+180);
Hey guyz how do I nue line in DrawText?You have to make an entirely new DrawText
function -> taskThat worked, thank you.
Hey guyz how do I nue line in DrawText?type
wtf u doinwtf u doin
type
in the text
Oh whoops, thought that was what he meant. Might still work, but eh.Just tried it, didn't work.
You have to make an entirely new DrawTextShit.
Shit.
DrawText("This one Here".x.y.30,alpha);No. I was just complaining about the process being too time consuming.
DrawText("That one Tere".x+30.y+30.30,alpha);
Perhaps "Make" was a poor word choice...
You're implying the DrawTextNew-esque functions were developed by one person and not a combined effort of ripping off various code from various people :(god.
SetFog
It turns my backgrounds into big blocks of whatever colour
I think he just means that SetFog's turning his graphics into big blocks of a certain colorJust realizing that I returned to this thread to edit my post, but you seem to have tackled it all ready. Must read more clearly in the early timers =.=
use smaller images then just tile them or something, SetFog goes crazy with large images :V
You need a stage. Without a SetScore there are no backgrounds for single patterns.
I made a 'stage' with the background I want that clears after 30 seconds, but I how do link the stage to the plural file?
During the stage when ever you want, you spawn the boss which is calling the plural file with the following command: CreateEnemyBossFromFile("path to the plural file",x pos,y pos, speed , direction ,userargument);
SetDurableSpellCard; ?That too, because without it, the Bonus would decrease over time, so when time would be up the Bonus would be 0.
if(sc== 1){
ascent(i in 0..5){
PlaySE(GetCurrentScriptDirectory~"SE\Shot4.wav");
CreateShotA(1, GetX+50*i, GetY, 10);
SetShotDataA(1, 0, 0.5-5/i, GetAngleToPlayer+wa, 0, 1, 10, 185);
FireShot(1);
CreateShotA(1, GetX-50*i, GetY, 10);
SetShotDataA(1, 0, 0.5-5/i, GetAngleToPlayer-wa, 0, 1, 10, 185);
FireShot(1);
}
sc = 0;
}
if(wa<= 100){
wa += 1;
}
if(wa>= 100){
wa -= 1;
}
if(wa== 95){
wa = 200;
}
if(wa== 105){
wa = 0;
}
Code: [Select]if(wa<= 100){
wa += 1;
}
if(wa>= 100){
wa -= 1;
}
if(wa== 95){
wa = 200;
}
if(wa== 105){
wa = 0;
}
I am so mad at this right now...
http://pastebin.org/791582
I am trying to recreate Sanae's OP from MoF, lunatic, and I can't get the angles right. I need help, please~ I have the bullet placement and the begging right, just when the fan out is the part I am having troubles with.
task TShitballs(x, y, v, r, as, ab, ns, nb, graph){
loop(120){ yield; }
let d=r*2/sin(72);
ascent(k in 0..nb){ ascent(i in 0..ns){ ascent(j in 0..5){
CreateShotA(1, x+r*cos(ab+72*j)+d*cos(ab+72*j+162)*k/nb,
y+r*sin(ab+72*j)+d*sin(ab+72*j+162)*k/nb, 0);
SetShotDataA(1, 0, 0, as+360*i/ns, 0, 0, 0, graph);
SetShotDataA(1, 60+nb-k, 6, as+360*i/ns, 0, -0.2, 0, graph);
SetShotDataA(1, 180+nb-k, 0, ab+72*j+162, 0.25*k/nb, v/90, v, graph);
FireShot(1);
} } yield; }
}
Reposting here so it doesn't get lost in the pastebin limbo.I have another problem.Sounds like Danmakufu being a jerk again to me rather than your script's error.
I combining my standartspells and spell-cards in one Plural-script for my first real boss fight.(I mean, it is not just a bunch of attacks in a spellcard which was randomly designed according to a tutorial or something)
At the moment there are 2 spells and 2 standartspells combined in it.
While testing it, I noticed that the "Graze" counter resets itself after a VERY short time.
So you can't get a grazecount higher then 1.(Mostly it's 0)
How do I fix that?
?dit:
Forgot to tell you that it works for every other script. Also the single scripts work fine, when you don't use the Plural script.
I will upload it on pastebin and write the link in this post.
I have another problem.
I combining my standartspells and spell-cards in one Plural-script for my first real boss fight.(I mean, it is not just a bunch of attacks in a spellcard which was randomly designed according to a tutorial or something)
At the moment there are 2 spells and 2 standartspells combined in it.
While testing it, I noticed that the "Graze" counter resets itself after a VERY short time.
So you can't get a grazecount higher then 1.(Mostly it's 0)
How do I fix that?
sub setGraphicMove {
if (GetSpeedX < 0){
setGraphicLeft;
}else{
if (GetSpeedX > 0){
setGraphicRight;
}
}else{
if (GetSpeedX == 0){
setGraphicStop;
}
}
}
you don't type elseif, you do it this way:
I feel like a derp because this seems so simple. If only Danmakufu had elsif like perl... :fail:
if(somethingistrue){
doCrap;
} else if(somethingelseistrue){
doCrap2;
}
sub setGraphicMove {
if (GetSpeedX < 0){
setGraphicLeft;
}else if(GetSpeedX > 0){
setGraphicRight;
}else{
setGraphicStop;
}
}
sub setGraphicMove {Your second else{} is linked to the first else{} instead of what's IN the first else{}. Technically this would mean that the condition for the final case is the same as for the first case, but I can totally see danmakufu not liking you putting a "if else than else" condition into your code.
if (GetSpeedX < 0){
setGraphicLeft;
}else{
if (GetSpeedX > 0){
setGraphicRight;
}
}else{
if (GetSpeedX == 0){
setGraphicStop;
}
}
}
sub setGraphicMove {
if (GetSpeedX < 0){
setGraphicLeft;
}else{
if (GetSpeedX > 0){
setGraphicRight;
}
else{
if (GetSpeedX == 0){
setGraphicStop;
}
} }
}
you don't type elseif, you do it this way:Code: [Select]if(somethingistrue){.
doCrap;
} else if(somethingelseistrue){
doCrap2;
}
Your second else{} is linked to the first else{} instead of what's IN the first else{}. Technically this would mean that the condition for the final case is the same as for the first case, but I can totally see danmakufu not liking you putting a "if else than else" condition into your code.
If that does not fix it, then maybe the problem lies somewhere else entirely.
Edit: I hate all of you. :derp:
I don't have a script problem, but I do have a question pertaining to player scripts that I'm not sure would fit in its own thread.If you are at the bottom of the screen but below the boss, you should be able to deal at least 200 dps with any shottype. Anything else is just frustrating. Shotgun damage can be 300~350 as long as you can't do it for too long, no problem.
What would be a good power range for a player's unfocused shots when the point of that player is to be a bit of a spread type, thus having power in the option shots that wouldn't really go towards the enemy that much? This is my issue. I'm worried my unfocused spread is too weak (~80 DPS from the bottom of the screen against the DPS tester), but if you shotgun with it, you get ~200 DPS. I don't want it to be so weak from the bottom, but of course, that is with like, two option shots and every stream of main shots but two hitting the boss. I just...can't figure out if that is even good enough. It's meant to be slightly weak, since its main purpose is to tackle stage enemies, but this is just worrying.
If you are at the bottom of the screen but below the boss, you should be able to deal at least 200 dps with any shottype. Anything else is just frustrating. Shotgun damage can be 300~350 as long as you can't do it for too long, no problem.Again, I said UNfocused. Sure, you shouldn't be going unfocused against a boss, but I'm still worried it will be too weak... And I don't want this shot to have ANY shotgun potential AT ALL. :/
Again, I said UNfocused. Sure, you shouldn't be going unfocused against a boss, but I'm still worried it will be too weak... And I don't want this shot to have ANY shotgun potential AT ALL. :/Well, at least the focused shot should do 200+ dps from the bottom of the screen when you are directly below the boss, if not 250.
does your response still stand?
Well, at least the focused shot should do 200+ dps from the bottom of the screen when you are directly below the boss, if not 250.*sigh* I just increased the power of the unfocused shot to where it's now over 100 DPS. You really weren't understanding me, Iryan. I said the UNFOCUSED spread. Nowhere was I even mentioning focused. :( The focused damage was fine, it hovers around 240. (I refuse to have it closer to 250 because I feel that is going into the "power type" area, since that is what the designated power shot, MarisaA, has...)
If you do not want shotgun potential, you can make it so that the damage of each bullet that is not part of the forward main fire (which I assume your shot has) increases the longer it flies. :derp:
Maybe I screwd up my danmakufu programm data??If that is true, downloading another copy and moving all of the scripts into the new copy will fix all the problems (http://www.geocities.co.jp/SiliconValley-Oakland/9951/products/th_dnh.html)
function ToNumber(character){
let ret=0;
alternative(character)
case('A') {ret=0;} case('B') {ret=1;} case('C') {ret=2;} case('D') {ret=3;}
//etc
return ret;
}
Might not be the most efficient way, but it works.
run faster than all custom player characters.:o what?!? I don't feel the difference. (Maybe because I suck)
Er, it's not a frame rate increase. I meant that it takes your computer less time to process the default player scripts than it does all other custom player characters. So all scripts, if they lagged, would run faster using those characters instead of complete custom ones.Aaah! I see. I'm a (9)
I have some questions ???1, createshotA shenanigans or Object Bullets
-How do you make every bullet in the screen do something at the same time ?
-How do you make those youmu's bubble cutting thingy
-How do you make bullets follow you like those Pc-98 yellow worm thingy :/
I have some questions ???
-How do you make every bullet in the screen do something at the same time ?
-How do you make those youmu's bubble cutting thingy
-How do you make enemy do something when their health is low ?
-Where can I get damage tester ( :o)
-How do you make bullets follow you like those Pc-98 yellow worm thingy :/
-I heard that you can make a background using loop video [How?]
-How do you make those eirin familiars that shoot stuff when bullets pass them?
I'll stop for now :ohdear: my brain is dead
I have some questions ???- Use GetLife to make it check that a certain value is greater than GetLife
-How do you make enemy do something when their health is low ?
-Where can I get damage tester ( :o)
-I heard that you can make a background using loop video [How?]
-How do you make those eirin familiars that shoot stuff when bullets pass them?
#TouhouDanmakufu
#Title[Fool's Arts [Scarlet Feast]]
#Image[.\giygas.gif]
#BackGround[User(.\bg.png, 1, 1)]
#BGM[.\radiant.mp3]
#PlayLevel[Normal]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main {
let BossImage = "script\img\giygas.gif";
let BossCutIn = "script\img\giygas.gif";
@Initialize {LoadGraphic(BossImage);
SetLife(100);
SetDamageRate(10, 10);
SetTimer(50);
SetInvincibility(30);
CutIn(YOUMU, "Fool's Arts [Scarlet Feast]", BossCutIn, 0, 0, 200, 600);
SetScore(500000);
SetEnemyMarker(true);
SetDurableSpellCard;
LastSpell;
Concentration01(60);
Concentration02(60);
MagicCircle(false);
SetEffectForZeroLife(180, 100, 1);
}
@MainLoop {
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 24);
if(frame==60){
CreateShot01(50, Get30, 3, GetAngleToPlayer, RED21, 10);
frame = 0;
}
frame++;
}
@DrawLoop {
}
@Finalize {
}
@BackGround {
}
}
Gah, how, where and what? I totally don't know how to. I just copy-pasted from the tutorial, and totally skipped the variables part. >_>Why are you skipping the variables part when that is like the majority of general programming?
Why are you skipping the variables part when that is like the majority of general programming?
task Homing(x, y, v, angle, avmax, damage, penetration){
let tenemy=-1;
let tenemydist=1000;
let enemydist;
let tangle;
let diff;
let n;
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj,x,y);
ObjShot_SetGraphic(obj,11);
ObjShot_SetDamage(obj,damage);
ObjShot_SetPenetration(obj,penetration); //
Obj_SetAngle(obj,angle);
Obj_SetSpeed(obj,v);
Obj_SetAlpha(obj,150);
while(Obj_BeDeleted(obj)==false){
angle=Obj_GetAngle(obj);
// avmax=avmax*0.98;
tenemydist=10000;
ascent(i in EnumEnemyBegin..EnumEnemyEnd) { // detects the closest valid target
n=EnumEnemyGetID(i);
enemydist=( (Obj_GetX(obj) - GetEnemyInfo(n, ENEMY_X))^2 + (Obj_GetY(obj) - GetEnemyInfo(n, ENEMY_Y))^2 )^0.5;
if(enemydist<tenemydist){
tenemy=n; tenemydist=enemydist;
}
}
if(tenemydist==10000){ tenemy=-1; }
if(tenemy!=-1){
tangle=atan2( (GetEnemyInfo(tenemy, ENEMY_Y) - Obj_GetY(obj)), (GetEnemyInfo(tenemy, ENEMY_X) - Obj_GetX(obj)));
diff=tangle-angle;
while(diff>180){ diff-=360; } while(diff<-180){ diff+=360; }
if( (|diff|)<avmax){ angle=tangle; }
else{ angle+=avmax*(diff)/(|diff|); }
Obj_SetAngle(obj,angle);
}
yield;
}
}
This does not please me.When did Danmakufu pleased us? This is probably one of the reasons why I keep fucking around (even still) with the shot sheet.
On the right are bullets copypasted from a shotsheet image. On the left is the way the bullets are drawn.Are the right bullets larger, or is that just my imagination?
The bullets are shot at 90 degrees, and the copied bullets are rotated 90 degrees clockwise as well.
Shotsheet is 512x512, bullets are 15x15 and are drawn on a rounded position.
(http://img20.imageshack.us/img20/4469/etamaderp.png)
This does not please me.
let effect=0;
if(effect!=1){effect=effect+1;}
if(effect==1){
circleid=Obj_Create(OBJ_EFFECT);
Obj_SetX(circleid, GetX);
Obj_SetY(circleid, GetY);
ObjEffect_SetTexture(circleid, imagefile);
ObjEffect_SetAngle(circleid,80,0,0);
ObjEffect_SetRenderState(circleid,ALPHA);
ObjEffect_SetPrimitiveType(circleid,PRIMITIVE_TRIANGLELIST);
ObjEffect_CreateVertex(circleid,3);
ObjEffect_SetVertexXY(circleid,0,-142,-142);
ObjEffect_SetVertexXY(circleid,1,426,-142);
ObjEffect_SetVertexXY(circleid,2,-142,426);
ObjEffect_SetVertexUV(circleid,0,0,0);
ObjEffect_SetVertexUV(circleid,1,594,0);
ObjEffect_SetVertexUV(circleid,2,0,594);
ObjEffect_SetLayer(circleid,1);
circle=circle~[circleid];
circleid=Obj_Create(OBJ_EFFECT);
Obj_SetX(circleid, GetX);
Obj_SetY(circleid, GetY);
ObjEffect_SetTexture(circleid, imagefile2);
ObjEffect_SetAngle(circleid,80,0,0);
ObjEffect_SetRenderState(circleid,ALPHA);
ObjEffect_SetPrimitiveType(circleid,PRIMITIVE_TRIANGLELIST);
ObjEffect_CreateVertex(circleid,3);
ObjEffect_SetVertexXY(circleid,0,-142,-143);
ObjEffect_SetVertexXY(circleid,1,426,-143);
ObjEffect_SetVertexXY(circleid,2,-142,427);
ObjEffect_SetVertexUV(circleid,0,0,0);
ObjEffect_SetVertexUV(circleid,1,594,0);
ObjEffect_SetVertexUV(circleid,2,0,594);
ObjEffect_SetLayer(circleid,2);
circle2=circle2~[circleid];
effect=2;}
plan=plan+1;
if(plan==72){plan=0;}
angleE=angleE+5;
angleE2=angleE2+5;
let magiccircle=0;
while (magiccircle<length(circle)){
if(Obj_BeDeleted(circle[magiccircle])){
circle=erase(circle,magiccircle);
magiccircle--;}
else{
let circleid=circle[magiccircle];
ObjEffect_SetAngle(circleid,80,NULL,angleE);
if(plan<=36){ObjEffect_SetLayer(circleid,1);}
if(plan>36){ObjEffect_SetLayer(circleid,2);}
ObjEffect_SetScale(circleid,scale/10,scale/10);
if(Obj_GetX(circleid)!=GetX){Obj_SetX(circleid,GetX);}
if(Obj_GetY(circleid)!=GetY){Obj_SetY(circleid,GetY);}}
magiccircle++;}
//2nd circle
let magiccircle2=0;
while (magiccircle2<length(circle2)){
if(Obj_BeDeleted(circle2[magiccircle2])){
circle2=erase(circle2,magiccircle2);
magiccircle2--;}
else{
let circleid=circle2[magiccircle2];
ObjEffect_SetAngle(circleid,80,NULL,angleE2);
if(plan>36){ObjEffect_SetLayer(circleid,1);}
if(plan<=36){ObjEffect_SetLayer(circleid,2);}
ObjEffect_SetScale(circleid,scale2/10,scale2/10);
if(Obj_GetX(circleid)!=GetX){Obj_SetX(circleid,GetX);}
if(Obj_GetY(circleid)!=GetY){Obj_SetY(circleid,GetY);}}
magiccircle2++;}
if(change==0&&constant==60){scale=scale+0.02;}
if(scale>=15&&change==0){scale=15;change=1;constant=0;}
if(change==1&&constant==60){scale=scale-0.02;}
if(scale<=10&&change==1){scale=10;change=0;constant=0;}
if(constant!=60){constant=constant+1;}
if(change2==0&&constant2==60){scale2=scale2+0.02;}
if(scale2>=15&&change2==0){scale2=15;change2=1;constant2=0;}
if(change2==1&&constant2==60){scale2=scale2-0.02;}
if(scale2<=10&&change2==1){scale2=10;change2=0;constant2=0;}
if(constant2!=60){constant2=constant2+1;}
}
ObjSpell_SetIntersecrionLine
The fuck do i use this?GenericTouhouFailure >Ok. Gonna try when i'm free. (Like in two weeks time D: Examinations Shucks Bawlz)
For example if you put ObjSpell_SetIntersecrionLine(obj,0,0,384,448,2,10,true);
It's like having a diagonal laser starting at (0,0) going to (384,448) doing 2 pixel width like that :
(http://img683.imageshack.us/img683/8861/setintersecrionline.png)
I think it's used to made a shot hitbox for like written, bomb or custom lasers.
Sure of nothing, never used but it looks like to work like that.
@DrawLoop{
SetTexture(bg);
SetGraphicRect(0,0,447,1000000);
DrawGraphic(GetCenterX,GetCenterY+scroll);
scroll=scroll+scrollspeed;
}
@DrawLoop{
SetTexture(bg);
SetGraphicRect(0,0 + scroll,447, 479 + scroll);
DrawGraphic(GetCenterX,GetCenterY);
scroll=scroll+scrollspeed;
}
For the second problem, the G in @BackGround needs to be capitalized. Standard beginner's error; don't feel bad.Actually, one of the tutorials (can't remember where) about stages had @Background without capital G if I am not wrong.
I've been trying to get that drawing enemy problem to work for like 2 weeks now
Today at 01:07:24 am
you can't seperate parameters with a '-' , Danmakufu reads it as parameter minus another parameter. At least I think thats it, when I do that it works until the next thing-like-this comes up.reread parameters for atan2 again plz
And what Bluely Blue said as well
reread parameters for atan2 again plz
Have anyone here tried to replicate Utsuho's great balls of sun-fire? I want to create something like it but with other aesthetics, but I am unsure how I should proceed with it. Here are the components, obtained from Drake's projects thread:http://i902.photobucket.com/albums/ac221/MasterSpark89/PurpleSun.png (http://i902.photobucket.com/albums/ac221/MasterSpark89/PurpleSun.png)
Purple Sun (http://i902.photobucket.com/albums/ac221/MasterSpark89/PurpleSun-1.png)
Sun Darkness (http://i902.photobucket.com/albums/ac221/MasterSpark89/SunDarkness.png)
Sun Aura (http://i902.photobucket.com/albums/ac221/MasterSpark89/SunAura.png)
Sun Frame (http://i902.photobucket.com/albums/ac221/MasterSpark89/SunFrame.png)
I imagine that the blob of actual colour can be treated like an Object Bullet, and then have the other bits drawn above and under it. Can Object Effects/drawing be applied on top of an Object Bullet's graphic? :o
Edit: Also, if anyone happens to know in which order the above parts should be applied, that would be great too.
Oh, so only the "Sun Darkness" and "Sun Frame" bits are needed? But where does the red colour come from in the original work?you need to alter the color.
you need to alter the color.
In danmakufu if you use ObjEffect_SetColor(obj,vertex,a,r,g,b);
you can tint your sun in a certain color.
...I knew that.Ugh. Its not easy to judge a person's skills by their posts :3
:V
Anyway, the point here is that I want to recreate Utsuho's suns, but have them purple and with them getting gradually darker closer to the center.
Thanks for your help, you've really given me something to go by here. :)
i have another question, how do you change the skin of danmakufu ( the part of the screen holding the lives and that )
Oh and... which one of them should have the transparent background?Alpha-blended images contain an R,G, B and A value for each pixel. The A value determines transparency, and for danmakufu (0,0,0) denotes a transparent pixel as well as pixels that already have an alpha channel of 0. Because of this, an image whose pixels all have an alpha channel of 255 are perfectly fine with a black background, because all the black disappears and the rest stays without change. However, if an image had a black background and some pixels do not have an alpha of 255, the black combines with the semi-transparent pixels and produces a pixel that is not black, and as such is drawn at whatever that rgb color is, at 255 alpha, instead of having a predetermined alpha channel. Therefore, if you're going to draw an image with any semi-transparent pixels, use a transparent background.
Ooh, I know that one. Add a PNG image to the 'img' folder in your Danmakufu root directory - the place where you find the custom.exe and all that. Have the image at the dimensions 640x480 and name it STG_Frame, and it should work. :)Actually, also due to the way DNH handles images, an image will appear blurred unless the dimensions are both powers of two. Therefore you should increase the canvas size to 1024x512 (to the right and bottom); DNH won't draw the extra.
It's funny that you mention that, Azure, since that's just what I discovered myself as well. I followed Helepolis' tutorial on Object Effects and ended up with this.Looks SECK SEE.
The Purple Sun of Xereus (http://www.youtube.com/watch?v=PohqHH5bvGk)
Edit: You'll want to watch this in HD and turn it up to fullscreen. Youtube's really massacred the sharpness.
So far it consists of two Add-blended images spinning in opposite directions, and a lower-layered Alpha image to keep the centre free from transparency. I'm sure I could touch it up by adding some irregularity into the motions, but it's looking pretty spiffy already if I may say so myself.
Thanks for your help guys. :)
Edit: Might spawning the Sun on top of a familiar and then have it keep a track on the enemy's movement every frame and follow it work?Yes, that would be the easiest way to do it.
So ummm...
For some reason, whenever i kill an enemy on a stage script (the regular way, VanishEnemy, etc) the rest of the on-screen enemies' sprites disappear
And they don't get deleted when they fly off-screen (unless i do something like if(GetX>GetClipMaxX){ VanishEnemy; } ... but then the rest of the enemies that are onscreen turn invisible)
For the first problem, each graphic can only be loaded into memory once, and loaded graphics/sounds are universal - they apply to every script that's called (stages, enemies, bosses, etc). If you call LoadGraphic(image) when the image is already loaded, it's ignored. Then, since you have DeleteGraphic(image) in finalize, that image is deleted for ALL enemies, so they vanish. The solution is to call LoadGraphic and DeleteGraphic in the stage's@Initialize and @Finalize, rather than the enemy's.
Protip: If music isn't working, it's either-It's danmakufu and your computer not agreeing (My Vista doesn't play MP3's or WAV's but sound effects work fine)
-You didn't load it
-Typo
-It's the music file
CreateShotA(0,rand(GetClipMinX,GetClipMinX+100),rand(GetClipMinY,GetClipMaxY),20);
wait(1);
CreateShotA(1,rand(GetClipMaxX-100,GetClipMaxX),rand(GetClipMinY,GetClipMaxY),20);
wait(1);
CreateShotA(2,rand(GetClipMinX,GetClipMaxX),rand(GetClipMaxY-100,GetClipMaxY),20);
wait(1);
SetShotDataA(0,20,0,GetAngle,0,0.01,1,36);
SetShotDataA(1,20,0,GetAngle,0,0.01,1,36);
SetShotDataA(2,20,0,GetAngle,0,0.01,1,36);
FireShot(0);
FireShot(1);
FireShot(2);
How would one revert player death in stage scripts
Eg: if implementing a custom border system like PCB's
When a player gets hit, how do you revive the player without the player pressing x?
SetPlayerInvincibility?
or save the player's x and y and when OnPlayerMissed is called, ShootDownPlayer; <-prevents deathbombing ExtendPlayer(1); and then once the player revives resume the player's x and y?
What is the best way to do this?
There's a built-in Border funtction; SuperNaturalBorder() to set, and GetTimeOf~ to see the status. If you want custom behavior, you can be sniffing for the three different methods of ending a border (gettime==1 for timing out, bomb key for manual cancel, gettime==0 for collision) each frame. If you want to prevent bullets from clearing on a broken border, you could do something with bomb resistance (though it might get a bit complicated if you don't want them to actually be bomb resistant).Actually I used SuperNaturalBorder before but it kinda sucks so :V
Probably. I haven't used this function myself, so these are just rough ideas.
*Make an enemy shoot revenge bullets when destroyed.
This. You just shoot the bullets in @Finalize...Oh crap, I thought it was some special function or something that had to do with If EnemyBeDeleted or something weird. Thanks.
How do you delete the default sound effects again? :derp:Uh. DeleteSE("seFapfapfap.wav"); ?
seSuperNaturalBorder1.wav //activation of SNB
seScore.wav
sePlayerSpellCard.wav //SFX when player uses a SC
sePlayerShot01.wav //SFX for player shot
sePlayerCollision.wav //SFX when player dies
seGraze.wav //SFX for grazing
seGetSpellCardBonus.wav //...
seExplode01.wav
seEnemyExplode01.wav //when you defeat a yosei
seBomb_ReimuB.wav // i think this is obvious
seBomb_ReimuA.wav //so is this
se1UP.wav //Extend! lives
seUseSpellCard.wav //I think it's the one when you call SetScore(score);...
seSuperNaturalBorder2.wav //Maybe when you crush a SNB.
Code: [Select]snip
Wait a sec... Is that from MY reply to the unraveling th_dnh.dat topic? :3Yes officer. Are you gonna charge me for copyright? :smug:
Sooo~ How do I make a Menu a la CtC?
Yes officer. Are you gonna charge me for copyright? :smug:
:derp:OBJ_EFFECT SPAM ??? PROFIT
Here's the raw menu code from my abandoned game (http://pastebin.com/7FFgHMk0)
Here's the tutorial on the wiki.
That's how I learnt menus (http://dmf.shrinemaiden.org/wiki/index.php?title=Wonderful%E2%98%86Life%27s_Introduction_to_Menus)
I have question.
I wanna shoot a stream of bullets at where the player is but not have it move if the player does.
Like, I guess, get the player's location one frame and shoot the stream to that location.
I dunno if I worded that right...
task ShootLine(x, y, tx, ty, v, graph, n, t){
let tang = atan2(ty-y, tx-x);
loop(n){
CreateShot01(x, y, v, tang, graph, 0);
loop(t){ yield; }
}
}
Not sure if I missed the function for it but .... how do I hide the default health bar ?Not possible.
task SPFinalize{
CreateEnemyFromFile(CSD~"spell1.txt",GetX,GetY,0,0,0);
loop(30){
let a = rand(0,360);
let x = rand(30,60)*sin(a);
let y = rand(30,60)*cos(a);
CreateMOFItem("POINT",GetX+x,GetY+y);
}
}
Replace SPFinalize with @Finalize or somethingWarning - while you were typing a new reply has been posted. You may wish to review your post.Dammit I hate you
let lastgraze=0;
@MainLoop{
if(GetGraze>=x&&lastgraze<x){
AddPoint(1000);
}
lastgraze=GetGraze;
}
This will run the AddPoint code a single time once your graze counter reaches x. It checks if your graze counter is greater than or equal to x, but your graze counter last frame wasn't.
Awesome. Thanks.Code: [Select]let lastgraze=0;
This will run the AddPoint code a single time once your graze counter reaches x. It checks if your graze counter is greater than or equal to x, but your graze counter last frame wasn't.
@MainLoop{
if(GetGraze>=x&&lastgraze<x){
AddPoint(1000);
}
lastgraze=GetGraze;
}
SetDefaultStatusVisible(false);
task PlayerOther{
let sys=csd~"img\SystemA.png";
LoadGraphic(sys);
yield;
let oLife0 = []; let oLife = [];
loop{
ascent(let p in 0..8){
oLife0 = oLife0 ~ [p];
oLife0[p] = Obj_Create(OBJ_EFFECT);
ObjEffect_SetPrimitiveType(oLife0[p], PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(oLife0[p], 4);
ObjEffect_SetTexture(oLife0[p],sys);
ObjEffect_SetLayer(oLife0[p],8);
ObjEffect_SetVertexXY(oLife0[p], 0, -8, -8);
ObjEffect_SetVertexXY(oLife0[p], 1, -8, 8);
ObjEffect_SetVertexXY(oLife0[p], 2, 8, -8);
ObjEffect_SetVertexXY(oLife0[p], 3, 8, 8);
ObjEffect_SetVertexUV(oLife0[p], 0, 80, 2);
ObjEffect_SetVertexUV(oLife0[p], 1, 80, 18);
ObjEffect_SetVertexUV(oLife0[p], 2, 96,2);
ObjEffect_SetVertexUV(oLife0[p], 3, 96,18);
Obj_SetPosition(oLife0[p],x + p * 16,y);
}
ascent(let q in 0..GetPlayerLife){
oLife = oLife ~ [q];
}
ascent(let p in 0..length(oLife)-1) {
oLife[p] = Obj_Create(OBJ_EFFECT);
ObjEffect_SetPrimitiveType(oLife[p], PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(oLife[p], 4);
ObjEffect_SetTexture(oLife[p],sys);
ObjEffect_SetLayer(oLife[p],8);
ObjEffect_SetVertexXY(oLife[p], 0, -8, -8);
ObjEffect_SetVertexXY(oLife[p], 1, -8, 8);
ObjEffect_SetVertexXY(oLife[p], 2, 8, -8);
ObjEffect_SetVertexXY(oLife[p], 3, 8, 8);
ObjEffect_SetVertexUV(oLife[p], 0, 0, 2);
ObjEffect_SetVertexUV(oLife[p], 1, 0, 18);
ObjEffect_SetVertexUV(oLife[p], 2, 16,2);
ObjEffect_SetVertexUV(oLife[p], 3, 16,18);
Obj_SetPosition(oLife[p],x + p * 16,y);
}
yield;
if (OnPlayerMissed) { Obj_Delete(oLife[length(oLife)-1]); }
ascent(let p in 0..length(oLife0)){
Obj_Delete(oLife0[p]);
}
ascent(let p in 0..length(oLife)){
Obj_Delete(oLife[p]);
}
}
}
I'm using this code from Mitori's script to draw the right-hand display, but there are a few parts I don't understand. What happens if a yield; is placed at the top ? And why doesn't the infinite loop freeze DMF ?
[codez]
@Initialize {
LoadImages;
CreateRenderTarget("bg",384,448);
SetRenderTarget("bg");
//SetTexture and stuff, which I assume is just copying stuff from @BackGround ?
SetGraphicAngle(0,0,0);
SetGraphicScale(1,1);
SetTexture(bgb);
SetGraphicRect(bgscr,-bgscr,512-bgscr,512-bgscr);
DrawGraphic(GetCenterX,GetCenterY);
SetTexture(bgt);
SetAlpha(224);
SetGraphicRect(0,0,256,256);
SetGraphicScale(1.5,1.76);
SetGraphicAngle(0,0,0);
bgscr-=3;
DrawGraphic(GetCenterX,GetCenterY);
SetRenderTarget("DEFAULT");
(by the way, the bgscr variable is used to scroll the image and changes every frame, but AFAIK @Initialize only runs each line once. Do I need to move the bgscr-=3; line into a loop ?)@DrawLoop {
SetTexture("bg");
SetGraphicRect(0,0,384,448);
DrawGraphic(GetCenterX,GetCenterY);
}
@Finalize {
DeleteImages;
ClearRenderTarget("bg");
}
Oh ... I get it now. (yield has always been bugging me because people seem to just throw it all over the place and their codes would still work >_>)I didn't check the code but.
I'm trying to use a render target to re-draw my background. I've been following Azure's tutorial but the result was pretty messed up. Did I do it wrong somewhere ?Code: [Select]@Initialize {
(by the way, the bgscr variable is used to scroll the image and changes every frame, but AFAIK @Initialize only runs each line once. Do I need to move the bgscr-=3; line into a loop ?)
LoadImages;
CreateRenderTarget("bg",384,448);
SetRenderTarget("bg");
//SetTexture and stuff, which I assume is just copying stuff from @BackGround ?
SetGraphicAngle(0,0,0);
SetGraphicScale(1,1);
SetTexture(bgb);
SetGraphicRect(bgscr,-bgscr,512-bgscr,512-bgscr);
DrawGraphic(GetCenterX,GetCenterY);
SetTexture(bgt);
SetAlpha(224);
SetGraphicRect(0,0,256,256);
SetGraphicScale(1.5,1.76);
SetGraphicAngle(0,0,0);
bgscr-=3;
DrawGraphic(GetCenterX,GetCenterY);
SetRenderTarget("DEFAULT");Code: [Select]@DrawLoop {
SetTexture("bg");
SetGraphicRect(0,0,384,448);
DrawGraphic(GetCenterX,GetCenterY);
}Code: [Select]@Finalize {
DeleteImages;
ClearRenderTarget("bg");
}
3 Parameters
1) The name of the render-target texture you want to create
2) The width of the render target to be created, must be a power of 2 (2, 4, 8, 16, 32, 64, 128, 256, ...)
3) The height of the render target to be created, must be a power of 2
and i'm pretty damn sure that 384 and 448 are not powers of 2 unless my math fails really hard.and i'm pretty damn sure that 384 and 448 are not powers of 2 unless my math fails really hard.
@BackGround{
SetViewTo(0, 0, 0);
SetViewFrom(-200, 0, 0);
SetFog(0,500,0,0,0);
SetGraphicAngle(90, 0, 0);
SetTexture(bg_floor);
SetGraphicRect(0, 0, 2400, 450);
DrawGraphic3D(600-(frame%1280)/2,-50,0);
}
With CreateEnemyFromFile, you don't have to put everything into the same script file. That way the code becomes easier to read. On the other hand, if you already have a lot of files in the parent script folder, you may want to keep the number of files low, so in that case it would be helpful to use CreateEnemyFromScript instead.So to create a child enemy in the same script, I just put another script_enemy_main name {} after the first @Finalize ?
Although, if you use CreateEnemyFromScript, danmakufu has a little problem that can get annoying:Uh, if they are both already in the same file, you would only need to call #include_function once at the top, wouldn't you ? :/
You can use #include_function for any specific function only once per script. This means if you want to include a certain universal script block in both the parent and the child enemies, you can't include it with #include_function in both script parts when they are in the same file. In that case, you would have to use CreateEnemyFromFile.
And while we're talking about CreateXFromScript, when is CreateShotFromScript actually needed ? (it doesn't seem to be any better than normal object shots)It's the same type of thing as object familiars and enemy familiars. They each have different advantages, and different amounts of "connection" to the boss script. Shot objects just happen to be able to do things more efficiently most of the time, because shots don't need their own hitboxes/health/etc like familiars sometimes need.
So to create a child enemy in the same script, I just put another script_enemy_main name {} after the first @Finalize ?You have to put the script_enemy ENEMY_NAME{} of the child enemy after the closing bracket of the script_enemy_main{} of the script. That also means that the #include_function won't be included in the child script. But since it is still the same file, a clause probably meant to prevent infinite loops during the script loading prevents the same #include_function from working more than once.
Uh, if they are both already in the same file, you would only need to call #include_function once at the top, wouldn't you ? :/
And while we're talking about CreateXFromScript, when is CreateShotFromScript actually needed ? (it doesn't seem to be any better than normal object shots)I have no idea. :derp:
And while we're talking about CreateXFromScript, when is CreateShotFromScript actually needed ? (it doesn't seem to be any better than normal object shots)
@BackGround{
SetViewTo(0,0,0);
}
Code: [Select]@BackGround{
SetViewTo(0,0,0);
}
The error message shows that there is something wrong with SetViewTo. Is there really a mistake or is that because I try to draw 3D stuff in Single scripts? I've already used SetScore in @Initialize so that I can use @BackGround.
is that because I try to draw 3D stuff in Single scripts? I've already used SetScore in @Initialize so that I can use @BackGround.
Is that a stage script you are trying to make?
It turns out I had to put a loop(2){yield;} before TsuchiEvent; was called.
What the hell, Danmakufu?
Hmm I have a question, how do you make things appear off screen, something like Koishi's hell :VIf you by "off screen" you mean outside the "game area," the first thing that comes into my mind is using effect objects. I'm just a newbie to this kind of stuff though.
where your score, lives, etc. are stored, rather than the screen?
How would I get bullets to never spawn on top of the player?
function Checkbullet(rcheck, _regular_bullet_parameters_){
if( ((x-GetPlayerX)^2 + (y-GetPlayerY)^2 )^0.5 > rcheck){
_bullet_spawning_code_;
}
}
If you want to have bullet delay smoke before, you need this instead:task Checkbullet(rcheck, _regular_bullet_parameters_, delay){
CreateShotA(1, x, y, delay);
SetShotDataA(1, 0, 0, angle, 0, 0, 0, graphic);
SetShotKillTime(1, 0);
loop(delay){ yield; }
if( ((x-GetPlayerX)^2 + (y-GetPlayerY)^2 )^0.5 > rcheck){
_bullet_spawning_code_without_the_bullet_delay;
}
}
Okay, say I want DNH to automatically load my script, upon launching, could I do that?no.
Also, can I package my music in a .dat but still call each separate file in the code? If so, how would I go about doing that?dat packing is very glitchy. Tried it and gives you a tonne of weird problems, so i'm not sure on this part.
Edit: Now for my question: What the fuck makes a good stage. I can't make a decent one without spaming rand() or GetAngleToPlayerSee one post from PoSR thread (http://www.shrinemaiden.org/forum/index.php/topic,897.msg258576.html#msg258576),
is there something I could reference or learn from?
/sign
you could decompile the th_dnh.dat and fuck around with stage0.txt (this code executes when running a plural or single file) but i doubt you'd get far.dat packing is very glitchy. Tried it and gives you a tonne of weird problems, so i'm not sure on this part.
Even if you did make it automatically launch, what about the pause menu? And the "return to menu" key? And what about when the script ends, or you get an error, or want to save a replay?Well, that's true. Let's just say, that it is probably possible, but not really needed and a LOT of work ;3
Really, it's not going to be possible. Just pack everything into a single zip/rar file, including Danmakufu, then include a readme saying "run th_dnh.exe and mash Z until you get to a menu screen that's not blue." Most people should be able to understand it.
Afternoon folks. Just got DMF today and I'm having some crashing troubles - specifically, if I make it to the end of a spell in Single mode. So far I've only tried the included EX-Rumia spells, and I personally can't beat the Plural-mode.Some copies of DNH are quite frankly broken beyond belief.
In addition, when going down the list of spells in Single mode it doesn't show the preview screenshots. I tried it without AppLocale and they show fine (but it crashes if I try to play it). I feel like I'm missing something obvious here, but I don't know what.
let array=[0, 0, 0];
array[2]=180-array[2];
bad allocationlet array[0, 0, 0];
let tempval=array[2];
tempval=180-tempval;
array[2]=tempval;
worksSome copies of DNH are quite frankly broken beyond belief.
My copy for example is only able to use the directory command without crashing.
alpha=absolute(x-GetPlayerX)*2+100; //the 2 sets how far you have to be away for it to be maximum opacity (opacity units per 1 pixel of difference), and the 100 sets the minimum opacity
if(alpha>255){alpha=255;}
k=0;
loop(4){
ObjEffect_SetColor(obj,k,alpha,255,255,255);
k++;
}
Thanks!Code: [Select]k=0;
loop(4){
ObjEffect_SetColor(obj,k,alpha,255,255,255);
k++;
}
ObjEffect_SetVertexColor(obj,k,alpha,255,255,255);
As far as I know yours doesn't exist, does it?
as long as it's defined it's good lololWell...yeah :V
function EffectSetAlpha(n,a){ ascent(i in 0..n){ ObjEffect_SetVertexColor(obj,i,a,255,255,255); } }
Octopus: you should be using the language at the very bottom.
In that case couldn't you just edit that into stage0 instead of in the script?Gave it a try. The exact code doesn't seem to work, but I try out some other things...
dnhfolder\se\seEnemyExplode01.wav
and 02
Did you install all languages from your Windows CD?
Can you actually see japanese letters at the alst language or only 3 squares?
I can see the kanji on the last one, and the characters on the last three. (That's on my mother's laptop, but on my normal computer I can't. Does it matter, if so don't worry I'll work it out. Hopefully.)Yeah, you need to install all eastern asian language files from your Windows CD first, before you can use Applocal correctly.
Sorry to shift the course of the current discussion, but is there a way to make a user defined player spellcard NOT nullify bullets and stuff and suck them into it like point items? I was hoping that skipping the CollectItems(); that Stuffman placed in the MainLoop of his tutorial would do the trick, but I was wrong. Is there any way at all to disable this annoying behaviour?Don't use the ObjSpell_SetIntersecrionCircle and ObjSpell_SetIntersecrionLine commands on the spell objects..?
Don't use the ObjSpell_SetIntersecrionCircle and ObjSpell_SetIntersecrionLine commands on the spell objects..?
Yeah, you need to install all eastern asian language files from your Windows CD first, before you can use Applocal correctly.
If you don't have the disc, you can download the folder needed online. It's called I386. If you can't find it, I do still have my copy.He is right, you can borrow any CD you want. In this case, Windows suprisingly doesn't look at the serial codes or something and lets you use anything, as long as you got all the data...
Make the bullets into spell objects instead, then when you call the intersecrion functions, just set them to not destroy bullets. The only problem is that they'll be forced to penetrate enemies rather than being destroyed in one hit.
OK, so I want to make a pattern like this:Board.
a circular pattern of 18 blue bullets stops after around a second, turn into aqua bullets and then resume movement, but on random directions(for each bullet)
This is a Cirno Boss btw :derp:
function wave(x, y, v1, t, v2){
let ang=rand(0,360);
ascent(i in 0..18){
CreateShotA(1, x, y, 0);
SetShotDataA(1, 0, v1, ang+360*i/18, 0, 0, 0, RED01);
SetShotDataA(1, t, 0, ang+360*i/18, 0, 0, 0,AQUA01);
SetShotDataA(1, t+60, v2, rand(0, 360), 0, 0, 0,AQUA01);
}
}
Something like that.
EDIT: iryan you weren't supposed to do it for himsorry :ohdear:
Danmakufu is raising retarded error, what do I do? (http://img203.imageshack.us/f/errorbe.png/)You should be able to figure it out from looking at it.
Also, I took a look at the codes you both gave me, and I must say I'm confused, what is de "i" and the "t"? and I'm assuming "v1" and "v2" stands for velocity 1&2
ascent(i in a..b){
DoStuff;
}
This code block would create an integer variable "i" with a value of "a", repeat the DoStuff; command several times, but for each repetition, the value of the variable "i" is increased by 1. This is repeated until "i" assumes the value of ("b"-1). if (circle5==600)
{
PlaySE(shotsound03);
loop(36)
{
CreateShotA(5,GetX+40*cos(angle),GetY+40*sin(angle),0);
SetShotDataA(5,0,3,angle2,0.2,0,1,AQUA23);
FireShot(5);
CreateShotA(6,GetX+40*cos(angle),GetY+40*sin(angle),0);
SetShotDataA(6,0,3,angle2,-0.2,0,1,AQUA23);
FireShot(6);
CreateShotA(6,GetX+30*cos(angle),GetY+30*sin(angle),0);
SetShotDataA(6,0,3,angle2,0.2,0,1,AQUA23);
FireShot(6);
CreateShotA(7,GetX+30*cos(angle),GetY+30*sin(angle),0);
SetShotDataA(7,0,3,angle2,-0.2,0,1,AQUA23);
FireShot(7);
angle2+= 360/36;
circle5 = 0;
}
}
But is there no way to change it from being assigned to the C key? The wiki mentions that C is merely the default value.My guess would be the config.exe. But I don't know where because I don't read Japanese.
First of all: Wow, that was fast.No, you need to increment "angle".
Second: Either I'm not understanding you, or you're incorrect (probably the former). Do you mean increment angle2 with angle2++ ? That doesn't work. Do you wan't me too get rid of the whole "cos" and "sin"? That doesn't work either.
Has anyone noticed some strange stuff with bullet deletion for CreateShotAs ?
Normally danmakufu handles the fieldboundaries + some pixels as the auto-delete area for any bullet travelling beyond it right? (excluding obj bullets which cannot be destroyed)
When I test my spell card solo, the bullets that leave the screen disappear. How ever if I test the same card during my stage the bullets return back into my screen, stacking up each time. I don't remember putting any code altering the bullet deletion in my stage script. I simply made a curving CreateShotA pattern where bullets being spawned, travel forward while curving and surely leave the screen enough to be actually deleted. Guess what, they return after like 4-5 seconds of travelling.
Don't ask me to post code because it has no use to post 2000 lines of code. So what is going on?
#TouhouDanmakufu
#Title[Attack Name]
#Text[Attack Description]
#BGM[.\bgm.mp3]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main {
let frame = 0;
@Initialize {
SetLife(1000);
SetEnemyMarker(true);
SetTimer(60);
MagicCircle(true);
SetMovePosition02(GetCenterX, GetCenterY - 100, 120);
}
@MainLoop {
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 24);
if(frame==5){
CreateShot12(46, 40, 10, 2, -0.5, 1, -20, 10, RED01, 10);
CreateShot12(400, 40, -10, 2, 0.5, 1, 20, 10, RED01, 10);
frame = 0;
frame++;
}
if(frame==20){
CreateShot01(GetX, GetY, 3, GetAngleToPlayer, GREEN01, 10);
frame = 0;
frame++;
}
}
@DrawLoop {
}
@Finalize {
}
}
@MainLoop {
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 24);
alternative(frame)
case(5){
CreateShot12(46, 40, 10, 2, -0.5, 1, -20, 10, RED22, 10);
CreateShot12(400, 40, -10, 2, 0.5, 1, 20, 10, RED22, 10);
frame = 0;
frame++;
}
case(20){
CreateShot01(GetX, GetY, 3, GetAngleToPlayer, GREEN22, 10);
frame = 0;
frame++;
}
}
So I've been looking through the basics and the first little bit of the intermediate tutorials, and I'm used to the general CreateShot commands and all that stuff.
And I'm wondering why this isn't working:Code: [Select]snip
@MainLoop {
frame++;
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 24);
if(frame%5==0){
CreateShot12(46, 40, 10, 2, -0.5, 1, -20, 10, RED01, 10);
CreateShot12(400, 40, -10, 2, 0.5, 1, 20, 10, RED01, 10);
}
if(frame==20){
CreateShot01(GetX, GetY, 3, GetAngleToPlayer, GREEN01, 10);
frame = 0;
}
}
This is sorta silly.SetX/SetY? Obj_SetX/Obj_SetY?
Is there a way to make familiars have more complex movement than shooting them like bullets? I mean, I have some movement scripts on the familiar enemy script, but they do nothing.
SetX/SetY? Obj_SetX/Obj_SetY?I thought of those, but I'm not sure if they can create smooth movement.
Of course it doesn't work.
The variable "frame" doesn't increment until it has a value of either 5 or 20. Which you never actually make happen.
Fix: put one of the frame++; just after @MainLoop { and delete the other one.
Like so: (i also fixed some teensy "errors")Code: [Select]fixed code stuff
x%n is the denotation of "x modulus n", where the value is the remainder of x/n (or rather r in the equation x=y*n+r). For example.
3%10 = 3
6%10 = 6
9%10 = 9
10%10 = 0
11%10 = 1
12%10 = 2
40%10 = 0
129641%10 = 1
5%3 = 2
72%3 = 0
6001%3 = 1
80%7 = 3
So when you say if(frame%5==0), you mean you want to execute that code every time frame is a multiple of 5. Since MainLoop runs every frame and you increment frame by 1, every 5 frames that code will execute.
If you just say if(frame==5), the code will execute after 5 frames and then never again unless you reset frame to 0 or somewhere below 5.
Hi,I wondered how to shake the camera in the script version 2,because i can't seem to get it to work well... Also, a friend of mine gave me this:http://www.mediafire.com/?ve8r1y22kpykdny It has pretty nice things though where could I find the necessary resources?Because they look awesome,thanks already~
I don't know where to get picture files for the characters compatible with DanmakufuDMF uses regular GIFs and PNGs (and possibly BMPs but there's no reason to use those).
I don't know what every bit of the code to make the game represents.Read the tutorials.
(http://i56.tinypic.com/14y3f3r.png)
Well, i don't get it. I checked and all the { and }'s are okay. I tried just to add a { in the DrawLoop and it asks me to add a }. I tried also adding some random {{{ and the script ran, but there was only a hitbox, i was invincible (that's okay because my Missed loop is empty there's only the yield;) and i couldn't shot.
What can I do?
Visible in the error raise:
you have a ; between the closing ) of your if condition and the opening { of the statement.
:derp:
If you don't have the disc, you can download the folder needed online. It's called I386. If you can't find it, I do still have my copy.
Try navigating through the the Directory menu in Danmakufu to the folder where you unpacked the files. Only thing I can think of...
thing{
}
Whereas I (and many others) do this:thing
{
}
I think that way makes it easer to read, even if it is a little bigger. Anyone here agree? Also, I've been Danmakufu scripting longer than I've been on, or even heard of, (said, I know) this forum.
thing{
stuff;
}
vsthing{
stuff;
}
It doesn't actually change anything; it's just how people read things differently.task Hitbox
{
let obj=Obj_Create(OBJ_EFFECT);
ObjEffect_SetTexture(obj,img_hitbox);
ObjEffect_SetRenderState(obj,ALPHA);
Obj_SetAlpha(obj,255);
ObjEffect_SetLayer(obj,4);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(obj,4);
ObjEffect_SetVertexXY(obj,0,-50,-75);
ObjEffect_SetVertexXY(obj,1,50,-75);
ObjEffect_SetVertexXY(obj,2,-50,75);
ObjEffect_SetVertexXY(obj,3,50,75);
ObjEffect_SetVertexUV(obj,0,0,0);
ObjEffect_SetVertexUV(obj,1,100,0);
ObjEffect_SetVertexUV(obj,2,0,150);
ObjEffect_SetVertexUV(obj,3,100,150);
while(!Obj_BeDeleted(obj))
{
Obj_SetPosition(obj,GetEnemyX,GetEnemyY);
yield;
}
}
It's a big, ugly yellow rectangle that I want to use for hitbox purposes on large things. However, it won't respond properly to the Obj_SetAlpha part. Even if I set it to 0 it will still be shown fully opaque.Another thing,You need to call the AddShot before the bullet you are adding to is fired. I am not 100% sure, but that may mean that you also have to add the tertiary bullet to the secondary bullet before you add the secondary to the primary.
Is it not possible to perform an AddShot on a bullet that was spawned with AddShot? Let's say that I fire bullet (1) like a regular shot, and bullet (2) is then AddShotted from it - can't I then spawn bullet (3) from bullet (2) using the same mechanics as with the first AddShot? I'm trying to get some results with it, but it's all blank at the moment.
AddShot(120,1,2,0);
AddShot(60,2,3,0);
toAddShot(60,2,3,0);
AddShot(120,1,2,0);
and now it behaves exactly like I wanted it to.I am going to say that "img" is a string variable that was defined in the original player script you copied the hitbox code snippet from to make refering to the paths of the images easier.
You need to change that line so that you give the command the actual full (relative, please) pathname of the image you would want to use for your hitbox.
Can you give me an example of how the path should be, please?Welllllll, have you read the avialable danmakufu tutorials here? There is one on player creation as well, so you may want to take a look if you plan to make one.
I'm sorta confused
Sorry ;;;
I should go back to study Danmakufu scripting
Welllllll, have you read the avialable danmakufu tutorials here? There is one on player creation as well, so you may want to take a look if you plan to make one.Not many as of yet.
task fire{
loop{
ascent(i in -29..30){
ascent(j in -14..15){
CreateShot01(GetX, GetY, 3, 90+(i*4), 54, 5);
CreateShot01(GetX, GetY, 1.5, 90+(j*9), 225, 5);
} }
wait(120);
}
}
http://pastebin.com/xXUZkxKZ
code by : Supreme GamesmasterQuote from Drake
Quick question!And this is another question that can be simply tested out yourself with minimum effort you know. Afaik, it doesn't work because player shots are different than regular shots, even though the shot sheets are scripted similar.
Is it possible to use AnimationData (Animated bullets) on a Player's Shot Data?
hi
I have a little problem about sprite animation, I connot animate the boss when he create bullets
the animation of the sprite holds four thumbnail
How can I turn all the bullets into point / star items without ending the spell card?http://dmf.shrinemaiden.org/wiki/index.php?title=Bullet_Control_Functions#DeleteEnemyShotToItem (http://dmf.shrinemaiden.org/wiki/index.php?title=Bullet_Control_Functions#DeleteEnemyShotToItem)
How can I turn all the bullets into point / star items without ending the spell card?
These seem to be really silly questions, but
how do you create custom spell circles to get rid of the annoying white stuff flying around bosses and
how do you make a custom boss explosion for when the boss is destroyed?
To make a custom spell circle, you just need to make an effect object and attach it to the boss and set MagicCircle(false);. To get rid of the white stuff flying around you can replace the effect by putting an transparent png int the th_dnh/img/ folder.MagicCircle(false) also removes the floating stuff. No need to mess around with the images.
task superbullet(x,y,v,dir,graphic,delay){
let anchorbullet=0;
let anchorangle=0;
let anchorspawn=0;
PlaySE(CSD ~ "sfx\tan02.wav");
let anchortoss = Obj_Create(OBJ_EFFECT);
Obj_SetPosition(anchortoss,GetEnemyX,GetEnemyY);
ObjEffect_SetLayer(anchortoss,7);
ObjEffect_SetTexture(anchortoss,Anchor);
ObjEffect_SetPrimitiveType(anchortoss,PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(anchortoss,4);
ObjEffect_SetScale(anchortoss,1,1);
ObjEffect_SetVertexXY(anchortoss,0,-64,-64);
ObjEffect_SetVertexUV(anchortoss,0,0,0);
ObjEffect_SetVertexXY(anchortoss,1,64,-64);
ObjEffect_SetVertexUV(anchortoss,1,128,0);
ObjEffect_SetVertexXY(anchortoss,2,-64,64);
ObjEffect_SetVertexUV(anchortoss,2,0,128);
ObjEffect_SetVertexXY(anchortoss,3,64,64);
ObjEffect_SetVertexUV(anchortoss,3,128,128);
ObjEffect_SetAngle(anchortoss,0,0,90);
Obj_SetSpeed(anchortoss,4);
let anchorbullet = Obj_Create(OBJ_SHOT);
Obj_SetPosition(anchorbullet,GetEnemyX,GetEnemyY);
Obj_SetSpeed(anchorbullet,4);
Obj_SetAngle(anchorbullet,GetAngleToPlayer);
ObjShot_SetBombResist(anchorbullet,true);
ObjShot_SetGraphic(anchorbullet,graphic);
while(!Obj_BeDeleted(anchortoss)){
CreateShot01(GetEnemyX,GetEnemyY,4,90,Anchor,0);
wait(60);
yield;
}
}
I'm sorry, I just really want to get done with this script. >_> Desperation means I don't have much time to read. And thanks!That isn't the correct attitude to have though. Mainly because this thread is read and answered very fast, hence it has already 4 threads in history and lots of pages. There is no such thing as "I am in a hurry so I bluntly post a thread because it will help me faster" in this forum section. Now for your question.
ObjEffect_SetAngle(obj,x,y,z);x y z are the parameters for flipping or tilting the image. X parameter flips the image around the x-axis, y around the y-axis and z makes it rotate. If it is flying to the right of the boss, it means it has a movement angle of 0.
What do the parameters x, y and z stand for? If I leave both x and y as 0 and z as GetAngleToPlayer, the anchor comes out perfectly but it only flies to the right side of the boss. However, the tip of the anchor IS pointing towards the player.
Maybe sticky the Q&A thread too so it's harder to miss?
This one reads stickies. Mostly.
Is there an index of Danmakufu statements? The wiki has a nice list of functions, but not statements. I had a heck of a time finding a reference to "ascent"
Tagging along the talk about functions and stuff, what exactly are the functional differences between a Task and a Function? A common custom function is Wait(w), but how would a Task built in the same way be different?A function is just a shorthand for a piece of code.
The old touhouwiki used to have arbitrary syntax rules somewhere, but they haven't yet been added to the DNH wiki.
ScriptVersion[3] allows hitbox size declaration in shot files, but mkm still hasn't released it :(METAL FATIGUE BULLETS will be so fun. Oh so fun.
METAL FATIGUE BULLETS will be so fun. Oh so fun.Pffft, pushover. Mima's final form bullets, now THOSE will be fun. >:D
Can you get rid of the shiny glow at the base of a CreateLaserA?ObjLaser_SetSource(false);
1. Open the image in MS Paint or a similar program.I'm probably living proof that stickies aren't to be read
How do you get a coordinate in an image?
For example, I made a sprite sheet and in that sprite sheet, there's well a sprite
that I want to use as a life image.
Is this trial and error or is there something I'm missing to find said coordinates?
1. Open the image in MS Paint or a similar program.
2. Zoom in as much as neccessary
3. Move your mouse to the location you want the coordinate of. It should be displayed at the bottom of the window, iirc.
Object oddities galore!
http://pastebin.com/RSFaJvMn
This code is supposed to create a beam from the player, aimed at the angle the task was called with (Only supposed to be used with the angles inside the if statements at the top). After that, the angle changes so it eventually reaches the main laser of the bomb (Aimed at 270 degrees, AKA straight up). However, I'm getting some rare behaviors on the lasers. Help a bro?
You can also enable it in Photoshop with F8 or Window->Info.
DMF chokes on ObjEffect_SetAlphaGreen and I can't find it in either the wiki or the Japanese manual. Where does it come from? Also, what's your BeamImage? I know how it feels when you don't want to release a project before it's done, but maybe you should mock up a full player script that we can test with? Or maybe describe better what the lasers are doing for you.This ain't a problem. SetAlphaGreen is a function made by myself to set all the Vertices' color to green (And set their Alpha value).
Can I ask a question since it's about questions and answers? Umm ok so I was wondering if danmakufu could be runed without applocale just by going to control panel->language and region->administrative->japanese (japan) Or do I Have to download applocale cause I'd rather not. :)Well I did that once and the programs that needed to be run with Applocale didn't need Applocale anymore.
This ain't a problem. SetAlphaGreen is a function made by myself to set all the Vertices' color to green (And set their Alpha value).
http://www.mediafire.com/?7e93f7gt12kgq0c
This is it complete. I'm having problems mostly with the trig stuff however, all the rest of the functions and whatnot are already tested.
Well I did that once and the programs that needed to be run with Applocale didn't need Applocale anymore.Ok thanks! :)
Try it out for yourself and good luck.
I should've come here a while ago :V
I have a script I'm working on that requires lasers to bounce on the screen. But for some reason they delay when bouncing off the top, and don't change position when bouncing off the side.
http://pastebin.com/UdbsSgxU
Can someone help me with this?
GetPointInDirectionarghagh how did I didn't notice this
I'm not at home and can't test but you may want to compare yours to this reflection function:
http://www.shrinemaiden.org/forum/index.php/topic,5164.msg339908.html#msg339908
arghagh how did I didn't notice this
http://www.shrinemaiden.org/forum/index.php/topic,5164.msg494187.html#msg494187Now that I see it, GetPointInDirectionFromPlayer would also be rather useful for hitbox declaration. Thanks!
It would be great if you actually posted your script instead of us having to guess what your mistake is.
whoops, forgot to do that :V
http://pastebin.com/vCYQ69j4
else if(angle>0&&y>GetClipMaxY&&x>GetClipMinX&&x<GetClipMaxX)
{
if(count>0){TReflectionLaser(x, y, v, -angle, maxLen, width, graphic, 0, count-1);}
break;
}
What's the secret to a pretty bullet? Mine look like a kindergartner playing with construction paper, only without the charm.
I'm talking about the sprites. Looking at the existing bullets I think my biggest problem might be using the alpha channel more creatively and somehow getting that glowy aura going. How do you get a glowy aura on your bullet sprite?I don't know much, but what I do know is this:
What kind of shot(s) make(s) Shou's non-spell lasers? They all seem to have two colors.
CreateLaserC
These lasers are usually seen only in Perfect Cherry Blossom, namely against Letty Whiterock or Merlin Prismriver. I'm talking about those annoying curving lasers... or at least they're annoying when Merlin uses them. These lasers are very heavy on the processor so use them sparingly (i.e. don't have fifty of them out at once). However, if you've mastered controlling ShotAs and LaserAs, this will be really easy for you to use. The parameters for CreateLaserC are exactly the same as those of CreateLaserA and the parameters for SetLaserDataC are exactly the same as those of SetShotDataA. In other words, LaserCs are pretty much ShotAs with a tail following them.
Is the hate for curving lasers because they're hard to predict, because they're hard on the processor, both, or neither? Any other patterns/components that should be avoided? Besides the brofist script.
- Too many add blended bullets.Just to note, the main problem is that overlapping bullets make it more difficult to process in the brain since there are no edges between the bullets. You can do as GFW did, and have bullets that are both add-blend AND alpha. Another factor is that it is more difficult to track trajectories with low-contrast areas (talking bullet-to-background), so the bullets should be fairly visible on your BG.
- Puzzle/pathfinding gimmicks.A few, especially in an Extra stage-ish setting, are okay. A very good exception I can name off is Green Eyed Monster, Parsee's midboss card.
- Curvy bullet spam.Going to add that slow curvy bullets can be good, and curvy bullets that you don't have to actively dodge are also fine. It's when you have to constantly process the bullet's trajectories (especially at fast speeds, incl. curvy lasers) that it gets confusing. Worth mentioning in this case are pretty much all off Yuyuko's cards. PCB as a whole has many good cards with curving bullets.
For Obj_IsIntersected, what counts as an "Attackable target"? That is, what makes it return true?Are they bullets/lasers? If so, you can call Obj_SetCollisionToObject(obj, true); after the creation of the object to enagle collision detection against other objects. You then can check for their collision using Collision_Obj_Obj(obj1, obj2). However, this will require that the IDs of the objects you want to collide be stored in a way that they can be accessed by the other bullets, usually meaning: You need to create an array at the beginning of script_enemy_main{ } in which you store the IDs of the objects, and you need to insert code in each object that removes its ID from the array. Then you can check for collision between any of those objects by refering to the places their ID have in the array.
EDIT: Actually, let me just state the problem: How do I act on two objects intersecting each other, given that neither object is a player or an enemy? Do I really need to write my own collision detection from scratch?
However, I have to ask... does it only work with bullets/lasers? Is there a way to do it with an effect object? And what does IsIntersected do then?I don't have a clue.
if( (x1-x2)^2 + (y1-y2)^2 < (radius1+radius2)^2 ){theobjectscollided;}
(x1,y1) is the position of the first object and (x2,y2) is the position of the second. Radius is obvious.
Of course Directory loads faster, it doesn't load every script at once.
Also.
http://alcahest.perso.sfr.fr/perso/apploc/applocpatched.zip
Download that, replace the applocale exe in C:\Windows\AppPatch.
http://alcahest.perso.sfr.fr/perso/apploc/localejaptoexecontext.zip
Download that, run the install reg file.
Right click th_dnh.exe, Properties. Compatibility Mode, change stuff.
Restart comp, right-click th_dnh.exe, Locale Japanese.
All problems solved.
It might be a problem with the script (or how you extracted it), since danmakufu runs fine without compatibility mode on both vista and win7.
Can you move enemies during an event script? Like on PCB stage 4, when Lunasa pops out in the middle.
function SuperHuman(tx, ty, v, ang, n, t, delay){
let px=GetX; let py=GetY;
ascent(i in 0..n){
CreateShotA(1, px+ (tx-px)*i/(n-1), py+ (ty-py)*i/(n-1), t);
SetShotDataA(1, 0, 0, ang+720*i/(n-1), 0, 0, 0, BLUE01);
SetShotDataA(1, delay, 0, ang+720*i/(n-1), 0, 0.1, v, BLUE01);
}
SetMovePosition02(tx, ty, t);
}
Not tested, but this should give you one of Byakuren's dashes in a customizable way. If it works, calibrate, then abuse.
It worked, but the shots appear from the top of the screen and not from Byakuren's trails. Here's the code if there are any problems:Code: [Select]function SuperHuman(tx, ty, v, ang, n, t, delay){
Not tested, but this should give you one of Byakuren's dashes in a customizable way. If it works, calibrate, then abuse.
let px=GetX; let py=GetY;
ascent(i in 0..n){
CreateShotA(1, px+ (tx-px)*i/(n-1), py+ (ty-py)*i/(n-1), t);
SetShotDataA(1, 0, 0, ang+720*i/(n-1), 0, 0, 0, BLUE01);
SetShotDataA(1, delay, 0, ang+720*i/(n-1), 0, 0.1, v, BLUE01);
}
SetMovePosition02(tx, ty, t);
}
task dash{
let px=GetX;
let py=GetY;
let tx=GetCenterX-125;
let ty=GetCenterY-155;
wait(60);
ascent(i in 0..30){
CreateShotA(i,px+(tx-px)*i/(20-1),py+(ty-py)*i/(20-1),1);
SetShotDataA(i,0,0,GetX+720*i/(60-1),0,0,0,246);
SetShotDataA(i,180,0,GetX+720*i/(60-1),0,0.03,2,246);
FireShot(i);
}
SetMovePosition03(GetCenterX-125,GetCenterY-155,10,20);
}
ascent(i in 0..30){
CreateShotA(i,px+(tx-px)*i/(20-1),py+(ty-py)*i/(20-1),1);
SetShotDataA(i,0,0,GetX+720*i/(60-1),0,0,0,246);
SetShotDataA(i,180,0,GetX+720*i/(60-1),0,0.03,2,246);
FireShot(i);
}
wait(60);will cause the bullet trail to be dislocated if the boss moves in these 60 frames.
CreateShotA(b,px+(tx-px)*b/(150-3),py+(ty-py)*b/(150-2),5);Why are these not 1?
[...]
CreateShotA(c,px+(tx-px)*c/(150-5),py+(ty-py)*c/(150-3),5);
I'm trying to recreate Utsuho's sun bullets from Subterranean Animism as Object Effects (with vertices, in other words), but I am completely unable to make it come out right with the colouring and transparency. Have anyone pieced together the correct recipe for them?
Edit: I am using the standard sun components (http://i902.photobucket.com/albums/ac221/MasterSpark89/suntemplate.png?t=1295469841), axed from Drake's thread.
I'm trying to recreate Utsuho's sun bullets from Subterranean Animism as Object Effects (with vertices, in other words), but I am completely unable to make it come out right with the colouring and transparency. Have anyone pieced together the correct recipe for them?
Edit: I am using the standard sun components (http://i902.photobucket.com/albums/ac221/MasterSpark89/suntemplate.png?t=1295469841), axed from Drake's thread.
script_enemy_main {
let frame = 0;
let BossImage = "script\GuardianTempest\img\DemoTrap.jpg";
let BossCutIn = "script\GuardianTempest\img\GeneralJuhziz.jpg";
let angle1 = 0;
@Initialize {
[Juhziz Stuff]
}
@MainLoop {
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 69);
if(frame==60){
CreateShot01(GetX, GetY, 3, angle1, WHITE11, 10);
angle = angle + 10;
frame = 0;
}
frame++;
if(frame==10){
CreateShot01(GetX, GetY, 5, GetAngleToPlayer, BLUE21, 0);
frame = 0;
}
frame++;
if(frame==120){
SetMovePosition03(GetCenterX, GetCenterY, 10, 3);
}
}
[stuff]
}
Can't get it to work...
If I remember correctly it's left part alpha blended with rgb(255, 255, 255) on the bottom and the right part add blended with rgb(255, 0, 0) on top. I believe in SA, one or both the parts are rotating and pulsing too so you'll have to experiment with that.Using that RGB setup looks right, but what's giving me the real trouble is the way that SetVertexColor forces me to apply an Alpha value to each vertex. A lower value for the top part brings transparency, but it also dulls the colour. What I end up with is a solid white core with a drab pink tinting the edges. If I crank the top layer's Alpha up to max it overpowers the rest of it. Can the parameter in SetVertexColor be overridden to assume the original value found in the image?
From what I remember, the object showed its true colors in the center, and became more "pure" red toward the edges. Your best bet would be making an object effect as TRIANGLEFAN. Make a circle with your first vertex at the center with, as blargel said, RGB 255,255,255, and each vertices on the outside or outer edge RGB 255,0,0.I've never used a TRIANGLEFAN primitive type before, do you have an example somewhere of how the vertices are connected? I'm currently using TRIANGLESTRIP for this object effect (4 vertices) with these as the drawing coordinates.
This should give it that glow you want.
ObjEffect_SetVertexXY(bottom,0,-128,-128);
ObjEffect_SetVertexXY(bottom,1,128,-128);
ObjEffect_SetVertexXY(bottom,2,-128,128);
ObjEffect_SetVertexXY(bottom,3,128,128);
ObjEffect_SetVertexUV(bottom,0,0,0);
ObjEffect_SetVertexUV(bottom,1,256,0);
ObjEffect_SetVertexUV(bottom,2,0,256);
ObjEffect_SetVertexUV(bottom,3,256,256);
The object in the image is 256x256. The drawing looks the same for the top part as well, aside from some different UV coordinates as they're in the same image file.create anything functions don't exist in player scripts
besides createplayershot but it might as well be nothing
Huh. 'd be nice if the player tut mentioned that.
CreatePlayerShot01 is the only bullet function for players; anything else will need to be an object shot. Anyway, it's pretty similar to the enemy version, CreateShot01. The difference is the addition of two arguments, which is the two next-to-last. The first (2.5) is the damage the bullet will do. The second (1) is the penetration, or the number of hits the bullet can score, once per frame. If you set the penetration to some huge number the bullet will be able to shoot through every enemy it hits, but be sure to set the damage low if you do something like that! The final argument is the bullet graphic, in this case the blue knives we defined earlier. Player shots cannot have delay.
In that case, is there any way to get object lasers to move automatically? Obj_SetSpeed doesn't appear to be doing anything.
CreatePlayerShot01 is the only bullet function for players; anything else will need to be an object shot. Anyway, it's pretty similar to the enemy version, CreateShot01. The difference is the addition of two arguments, which is the two next-to-last. The first (2.5) is the damage the bullet will do. The second (1) is the penetration, or the number of hits the bullet can score, once per frame. If you set the penetration to some huge number the bullet will be able to shoot through every enemy it hits, but be sure to set the damage low if you do something like that! The final argument is the bullet graphic, in this case the blue knives we defined earlier. Player shots cannot have delay.Huh. Must've skipped that part.
Object lasers do not use Obj_SetSpeed. You will have to set their position every frame using Obj_SetPosition (or Obj_SetX and Obj_SetY).
@MainLoop {
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 32);
if(frame==10){
CreateShot01(GetX, GetY, 5, angle1, WHITE11, 0);
angle1 = angle1 + 10;
}
if(frame==10){
CreateShot01(GetX, GetY, 5, GetAngleToPlayer, BLUE21, 0);
}
if(frame==120){
SetMovePosition03(GetCenterX, GetCenterY, 10, 3);
frame = 0;
}
frame++;
yield;
}
New Problem, yes it moves, it fires though it doesn't fire at the way I want it to.
New Problem, yes it moves, it fires though it doesn't fire at the way I want it to.
Let me guess - you want it to fire once every 10 frames, right? As it stands, the CreateShot01's will happen when 'frame' equals 10, but then 'frame' will keep increasing until it reaches 120, where it resets to zero.
Instead of
"if(frame==10)"
try
"if(frame%10==0)"
which basically tells the script to fire the shots whenever 'frame' is divideable with 10 (at least that's what I think it does). This means that the shots will be fired when 'frame' equals 0, 10, 20, 30, 40 and so on. This will also mean that the shots will be fired just as the script starts, since 'frame' start out as 0. To negate this you can place your frame++ at the top of your main loop instead. That way 'frame' will equal 1 when the script reaches the if-statements for the first time.
if(frame%1==0){
CreateShot01(GetX, GetY, 6, angle1, WHITE11, 0);
angle1 = angle1 + 2;
}
// if(frame%1==0){
// CreateShot01(GetX, GetY, 6, angle2, WHITE11, 0);
// angle1 = angle2 + 2;
// }
// if(frame%1==0){
// CreateShot01(GetX, GetY, 6, angle3, WHITE11, 0);
// angle1 = angle3 + 2;
// }
// if(frame%1==0){
// CreateShot01(GetX, GetY, 6, angle4, WHITE11, 0);
// angle1 = angle4 + 2;
// }
The spinning motion works fine but when I uncomment the three parts, then the fountain just freezes in place for UBER-graze points.
Then once this is fixed I'm done.
Clumping them together didn't work either.
let angle = 2;
let dir = 0;
if(frame%1==0)
{
loop(4)
{
CreateShot01(GetX,GetY,6,dir,WHITE11,0);
dir+=360/4;
}
dir+=angle;
}
So many errors: All enemies dissapear and reapear when just one dies. Some animate correctly, some don't. Etc.All enemies disappear when one dies, eh?
All enemies disappear when one dies, eh?
Obviously, you're: 1) deleting the fairy graphic in the enemy file's @Finalize; then 2) loading the fairy graphic again in the same enemy file's @Initialize.
That's a big no-no.
Instead, you should load and delete every graphic you're gonna use, in the stage itself, rather than in every enemy file.
I tried to load up a danmakufu script (Thaws snow V3 Attack phase 1-L ) and it crashed the Game.
any help? :/
task mainTask{
startexplode;
wait(180);
VanishEnemy;
}
script_enemy_starFam {
should be script_enemy starFam {
Well, now aparrently the problem is on line 161.You have not defined "dir".
http://pastebin.com/Xqt0ajdF
You mean, randomized?
That you do by using let coin=rand_int(0, 1); if(coin==0){ ... } else{ ... }.
|| is a logic operator that you can use inside the if( ) brackets so that the conditions are fulfilled if at least one of two conditions is met.
if(coin==0||coin==1){ stuff } would mean the stuff happens if at least one of the conditions is true, and if coin is always either 0 or 1, that would be everytime.
Neh Neh, I have a question.
I don't really understand how to use || [The or thing]
So let's say you want a bullet to either go at 0 or 90 degree how would you use this ?
[No other angle only 0 and 90]
if(GetPlayerScriptName=="REIMU"){But, if you have another player script, how can I do to make the event only for this script?
CreateEventFromScript("Reimu");
}else if(GetPlayerScriptName=="MARISA"){
CreateEventFromScript("Marisa");}
No one worked
OPTION 1
}else if(GetPlayerScriptName=="player\Sanae\SanaeA.txt"){
CreateEventFromScript("Sanae");}
OPTION 2
}else if(GetPlayerScriptName=="Sanae A"){
CreateEventFromScript("Sanae");}
Hello, I have a question:For SanaeA, use "SanaeA.txt".
In the event script you can use as default MARISA and REIMU scripts...But, if you have another player script, how can I do to make the event only for this script?
No one worked
@Initialize{
SetLife(1);
SetDamageRate(1,1);
LoadGraphic(Boss);
SetGraphicRect(0,0,63,93);
SetX(GetClipMaxX-50);
SetY(-110);
CollectItems;
RaiseError(GetPlayerScriptName, "Sanae A");
SetEnemyMarker(true);
SetMovePositionHermite(cx,120,-90,290,0,0,100);
if(GetPlayerScriptName=="REIMU"){
CreateEventFromScript("Reimu");
}else if(GetPlayerScriptName=="MARISA"){
CreateEventFromScript("Marisa");
}else if(GetPlayerScriptName=="Sanae A"){
CreateEventFromScript("Sanae");
}
}
That's the effect of RaiseError. So yeah, comment it out / Delete it.And in doing so, the programcloses putting it found a problem (i'm such a pain, right?), now what happens!?
@Initialize{
SetLife(1);
SetDamageRate(1,1);
LoadGraphic(Boss);
SetGraphicRect(0,0,63,93);
SetX(GetClipMaxX-50);
SetY(-110);
CollectItems;
RaiseError(GetPlayerScriptName, "Sanae A");
SetEnemyMarker(true);
SetMovePositionHermite(cx,120,-90,290,0,0,100);
if(GetPlayerScriptName=="REIMU"){
CreateEventFromScript("Reimu");
}else if(GetPlayerScriptName=="MARISA"){
CreateEventFromScript("Marisa");
}else if(GetPlayerScriptName=="Sanae A"){
CreateEventFromScript("Sanae");
}
}
now what happens!?
Obj_SetCollisionToObject
2 Parameters
1) object ID
2) collision detection setting
true : performed
false: not performed
Set whether or not collision detection with other objects is performed. The collision detection can be performed by Collision_Obj_Obj.
How do I call and shot a bullet from an external shot data? (In my Case, Expanded ShotData ny Helepolis)
script_enemy_main {
LoadUserShotData(GetCurrentScriptDirectory ~ "andsoon");
@Initialize {
Youmu's blade takes a giant rectangle of bullets if(object bullet is inside this fucking rectangle){explode;} ; it doesn't even bother with object collision. In this case, neither should you :V
How do I call and shot a bullet from an external shot data? (In my Case, Expanded ShotData ny Helepolis)
let SupaShot = GetCurrentScriptDirectory~".\Supershot.txt";
@Initialize{
LoadUserShotData(SupaShot);
}
let SupaShot = Some path that connects to your lib folder ~".\Supershot.txt";
Hnnnggggg :getdown:
EDIT :
I'm stuck again, how do you do that :( ^^^^
I'm stuck again, how do you do that :( ^^^^1. Make task that shoots bullets and increases counter variable
Also , how do you make things respond when it is being attacked by player ?
Second, if GetEnemyLife is less then it was last frame. Or some other similar function.
How do I make it so that the boss shoots two bullets at opposite angles around her body? Like Orin's zombie fairy spellcard at Lunatic. For now I only know how to make them shoot at a particular angle or in a circle around them.
CreateShot01(GetX, GetY,2, GetAngleToPlayer, RED01, 7);
CreateShot01(GetX, GetY,2, GetAngleToPlayer-180, RED01, 7);
CreateShot01(GetX+50*cos(a), GetY+50*sin(a),2, a, RED01, 7);
CreateShot01(GetX+50*cos(a-180), GetY+50*sin(a-180),2, a-180, RED01, 7);
a+=2.5;
Thanks, that's it. What parameter do I change to make it spin faster?"a+=n"
---------------------------
ScriptError?C:Documents and SettingsBrazAmbiente de trabalho h_dnhscriptSayaNoUtaSayaScript.txt?
---------------------------
mainTask??????????(72??)
?
mainTask{
yield;
fire;
movement;
task movement{
loop{
~~~
i hate you allilu too drakeypoo
Whoops/me stabs Laplace
Sorry for making Drake hate all of humanity
:V
/me stabs LaplaceKinky~
/me uses Spell Card: [Error-finding Skill "Double Checking -Hard-"]
If you want to make an array-based stack or something, you can, somewhat.
However, you can compare the array of characters from your current score to an array of characters from a string that keeps your last score string. If a character is different you can update the string and the associated objects, etc.
yeah thats what I want to do ^^ but its just that they way its set up now, once theyre drawn once theres no removing them, I can draw new ones on top just fine but that would be a mess because theyd stack, and eventualy the game would lag from way too many effects, but I think I maybe have an idea, im gonna try it out and see ^^
Okay so all I did was pretty much ruin the script...whoops, I rewrote it so that every letter was stored in an array, so the effect object for the first letter, the one at the very end, is ObjectArray[0], etc. and there didnt seem to be any problems there, but then I try to update the textures of the array of objects much similarly to the first time they were created and given the right number image files, the program crashes, and when I tried the method of deleting them every frame to create new ones, they didnt delete and just piled up constantly droping the framerate instantly, basically its as if they were never put in an array at all, now the whole thing is a mess.
I should probably start a new task for this from scratch after I learn what went wrong...
Well obviously something isn't being deleted. Pastebin please.
task DrawHighScore {
yield;
let Array = [];
ascent(i in 0..11) {
let Obj = Obj_Create(OBJ_EFFECT);
Array = Array ~ [Obj];
SimpleEffect(Array[i], 300-(14*i), 100, Image_0, 17, 24, 1, 8)
}
EffectUpdate(Array[3], Image_Comma, 17, 24, 1);
}
ObjEffect_SetPrimitiveType(Variable, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(Variable, 4);
ObjEffect_SetScale(Variable, Scale, Scale);
ObjEffect_SetLayer(Variable, Layer);
ObjEffect_SetVertexXY(Variable, 0, -Image_X/2, -Image_Y/2);
ObjEffect_SetVertexUV(Variable, 0, 0, 0);
ObjEffect_SetVertexXY(Variable, 1, Image_X/2, -Image_Y/2);
ObjEffect_SetVertexUV(Variable, 1, Image_X, 0);
ObjEffect_SetVertexXY(Variable, 2, -Image_X/2, Image_Y/2);
ObjEffect_SetVertexUV(Variable, 2, 0, Image_Y);
ObjEffect_SetVertexXY(Variable, 3, Image_X/2, Image_Y/2);
ObjEffect_SetVertexUV(Variable, 3, Image_X, Image_Y);
Separate your graphics by at least one pixel on the image, dnh tends to bleed pixels at the fringe of the graphic rects. What you're seeing is the edge of whatever is next to those characters on your graphic. I really don't know why it does this, it just does.
To answer the other question that you for some reason didn't ask in this thread:
let string = "" ~ ToString(variable);
let n = 0;
let res = "";
while (n < length(string) && string[n] != '.')
{
res = res ~ ToString(string[n]);
n++;
}
res is the string with the decimal and all zeros after it removed after the code runs. variable is the original number, before being converted to a String.
Even after two years of dnh I'm still abusing Nuclear Cheese code :V
Oh and that could be the problem, it happened a few times before when I was making shot graphics, but the problem is that each yellow text is their own graphic, so they arent connected, what seems to happen on every graphic is that the very bottom pixels are put on top, no matter what modifications I make to the vertice setup, It's so odd...
All textures are infinitely tiled, so you're seeing the wrap around on the same graphic. The solution is still the same, add at least 1 pixel of blank space around the graphic.
Did you try setting your graphicrect 1 pixel shorter to find out whether it is dnh issue or image issue. I didn't had this issue with my 3D stage. You need to give more information about your files.
- Are you using powers of 2 for the images?
- PNG or BPM ?
- Graphicrects?
It looks like the side of the walls are poking through the top part of the walls. Maybe try putting the top a tiny bit higher? Or make the sides a bit shorter?
function DrawFlowerBlock(X, Y, Z) {
SetTexture(img2);
SetGraphicRect(0, 0, 50, 25);
SetGraphicScale(2, 1);
SetGraphicAngle(0, 0, 180);
DrawGraphic3D(X, Y, Z-12.5);
DrawGraphic3D(X, Y, Z+12.5);
DrawGraphic3D(X, Y, Z-7.5);
DrawGraphic3D(X, Y, Z+7.5);
SetGraphicScale(0.5, 1);
SetGraphicAngle(0, 90, 180);
DrawGraphic3D(X-50, Y, Z);
DrawGraphic3D(X+50, Y, Z);
DrawGraphic3D(X-45, Y, Z);
DrawGraphic3D(X+45, Y, Z);
SetTexture(img3);
SetGraphicRect(0, 0, 100, 25);
SetGraphicScale(1, 1);
SetGraphicAngle(90, 0, 180);
DrawGraphic3D(X, Y+11, Z);
SetTexture(img4);
SetGraphicRect(0, 0, 90, 15);
SetGraphicScale(1, 1);
SetGraphicAngle(90, 0, 180);
DrawGraphic3D(X, Y+5, Z);
}
I also noticed that all transparent parts (like the very tips of the flower patches* cut trough pillars and such, the same thing would happen were I to add floor fog, etc. It seems to be a trait with using ZBuffer, but ZBuffer itself is pretty important, turning it off will draw the objects in order rather than how the camera sees them, if I use it though, then all transperacy hides objects underneath, either method seems to do some negative effect on my background so I'm kinda at a loss...the lines arent a problem without ZBuffer by the way, but is there a way to use it without low alpha values hiding objects?
Example:
http://i786.photobucket.com/albums/yy145/FurryGoatSammy/Example.png
What function do I use to make bullets move in a random direction? Or having a boss shoot in a random direction?
Not sure why the music isn't working though. Does it happen for all mp3s? Are the tags maybe messed up in some way?
#TouhouDanmakufu
//*etc*
#include_function("script\Functions\SpellcardName.txt");
script_enemy_main{
@Initialize{
let nameofspellcard="transfer_this_string_to_the_SpellcardName_function_plz";
}
@MainLoop{
}
@BackGround{
}
@DrawLoop{
}
}
SpellcardName{ // Is this right?
@Initialize{
//Where's that data I asked for?
}
@MainLoop{
}
@Finalize{
}
}
Could someone explain to me how to use Common Data?
I tried using it before but it had zero result.
I'm probably doing something wrong, but I can't find out what it is.
I was trying to make a spellcard captured/played counter for my game.
So I have an enemy script, and I want to make a custom healthbar and timer and such appear. How would I do this without copy-pasting it in every script?
I've looked around #include_function, which apparently lets me paste a file's contents in my enemy script.
So I did it like this:
*c0d3z*
I'm missing that bit of info, does anyone know how to send that string over to the included script?
function AnotherCreateShot01(x, y, speed, angle, graphic, delay) {
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, x, y);
Obj_SetSpeed(obj, speed);
Obj_SetAngle(obj, angle);
ObjShot_SetGraphic(obj, graphic);
ObjShot_SetDelay(obj, delay);
}
This bit of code makes a function called AnotherCreateShot01 that behaves EXACTLY like the built in CreateShot01 function. Basically if you were to put this in an enemy script and replace all instances of CreateShot01; with AnotherCreateShot01;, it would work exactly the same. What I'm trying to demonstrate here is that you can write your own shot creation functions for types of shots you find yourself using really often. By extension, once you're able to write functions for controlling shots, you should be able to start working on writing functions to handle other things like drawing. Eventually you should even be able to start working with tasks.function GetDistance(x1, y1, x2, y2){
return ((x1-x2)+(y1-y2))^0.5
}
Another great use for functions is to do calculations. Would you rather see GetDistance or a giant long string of calculations? Making a function like this makes it more apparent what you're trying to accomplish instead of just what looks like a random calculation. The return keyword makes the function spit out a value that can be used at wherever the function was called. This means you can do something like let variable = GetDistance(GetPlayerX, GetPlayerY, GetX, GetY); to store the current distance from the boss to the player in the variable, similar to how you would use let variable = Obj_GetSpeed(obj); to store the current speed of an object in a variable.
function CreateShot01T(x, y, s, a, g, d) {
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, x, y);
Obj_SetSpeed(obj, s);
Obj_SetAngle(obj, a);
ObjShot_SetGraphic(obj, g);
ObjShot_SetDelay(obj, d);
}
function CreateShot01S(x, y, s, a, g, d) {
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, x, y);
Obj_SetSpeed(obj, 0);
Obj_SetAngle(obj, 0);
ObjShot_SetGraphic(obj, g);
ObjShot_SetDelay(obj, d);
while(!Obj_BeDeleted(obj)){
Obj_SetX(obj,Obj_GetX(obj)+cos(a)*s);
Obj_SetY(obj,Obj_GetY(obj)+sin(a)*s);
}
}
No wonder nobody fuckin' scripts anymoreRaNGE is too quiet these days. Someone should stir it up a little. A new game perhaps?
CommonData is, in short, a global variable that you can pass along between scripts, and even between play sessions. You declare a variable name and then give it a value, and that value can be accessed from any script you've made. For example, normally you would declare a variable within a script likeHmm, that might've been a little too basic. Okay, I formulated my question a little poorly, didn't I?
(Wall of text and code)
He has some fetish or something it seems.
That was obviously a joke puremrz :V
Anyway, RikaNitori seems indeed quiet lately. Wonder what happened to all major games being made. So far only drake/naut, azure and stuffman seem to be active.
As for me, :V i am lacking inspiration momentarily. orz
//enemy script - unimportant data was left out
@MainLoop{
if(time%10==0){ AnotherCreateShot01(GetX,GetY,3,GetAngleToPlayer,ORANGE02,0); }
time++;
}
#include_function "script/Shot.txt";
//Shot.txt
function AnotherCreateShot01(x, y, speed, angle, graphic, delay) {
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, x, y);
Obj_SetSpeed(obj, speed);
Obj_SetAngle(obj, angle);
ObjShot_SetGraphic(obj, graphic);
ObjShot_SetDelay(obj, delay);
}
(This is just a simple test, but it works)Anyone wanna try getting me to start working again? :V
I dare you to make a script that is actually possible to beat.
I have... play my scripts on normal, instead of lunatic :V
let difficulty="Hard";
SpellcardName("Shoot Bullets To Kill The Player (difficulty)");
["Shoot Bullets "]~["(Hard)"];
The above has no success unfortunately.
#TouhouDanmakufu[Stage]
#Title[Patchouli Knowledge EX Stage]
#Text[Extra Stage]
#Player[FREE]
#ScriptVersion[2]
script_stage_main{
let StageMusic = "script\Stage BGM\BGM_6-4";
task stage{
PlayMusic(StageMusic);
CreateEnemyBossFromFile("script\Patchouli Knowledge\PatchouliBoss.dnh", GetCenterX, -20, 0, 0, 0);
WaitForFrames(240);
Clear;
}
#include_function "\lib\StageFunctions.dnh";
@Initialize{
LoadMusic(StageMusic);
stage;
}
@MainLoop{
yield;
}
@BackGround{
SetAlpha(255);
SetGraphicScale(1, 1);
SetGraphicAngle(0, 0, 0);
SetViewTo(0, 0, 0);
SetViewFrom(100, 90, 45);
SetFog(100, 300, 0, 0, 0);
}
@Finalize{
DeleteMusic(StageMusic);
}
}
I'm trying to make a stage script, but when I use this script, the boss doesn't appear but the music plays normally. I have checked that the path is correct and WaitForFrames is correctly defined in StageFunctions.dnh. Also, if I use CreateEnemyFromFile in the script, danmakufu crashes. Any idea what could be wrong?Apparently CreateEnemyFromFile and FromScript does not work on the first frame of running a script. Put a WaitForFrames(1); just before calling CreateEnemyFromFile.Code: [Select]snip
For some what reason my danmakufu does not respond when I go to: All,Single,Plural,Stage,Random. I can only enter directory, What is wrong? I've used applocale many times!
Apparently CreateEnemyFromFile and FromScript does not work on the first frame of running a script. Put a WaitForFrames(1); just before calling CreateEnemyFromFile.
function PrimaryShot () {
ascent (i in 1..16) {
PrimaryShotDefine(i)
}
}
task PrimaryShotDefine(v) {
let obj=Obj_Create(OBJ_SHOT); //Make an object with the properties of a shot.
Obj_SetPosition(obj, GetX, GetY);
Obj_SetAngle(obj, 90);
Obj_SetSpeed(obj, 0.25* v);
ObjShot_SetGraphic(obj, 210); //Shot ID 210. See custom supershot script.
ObjShot_SetDelay (obj, 20);
ObjShot_SetBombResist (obj, false);
while(Obj_BeDeleted(obj)==false) {
descent (j in 100..1) { //Deceleration of bullets. (not working)
Obj_SetSpeed(obj, j* v* 0.02);
}
yield;
}
}
while(Obj_BeDeleted(obj)==false) {This will set the speed 100 times, then yield. Not only will you not see anything happen, it's a waste of processing and probably wouldn't give the right result anyways.
descent (j in 100..1) { //Deceleration of bullets. (not working)
Obj_SetSpeed(obj, j* v* 0.02);
}
yield;
}
Wait for a while, it may be loading the list of scripts.ah ok. thanks.
If it doesn't work, try deleting script_index.dat.
This will set the speed 100 times, then yield. Not only will you not see anything happen, it's a waste of processing and probably wouldn't give the right result anyways.Ah, that worked perfectly. Thanks for the help.
What you want is simply
while(Obj_BeDeleted(obj)==false) {
Obj_SetSpeed(obj, Obj_GetSpeed(obj) - something);
yield;
}
EDIT: Another question. Can the argument for an angle of a bullet be <0 or >360?
Player Scripts:
- Yuka Kazami (Mystic Square) <12/15/09 UPDATE>
- Mima (Mystic Square)
- The Shot Replace Script. - Requiered to play the old Cirno and Tenshi scripts
So, I'm starting on Danmakufu today.
I downloaded Applocale and started to install it.
Everything's fine and dandy until...it stops and says that it couldn't open some program needed and it canceled the install.
FFFFUUUUUUUUUU- :colonveeplusalpha:
It just stopped, showed me that message, and then closed the install once I pressed ok.
That's the same thing I had to go through when I tried to install Applocale on Windows 7 as well. They're basically what Luna just wrote, but here's the steps I used to set things straight.(http://img33.imageshack.us/img33/1521/errorep.png)
Heres how to install AppLocale on Windows 7:
1. Place the AppLocale installer (apploc.msi) in your C: drive.
2. Go to your start menu, type cmd in the search box.
3. Hold down crtl+shift and click on cmd.exe.
4. Select Yes when a dialog asks if you want the program to make chances to your computer.
5. The command prompt should show C:\Windows\System32.
6. Type cd\ and press enter to navigate to the C: drive.
7. Type apploc.msi and press enter, the installer will appear.
8. Install the application.
Still Windows 7?what? my error? no. its XP.
Was wondering how to manage "SetText" and "#BGM"
@Mewkyuu:Check the names and file extensions of your files. They should also be in the right folder.
It's just that when i play the script, there are no sounds...
@KyleskyThat shouldn't happen.
-----------------------------------------------------------------------------------------------------|
Error |
CutIn,(17s-U) |
|
CutIn(YOUMU,"Christmas Sign"\""Tree and Ornament"\",0,0,200,600); |
-----------------------------------------------------------------------------------------------------|
Do people even read the FAQ thread I wonder. As Applocal thing is like extremely frequently asked.I actually did read it but I didn't find the FAQ on what happens when I can't open the installer and was interrupt. it says that the error code is 2755.
Like Naut said, stop fooling around with the msi and just install it. XP does not have any UAC-like protection. Unless you are on a computer with administrator restrictions, but I highly doubt that.
Yes it should happen, you're missing a parameter.
CutIn(TYPE,"name","image",L,T,R,B);
script_enemy_main {
//General Variables
let BossImage = GetCurrentScriptDirectory~"Remilia Scarlet Sprite.png";
let BossStill = [0, 0, 64, 64];
let BossMove = [64, 64, 128, 128];
let BossMusic = GetCurrentScriptDirectory~"BGM_Remilia";
@Initialize {
LoadGraphic(BossImage);
LoadMusic(BossMusic);
SetLife(1);
SetDamageRate(0, 0);
MagicCircle(false);
SetEnemyMarker(true);
CreateEventFromScript("Talk");
}
@MainLoop {
SetCollisionA(GetX, GetY, 24);
if(GetEventStep==1){
PlayMusic(BossMusic);
}
if(OnEvent==false){
SetLife(0);
}
yield;
}
@DrawLoop {
DrawText("Boss Name", 36, 30, 12, 225);
if(GetSpeedX>=1){
SetTexture(BossImage);
SetGraphicAngle(0, 0, 0);
SetGraphicRect(BossMove[0], BossMove[1], BossMove[2], BossMove[3]);
DrawGraphic(GetX, GetY);
}else if(GetSpeedX<=-1){
SetTexture(BossImage);
SetGraphicAngle(180, 0, 0);
SetGraphicRect(BossMove[0], BossMove[1], BossMove[2], BossMove[3]);
DrawGraphic(GetX, GetY);
}else{
SetTexture(BossImage);
SetGraphicAngle(0, 0, 0);
SetGraphicRect(BossStill[0], BossStill[1], BossStill[2], BossStill[3]);
DrawGraphic(GetX, GetY);
}
}
@Finalize {
DeleteGraphic(BossImage);
}
}
script_event Talk{
//General Variables
let CharGraphic = GetCurrentScriptDirectory~"0.png";
let BossGraphic = GetCurrentScriptDirectory~"Remilia Scarlet.png";
@Initialize{
LoadGraphic(CharGraphic);
LoadGraphic(BossGraphic);
}
@MainLoop{
SetChar(LEFT, CharGraphic);
SetGraphicRect(LEFT, 0, 0, 256, 512);
MoveChar(LEFT, BACK);
SetChar(RIGHT, BossGraphic);
SetGraphicRect(RIGHT, 0, 0, 256, 512);
MoveChar(RIGHT, BACK);
TextOutA("You won!");
SetStep(1);
End;
}
@Finalize{
DeleteGraphic(CharGraphic);
DeleteGraphic(BossGraphic);
}
}
#TouhouDanmakufu
#Title[BG test]
#Text[testing the background abilitie in danmakufu]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
let CSD = GetCurrentScriptDirctory;
let bg = CSD ~ "bg\hakureishrine.png";
@Initialize{
SetLife(1000)
SetMovePosition01(GetCenterX,GetCenterY,5);
mainTask;
}
@MainLoop{
}
@DrawLoop{
}
@Background{
SetTexture(bg);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,832,539);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0)
DrawGraphic(GetCenterX,GetCenterY);
}
@Finalize{
}
}
You misspelled directory. Fix that and it will probably work.I did correct directory but for some what reason hakureishrine.png keeps getting errors.
I did correct directory but for some what reason hakureishrine.png keeps getting errors.
Does it generate an actual error message or does it just not show up at all? You seem to have left out your LoadGraphic(bg), which means that your background image won't ever exist in DNF's memory. Add it in your @Initialize to set things right.(http://img17.imageshack.us/img17/9634/error6r.jpg)
You have forgotten a semicolon after SetLife(1000).OH! darn it. I always forget semicolons. *_*
Is there actually a task named mainTask? Please use Pastebin (http://pastebin.com/) to show us your entire code.like this? http://pastebin.com/bEMCWKQ6
Is there actually a task named mainTask? Please use Pastebin (http://pastebin.com/) to show us your entire code.(http://img713.imageshack.us/img713/5943/error8.jpg)
like this? http://pastebin.com/bEMCWKQ6
Yup, just like that. You're calling for the task mainTask to start in your @Initialize, but there's actually nothing named mainTask in your script.thanks. but anyway the hakureishrine.png isn't appearing at all! also I didn't put SetTimer(60) you can download my epic FAIL script at: http://bulletforge.org/u/atfyntify/p/one-epic-bg-fail-test/v/1
That's an error, mate. :3
Two things:GUYS IT WORKED!!!!!!!!!!!!!
First, you need to make the G capital in @BackGround. Second, you must put a SetScore(*some number here*) statement in your @Initialize. Like Jm said just now, what you draw in @BackGround doesn't work in non-spellcard attacks - SetScore turns your script into a spellcard attack.
let objarr = []; //Init empty array
task objTask
{
let obj = Obj_Create(OBJ_SHOT);
objarr = objarr~[obj]; //Add the object to the global array
blahblah;
while(!Obj_BeDeleted(obj)){
ascent(i in 0..length(objarr)){ //Go through all objects
if(objarr[i] != obj && Collision_Obj_Obj(obj,objarr[i])){
dostuff;
}
}
yield;
}
ascent(i in 0..length(objarr)){ //Go through all objects and remove self
if(objarr[i] == obj){
objarr = erase(objarr,i);
break;
}
}
}
task fire{
let x=0;
let dir=0;
loop{
bakabullet(GetEnemyX,GetEnemyY,3,GetAngleToPlayer,AQUA01,30);
bakabullet(GetEnemyX,GetEnemyY,3,GetAngleToPlayer-20,AQUA01,30);
bakabullet(GetEnemyX,GetEnemyY,3,GetAngleToPlayer+20,AQUA01,30);
wait(30);
yield;
}
}
task bakabullet(x,y,v,dir,graphic,delay){
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);
ObjShot_BombResist(obj,true);
}
function wait (w){
loop (w){yield,}
}
}
let a = 0;
descent(i in -180..180) {
a++;
i = i*8;
CreateShot02(GetX+50*cos(a),GetY+50*sin(a), 0, i-180, 0.01, 3, GREEN22, 30);
}
a=0;
I'm making a boss where you face two characters at once, but I can't figure out how I can make them share the same life bar. Anyone knows an effective way of doing this?Spawn one boss as a familiar of the boss. So if the "actual" boss is to be defeated, both bosses will be spawned in the next lifebar. Also if the "familiar" is to be defeated, make it so that the "master" boss kills itself (AddLife(-GetEnemyLife);), so both bosses will go into their next lifebar.
Code: [Select]
task fire{
loop(36){
if(bleh==60) { //<-----Need this
CreateShot01(GetX,GetY,3,angle,RED12,0);
angle += 360/36;
yield:
}
angle = 0;
bleh = 0;
task fire{
let x = 0;
let dir = 0;
loop{
while(x<36){
CreateShotA(9,GetEnemyX,GetEnemyY,30);
SetShotDataA(9,60,2,dir,2,0,2,RED12);
FireShot(1)
dir+=360/36;
x++;
}
x = 0;
dir = 0;
wait(60);
yield;
}
}
FireShot(1)
By the way, the problem isn't in the wait function - look at the line number that Danmakufu gives in the error and look around there! There's a reason behind those error messages that Danmakufu gives.And again, this. RaNGE is not your personal Eirin.
What's the best way to animate a sprite so that it's facing the right way when it's moving, especially if it's a random movement? Like, if it moves right, I want the "move right" animation to show.Well, no matter if it is a random movement or box, an enemy gains an X variable speed for moving left or right and Y variable speed when moving up or down, so you need to tackle those two variables:
I tried a couple of ways, but they won't work if the movement is randomly in a box. Meaning it could move left OR right.
if(GetSpeedX()>0){ // if(GetSpeedX()<0){
SetMovePosition03(GetPlayerX, GetClipMinY +35, 10, 8.5); //Move towards the player right before shooting.
if (GetAngleToPlayer> 0 && GetAngleToPlayer< 89) { //Player is to the right of the enemy
BossMove= 1;
}
if (GetAngleToPlayer> 89 && GetAngleToPlayer< 91) { //Player is more or less directly below
BossMove= 0;
}
if (GetAngleToPlayer> 91 && GetAngleToPlayer< 180) { //Player is on the left
BossMove= -1;
}
//later
if (BossMove== 0) { //Right on top of the player
SetTexture(BossSprite);
SetGraphicRect(0, 0, 51, 81);
}
if (BossMove== -1) { //When she moves left.
SetTexture(BossSprite);
SetGraphicRect(94, 0, 145, 81);
}
if (BossMove== 1) { //When she moves right.
SetTexture(BossSprite);
SetGraphicRect(207, 0, 258, 81);
So I just have it draw whatever sprite it needs each time it needs to check.I ran into another problem while making my double character script. After the first attack, once of the characters is supposed to leave the screen. I set the coordinates of that character as common data in the attack script, and then accesses it in the spellcard that comes after. But for some reason, the enemy I create to leave the screen appears at different coordinates than where the other enemy died, also always somewhere at the top left.
Here's the normal enemy in the attack: http://pastebin.com/cMmfGbxu
And here's the spellcard where the enemy that leaves the screen is created: http://pastebin.com/VHdFmk1r
bullet=bullet~[shot];
GetCommonDataDefault("EnemyX",0)=GetCommonDataDefault("EnemyX",0)~[GetX];
== errorGreetings, I'm now trying to make a caterpillar effect where a bunch of familiars chase after an enemy, like in this picture:
(http://i32.photobucket.com/albums/d49/puremrz/caterpillar.jpg)
(The red bullets are placeholders for the familiars)
It's all going well and stuff, but only when I use 1 enemy.
That's because I'm using common data, and don't know how to expand common data arrays.
Normally expanding arrays would go like:Code: [Select]bullet=bullet~[shot];
But since this is common data I'm working with, that trick won't work:Code: [Select]GetCommonDataDefault("EnemyX",0)=GetCommonDataDefault("EnemyX",0)~[GetX];
== error
Does anyone know what the right way is to add more values to a common data array?
SetCommonData("EnemyX", GetCommonDataDefault("EnemyX", 0)~[GetX]);
let arrayX = GetCommonDataDefault("EnemyX", 0);
arrayX = arrayX ~ [GetX];
SetCommonData("EnemyX", arrayX);
You're supposed to use SetCommonData in order to change stuff in common data remember? As such, it would be like this:Code: [Select]SetCommonData("EnemyX", GetCommonDataDefault("EnemyX", 0)~[GetX]);
To make more sense of this, here's an expanded version with a variable for clarity:Code: [Select]let arrayX = GetCommonDataDefault("EnemyX", 0);
arrayX = arrayX ~ [GetX];
SetCommonData("EnemyX", arrayX);
I'm trying to create a spellcard where lasers comes from two sides and then alternates between having collision and not colision (delayed). But no matter what I try it always ends up in an infinite loop somewhere. Any idea of how to spawn the lasers where the old laser was deleted that doesn't freeze danmakufu?The reason why it's freezing is probably because you're trying to get the coordinates of a deleted object. To solve this, store the coordinates of the old laser first before deleting.
Here's the code: http://pastebin.com/5bjC7Jnt
if(deathTime==0){
let tempx = Obj_GetX(obj);
Obj_Delete(obj);
break;
}
task ArcBullet(targetx,targety,arcdist,speed){
math???
CreateShotA(0,GetX,GetY,0);
SetShotDataA(0,0,speed,???,???,0,0,WHITE05);
FireShot(0);
}
The reason why it's freezing is probably because you're trying to get the coordinates of a deleted object. To solve this, store the coordinates of the old laser first before deleting.
LikeCode: [Select]
if(deathTime==0){
let tempx = Obj_GetX(obj);
Obj_Delete(obj);
break;
}
Using the Call*horizontal/vertical* functions are not necessary, you can simply call the task inside itself.
Have you considered using Obj_SetCollisionToPlayer (http://dmf.shrinemaiden.org/wiki/index.php?title=Object_Control_Functions#Obj_SetCollisionToPlayer)?
Hope this helps.
[attach=1]Code: [Select]task ArcBullet(targetx,targety,arcdist,speed){
math???
CreateShotA(0,GetX,GetY,0);
SetShotDataA(0,0,speed,???,???,0,0,WHITE05);
FireShot(0);
}
math is what
task ArcBullet(targetx,targety,arcdist,speed){
let initialAngle = atan2(GetY-cy, GetX-cx)+90;
let cx = ???;
let cy = ???;
let radius = ((GetX-cx) + (GetY-cy))^0.5;
let circumference = radius * 2 * 3.141592;
let time = circumference/speed;
let angularVelocity = 360/time;
CreateShotA(0,GetX,GetY,0);
SetShotDataA(0,0,speed,initialAngle,angularVelocity,0,0,WHITE05);
FireShot(0);
}
task ArcBullet(targetx,targety,arcdist,speed,direction){
let chordDist = ((GetX-targetx)^2 + (GetY-targety)^2)^0.5; //Finding distance between enemy and target
let chordAngle = atan2(targety-GetY, targetx-GetX); //Finding angle from enemy to target
let radius = (arcdist^2 + (chordDist/2)^2)/arcdist/2; //Finding length of radius
let mx = GetX+cos(chordAngle)*chordDist/2 //Finding x-coord of midpoint of the chord
let my = GetY+sin(chordAngle)*chordDist/2 // Finding y-coord of midpoint of the chord
let cx = mx+cos(chordAngle+90)*(radius-arcdist); //Finding x-coord of center of circle
let cy = my+sin(chordAngle+90)*(radius-arcdist); //Finding y-coord of center of circle
let circumference = absolute(radius * 2 * 3.141592); //Finding the circumference of the circle
let time = circumference/speed; //Finding the time it takes to travel the length of the circumference with given speed
let angularVelocity = 360/time; //Finding the angular velocity to turn 360 degrees in that time
let initialAngle = atan2(GetY-cy, GetX-cx)+90; //Finding the initial angle to fire bullet
alternative(direction)
case("cw"){
//Do nothing, lol bad code.
}
case("ccw"){
angularVelocity *= -1; //reverse the angular velocity
initialAngle -=180; //turn the initial angle around 180 degrees
}
others {
RaiseError("ArcBullet expected "cw" or "ccw" for direction parameter but got " + ToString(direction));
}
CreateShotA(0,GetX,GetY,0);
SetShotDataA(0,0,speed,initialAngle,angularVelocity,0,0,WHITE05);
FireShot(0);
}