Author Topic: Danmakufu Q&A/Problem thread number 4  (Read 204663 times)

Atfyntify

  • Danmakufu worshipper
  • I worship Danmakufu
Re: Danmakufu Q&A/Problem thread number 4
« Reply #960 on: April 14, 2011, 12:49:17 PM »
Two things:

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.
GUYS IT WORKED!!!!!!!!!!!!!
I CAN'T WAIT FOR TOUHOU 14!

Darkness1

  • Nothing to see here.
  • Enigmatic, isn't it?
Re: Danmakufu Q&A/Problem thread number 4
« Reply #961 on: April 15, 2011, 01:12:35 PM »
Can someone explain to me how you make a global variable? Cause always when i define a variable in a task, and want to call it outside of the task, danmakufu says that the variable obj2 is undefined ( because of me not getting Collision_Obj_Obj to work :().

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem thread number 4
« Reply #962 on: April 15, 2011, 03:58:26 PM »
Just define the variable outside everything else - the common place is right above @Initialize or @MainLoop.

Darkness1

  • Nothing to see here.
  • Enigmatic, isn't it?
Re: Danmakufu Q&A/Problem thread number 4
« Reply #963 on: April 15, 2011, 06:12:14 PM »
Okay... Now i actually got it to work by experimenting a little, with what you said (thanks Azure!). It works good, except for on thing. In my script the boss is shooting three bullets but only one bullet is affected. I can?t figure out what?s wrong ??? . Heres the script btw ~ http://pastebin.com/g0JMR2MA.

CK Crash

  • boozer
Re: Danmakufu Q&A/Problem thread number 4
« Reply #964 on: April 18, 2011, 02:01:18 PM »
When you create the third object, it's ID overwrites where one of the other IDs was stored. You only have 2 variables, so you'll only be able to do correct collision for 2 bullets a time. I recommend you instead use an array, and ascent through it for the collision. The lazy way to do this would look something like this:
Code: [Select]
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;
}
}
}

ふとくていなねこじょおう

  • Cirno Kisaragi
  • *
  • When Ice Cars completely miss the intended target
Re: Danmakufu Q&A/Problem thread number 4
« Reply #965 on: April 19, 2011, 02:54:12 AM »
So I'm following Helopolis's video tutorials on Danmakufu, and I got to the object Bullet lesson. I do everything he says to do, I make sure I wrote the script down correctly, but when I try to run it it comes up with an error.

Code: [Select]
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,}
}

}

Could someone please look over it and see what's wrong?
« Last Edit: April 19, 2011, 01:20:07 PM by nekorandomnessqueen »
"I'm not sure about this anymore...Are you sure this is safe?"

"Absolutely! This is 100% safe! ...Not."

Drake

  • *
Re: Danmakufu Q&A/Problem thread number 4
« Reply #966 on: April 19, 2011, 03:03:52 AM »
That was kind of funny, I looked through the whole thing and was like "this should work perfectly wtf" and then I saw the last line.

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


When you get an error, please check the specified line for mistakes. If you can't solve it, copy the error down (ctrl+c).
« Last Edit: April 19, 2011, 03:05:50 AM by Drake »

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

ふとくていなねこじょおう

  • Cirno Kisaragi
  • *
  • When Ice Cars completely miss the intended target
Re: Danmakufu Q&A/Problem thread number 4
« Reply #967 on: April 19, 2011, 12:27:31 PM »
Oh. *facepalm*

It's the second time I make a stupid mistake like that. Thanks.
"I'm not sure about this anymore...Are you sure this is safe?"

"Absolutely! This is 100% safe! ...Not."

Re: Danmakufu Q&A/Problem thread number 4
« Reply #968 on: April 19, 2011, 02:00:09 PM »
Code: [Select]
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;

This is a silly question regarding the snippet above: What in this thing causes the pattern?
(I need to lrn2math)

Re: Danmakufu Q&A/Problem thread number 4
« Reply #969 on: April 19, 2011, 06:29:34 PM »
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?

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem thread number 4
« Reply #970 on: April 19, 2011, 10:19:34 PM »
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.

Drake

  • *
Re: Danmakufu Q&A/Problem thread number 4
« Reply #971 on: April 19, 2011, 10:49:39 PM »
Familiar of the boss is the most common, yes. The life should be tracked by common data that both bosses contribute towards.

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

Zengar Zombolt

  • Space-Time Tuning Circle - Wd/Fr
  • Green-Red Divine Clock
Re: Danmakufu Q&A/Problem thread number 4
« Reply #972 on: April 20, 2011, 12:50:05 AM »
Or maybe using SetDamageRateEx? It transfers a Familiar's damage to the parent enemy anyways.

Re: Danmakufu Q&A/Problem thread number 4
« Reply #973 on: April 20, 2011, 01:07:34 AM »
Can someone help me with my script? it seems to hate my wait command, since it gives me an error about it.

(just a heads up, i'm new at this, so this code might be very ugly)

http://pastebin.com/cMMdkBR4

<Naut> Please use pastebin when posting large walls of code.
« Last Edit: April 20, 2011, 09:48:04 PM by DNM »

Re: Danmakufu Q&A/Problem thread number 4
« Reply #974 on: April 20, 2011, 01:17:32 AM »

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;


You are missing a { at the end of your if(bleh==60)

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem thread number 4
« Reply #975 on: April 20, 2011, 01:18:03 AM »
pastebinplzedit

Ahahah what. ninjd (by a weeaboo no less)

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.
« Last Edit: April 20, 2011, 01:20:52 AM by みゅーキュゥ »

Re: Danmakufu Q&A/Problem thread number 4
« Reply #976 on: April 20, 2011, 01:29:24 AM »
thank you for the help, adding the bracket fixed the error, although i had to remove my task fire and two variables to make it work again.
(sorry about the massive block, i just saw the pastebin thing.)

one more thing, it says im missing a bracket at this area, but every one of my brackets match up.

Code: [Select]
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;
}
}
« Last Edit: April 20, 2011, 02:02:47 AM by Phonibologna »

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem thread number 4
« Reply #977 on: April 20, 2011, 02:05:34 AM »
            FireShot(1)

Missing semicolon. Also, why are you always "wait"ing for one frame more than you think you are / you want to?

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.
« Last Edit: April 20, 2011, 03:15:30 AM by みゅーキュゥ »

Re: Danmakufu Q&A/Problem thread number 4
« Reply #978 on: April 20, 2011, 02:39:00 AM »
i'm not sure, ill get around to taking out all of those extra yields eventually, and thank you for the help

oh, and is there a way to give custom bullets custom hit boxes? its annoying to see large bullets with tiny hit boxes
« Last Edit: April 20, 2011, 04:19:54 AM by Phonibologna »

AlchemyFan101

  • Local Idiot :V
  • I dont really belong here, right?
Re: Danmakufu Q&A/Problem thread number 4
« Reply #979 on: April 20, 2011, 05:50:25 AM »
this is the script for the first tutorial in the advanced section  :V
I got an error in the task fire section D:

http://pastebin.com/ADv5m4U7

<Naut> Please use pastebin when posting large walls of code.

so what did I totaly screw up this time?  :colonveeplusalpha:
« Last Edit: April 20, 2011, 09:47:10 PM by DNM »

Drake

  • *
Re: Danmakufu Q&A/Problem thread number 4
« Reply #980 on: April 20, 2011, 06:29:09 AM »
Your second SetShotDataA has an extra parameter. SetShotDataA(id, frame, speed, angle, turn, acc, minmaxspd, graphic);
« Last Edit: April 20, 2011, 06:50:33 AM by Helepolis »

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

Yuyuko Yakumo

  • Carry me~ow
  • Rawr I eat your face with maaaaaagicalness
Re: Danmakufu Q&A/Problem thread number 4
« Reply #981 on: April 20, 2011, 08:30:12 AM »
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.

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.
I know, I know. I'll get a real avatar and signature soon. -_-

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem thread number 4
« Reply #982 on: April 20, 2011, 08:39:38 AM »
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.

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.
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:
Code: [Select]
if(GetSpeedX()>0){ // if(GetSpeedX()<0){
So what are you trying atm?

Yuyuko Yakumo

  • Carry me~ow
  • Rawr I eat your face with maaaaaagicalness
Re: Danmakufu Q&A/Problem thread number 4
« Reply #983 on: April 20, 2011, 08:50:23 AM »
The way I'm getting which direction is more or less indirectly. In the following, I have the enemy move to the x-cord of where the player is standing. So I use whatever angle the enemy has to the player to determine which direction it's moving.

Code: [Select]
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.
But of course, I get a simple solution to a simple problem.
I know, I know. I'll get a real avatar and signature soon. -_-

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem thread number 4
« Reply #984 on: April 20, 2011, 09:12:03 AM »
Eh, either I am getting it wrong but the way I see it now: You want to make the enemy face the correct direction when it is moving in a direction on the X-axis (aka to the left == face left).

If that is the case, your coding is extremely awkward. As I said, you need to define the sprite animation using the GetSpeedX > and < using the @DrawLoop. The code you are showing looks more like the direction the enemy sprite is facing based on player location, that is something totally different than movement of the enemy itself.

Yuyuko Yakumo

  • Carry me~ow
  • Rawr I eat your face with maaaaaagicalness
Re: Danmakufu Q&A/Problem thread number 4
« Reply #985 on: April 20, 2011, 03:51:39 PM »
Yeah, that's why I asked for help. I tend to really overthink things with Danmakufu.  :ohdear:
I know, I know. I'll get a real avatar and signature soon. -_-

Re: Danmakufu Q&A/Problem thread number 4
« Reply #986 on: April 20, 2011, 09:10:12 PM »
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

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem thread number 4
« Reply #987 on: April 23, 2011, 12:35:02 AM »
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

There's only one obvious answer I can think of and it's that you're RMSpell01Leave.dnh enemy is using SetX and SetY in the @Initialize (or maybe elsewhere) by accident. Otherwise, it might be a silly quirk of Danmakufu, though I'm pretty sure I've gotten something like this working myself. Perhaps if you set the common data every frame instead of in @Finalize with a task that loops infinitely with a single yield between each loop, it'll work? If all else fails, you can try using the debug window (look up CreateDebugWindow and OutputDebugString in the function list on the wiki) and make it output stuff like GetX, GetY, and GetCommonData to see if they're matching up correctly.
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.

Re: Danmakufu Q&A/Problem thread number 4
« Reply #988 on: April 23, 2011, 10:47:39 AM »
I used DrawText to check it in one of the scripts I used where the main boss was supposed to aim for the sub boss. In the sub boss, GetCommonData returned the exact X and Y coordinates, but in the main boss, it returned the shared life of the bosses instead for some reason, so I gave up with the nice leaving effect and found another solutin for the aiming.

puremrz

  • Can't stop playing Minecraft!
Re: Danmakufu Q&A/Problem thread number 4
« Reply #989 on: April 24, 2011, 08:28:28 AM »
Greetings, I'm now trying to make a caterpillar effect where a bunch of familiars chase after an enemy, like in this picture:


(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?
Full Danmakufu game "Juuni Jumon - Summer Interlude" is done!
By the same person who made Koishi Hell 1,2 (except this game is serious)
Topic: http://www.shrinemaiden.org/forum/index.php/topic,9647.0.html