Author Topic: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)  (Read 269094 times)

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #360 on: December 12, 2012, 02:07:16 AM »
Multiple questions wee...
Question 1
How do I delete an enemy once it gets offscreen?

From what I know, it's automatic. Unless you do something that tells Danmakufu NOT to delete it...

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #361 on: December 12, 2012, 03:03:06 AM »
How do I delete an enemy once it gets offscreen?
Generally happens automatically. You can change what the boundaries are if needed.

How do I make a function in a stage script that tells to wait n frames to advance, but having zero enemies also advances on? For example...
CreateEnemyFromFile(...)
[Wait for either zero enemies or the given frames, then advance]
CreateEnemyFromFile(...)

let f = 0;
while(GetEnemyNum!=0 && f<n){ f++; yield; }

Erm, are you aware of the simple logic structure? Or was the question more about getting the number of enemies?

How do you have an image appear in the front of the player. (Like the stage intros in the Touhou games, or of CtC) And how big is the screen. (In frames) Only the areas where danmaku happens though.
Draw it on a higher layer, i.e 4 to 8.

GetCenterX*2 by GetCenterY*2
..or 448x480

How do I make a BG scroll using @Background{
Have variables that count backwards or forwards in the @BG loop, and use DrawGraphic at your original position plus the counting variable. That's all.

...I'm pretty sure all of these questions would be answered if you looked through the function lists and read/watched the tutorials :C

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

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #362 on: December 13, 2012, 02:41:10 AM »
 :ohdear: I'm very sorry for last time's post. I just couldn't find it anywhere in the tutorials. I might be overlooking something... This problem I have right now... I know it's not in the tutorials.

http://pastebin.com/FpUExLcW Script
It's a cut-in error, it gives me an error message.
http://puu.sh/1Aj3l Error Message

Sorry for last time, wasn't looking hard enough.
Currently a normal player

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #363 on: December 13, 2012, 03:09:21 AM »
:ohdear: I'm very sorry for last time's post. I just couldn't find it anywhere in the tutorials. I might be overlooking something... This problem I have right now... I know it's not in the tutorials.

http://pastebin.com/FpUExLcW Script
It's a cut-in error, it gives me an error message.
http://puu.sh/1Aj3l Error Message

Sorry for last time, wasn't looking hard enough.

Code: [Select]
let CutIn = CSD ~ "System\Kona-Cut-in.png";
Code: [Select]
CutIn(YOUMU,"Wind Sign "\""Dropping Hurricanes"\",CutIn,0,0,250,375);
Don't name a variable after a function that already exists.
<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.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #364 on: December 13, 2012, 10:05:40 PM »
Code: [Select]
let CutIn = CSD ~ "System\Kona-Cut-in.png";
Code: [Select]
CutIn(YOUMU,"Wind Sign "\""Dropping Hurricanes"\",CutIn,0,0,250,375);
Don't name a variable after a function that already exists.

To circumvent this, most use 'cut' to define the variable. Some also use cutin, but that's a commonly used user defined function. Might want to rename it konacut or something more specific if you need organization. Just a suggestion.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #365 on: December 14, 2012, 05:48:48 AM »
For sounds and graphics paths, I usually just prefix my variables. imgReimuCutIn, sfxShot01, bgmStage01... something like that.
<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.

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #366 on: December 18, 2012, 03:11:53 PM »
ok...time for questions:

1 - How can i create and use a collision circle? I mean, for example how can i create a 90 radius collision circle around the player that say " random bullets can be spawned anywhere but not inside this ring" or "if bullets enter in the ring, the bullets are deleted" ?

2 - how can i create geometric figures "stars, exagons, etc etc" with lasers or bullets?

3 - when i use a familiar, how can i do that it moves in the player position but without stopping when it reach the player position?

Lunasa Prismriver

  • Poltergeist Violinist
  • Himorogi, Burn in Violet
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #367 on: December 18, 2012, 07:58:42 PM »
1 - How can i create and use a collision circle? I mean, for example how can i create a 90 radius collision circle around the player that say " random bullets can be spawned anywhere but not inside this ring" or "if bullets enter in the ring, the bullets are deleted" ?
Code: [Select]
DeleteEnemyShotInCircle(ALL,GetPlayerX,GetPlayerY,90);http://dmf.shrinemaiden.org/wiki/Bullet_Control_Functions_%280.12m%29#DeleteEnemyShotInCircle
Other variations of this function are listed in the wiki :)

2 - how can i create geometric figures "stars, hexagons, etc etc" with lasers or bullets?

For a regular polygon (not a star).
  • Find the coordinates for the points (6 for a hexagon)
  • Rely them with lasers.
Example :

Code: [Select]
task DrawPolygon(x,y,radius,numberfaces){
    ascent(i in 0..numberfaces){
        let radiuscoorX = x+radius*cos((360/numberfaces)*i); //I find the points using sine and cosine because we want a regular polygon
        let radiuscoorY = y+radius*sin((360/numberfaces)*i);
        let angleface = atan2( (y+radius*sin( (360/numberfaces)*(i+1) ) ) - (y+radius*sin( (360/numberfaces)*i) ),(x+radius*cos((360/numberfaces)*(i+1)))-(x+radius*cos((360/numberfaces)*i))); // Some mathematical stuff
        let facelength = 2*radius*sin(180/numberfaces); //Other math stuff

        DrawFace(radiuscoorX ,radiuscoorY,angleface,facelength) //Draw the laser
    }   
    task DrawFace(x,y,angle,facelength){ //Draw a basic laser with a object bullet.
            let ObjPrism = Obj_Create(OBJ_LASER);

            Obj_SetSpeed(ObjPrism, 0);
            ObjShot_SetBombResist(ObjPrism, true);
            ObjShot_SetGraphic(ObjPrism, AQUA01);
            ObjLaser_SetWidth(ObjPrism,;
            ObjShot_SetDelay(ObjPrism, 32);
            ObjLaser_SetSource(ObjPrism, false);
            Obj_SetAlpha(ObjPrism, 192);
            while(!Obj_BeDeleted(ObjPrism)){
                ObjLaser_SetLength(ObjPrism, facelength);   
                Obj_SetPosition(ObjPrism,x,y);
                Obj_SetAngle(ObjPrism, angle);
                yield;
            }
    }
}
For a star :
You can use the function upside, you just have to rely the points in a different order. But I think it's easier to calculate points coordinates and rely them manually.


3 - when i use a familiar, how can i do that it moves in the player position but without stopping when it reach the player position?

I'm don't sure it's works but you can try this (Call this function in @initialize) :

Code: [Select]
task MoveFamiliar {   
      SetAngle(atan2(GetPlayerY-GetY,GetPlayerX-GetX));
      SetSpeed(1);
}

I hope i help you.  :3c

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #368 on: December 18, 2012, 09:47:25 PM »
Wow, thx!

i have to try them, especially point 2. I wonder how to make the polygon move like a shot, in all the possible way. Move it like a whole or like Zun star of Sanae, that appear as a star but then is fired as a lot of single bullets

Also, i have 2 last mayor questions:

1 - Arrays... what should i write in a script to make them works for, like, give different angles or speed to bullets? So, how do i use in general arrays? I know what they are and what they do, but i keep failing when i use them...i freeze danmakufu. So, maybe i type the wrong strings when i create and use an array...

2 - effect objects. How to use them? How do they work? I read a lot of times Blargel's tutorial about them but...i keep not understanding these kind of object. So, could you give me kindly an explaination and maybe an example? (same thing with the arrays if you can).

Thanks!
« Last Edit: December 18, 2012, 09:59:29 PM by Matteo »

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #369 on: December 19, 2012, 01:30:22 AM »
As for the collision circle question it would be best to just not spawn any bullets in that area at all, rather than firing and deleting them immediately. You can perform a check by calculating the "random" position beforehand and then checking if it's within the radius like this:
posx = rand(32, 416);
posy = rand(16, 464);
//while the spawning position is inside that circle
while(((posy-GetPlayerY)^2+(posx-GetPlayerX)^2)^0.5 < radius){
   //recalculate the position to something else
   posx = rand(32, 416);
   posy = rand(16, 464);
}
shootbullet(posx, posy);


Quote
I wonder how to make the polygon move like a shot, in all the possible way. Move it like a whole or like Zun star of Sanae, that appear as a star but then is fired as a lot of single bullets
This requires a basic knowledge of trigonometry and how to manipulate objects. Unfortunately, even if we give you one example, you will likely not be able to figure out how to change the pattern around, without having enough know-how to do the whole thing yourself in the first place.

Quote
Arrays... what should i write in a script to make them works for, like, give different angles or speed to bullets? So, how do i use in general arrays? I know what they are and what they do, but i keep failing when i use them...i freeze danmakufu. So, maybe i type the wrong strings when i create and use an array...
Type the wrong string? Hm? Not sure what you mean. In general you don't need to really use arrays to hold angles and speeds unless the values are so odd/unrelated that you couldn't just type the values out when using them. Arrays aren't really used for that sort of thing. But freezing danmakufu when using arrays definitely means you aren't using them properly, so if you could provide an example of something that freezes/crashes/etc, that would be nice.

Effect Objects: Have you tried watching Hele's tutorial(s)? It also covers effect objects. (Also the written effect object tutorial is by Nuclear Cheese)
http://www.youtube.com/watch?v=EMw7DOWYMkw
Additionally, do you understand how objects work in general? What in particular is troublesome?
« Last Edit: December 19, 2012, 01:34:43 AM by Drakums »

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

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #370 on: December 19, 2012, 02:18:02 AM »
Quick question:

If you want to use the C button in a player script to change the nature of what is happening, what would you insert into the if/while statement?

Code: [Select]
if(GetKeyState(VK_USER)==KEY_PUSH)
The above is what was used in the Byakuren script I saw, but does that always refer to the C button or can it refer to something else as well?

To be more specific, I've realized that the player script I'm working on has an absurdly difficult set of spellcards, and I'm going to port my current project instead. The issue is that if I use set drops like in the original, it's going to be inconvenient, so I thought about a shot/bomb change similar to Puremrz's in Juuni Jumon. The problem is correctly implementing it while preventing DrawLoop failures and while allowing it to work with the C button.

P.S. This can probably be answered by looking at the Remilia player script, but how do you create a laser shot that stays in place and constantly does damage, and how do you control the graphics for it?

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #371 on: December 19, 2012, 03:15:14 AM »
In 0.12, it always refers to the C key. Development was halted before the actual virtual key functionality was implemented. In ph3 you can set all virtual keys in the config and it works as it was originally intended.

Checking the C key is just a matter of having a global flag variable and starting a task on @Init where it checks per frame if VK_USER is pushed/held, or if it's released/off. Then it sets the global variable accordingly. This doesn't really need to be done since checking the key state is essentially a flag to begin with, but it removes clutter and gives you a bit more control over what the flag signifies and how it can be changed.

As far as modifying behaviour based on the flag, you could split two variants of one behaviour into two functions. Each frame you would check the flag, and if it's off you run behaviour A and if it's on you run behaviour B. Again, this mostly just organizes the code better and makes modifying things easier.

Laser: Isolate the effect and the damage. Damage is generally done by an extending line segment plus-minus some width, and is easy to calculate if the laser just points up. Or, you could have shot segments as objects that move around according to normal firing behaviour plus moving around with the player. There are a bunch of ways to do it, but you mainly want to avoid using the effect as the damage source. What exactly do you mean by "stays in place", though? Like leaving the lasers somewhere while you move around? If that's the case, you just use an object or position marker as the laser/shot source rather than the player.

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

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #372 on: December 20, 2012, 01:11:03 AM »
I have another very annoying question (probably can find dozens of errors in the slightly updated script).

http://pastebin.com/embed_js.php?i=ZmqJJkHi

Basically, after calling the spell once, nothing spawns (expected that much). Once the invincibility period is up, nothing happens. Once the set of yields before the End() is done executing, the player disappears, the option graphics disappear, and all of the lives are gone (or at least the icons are lost). Calling a spellcard again has an OK cutin, but immediately after, Danmakufu crashes.

If you have something to say about the leaf tasks, refer it back to the main spell_talisman task if possible, since those two were copies of the original.

Thanks.

P.S. How do you control bullet speeds for spell objects? No other scripts I see have Obj_SetSpeed or Obj_SetAngle (which I understand to be normal object bullet commands).

P.P.S. I know that there's a lot of clutter and that I haven't removed any of the object effects. It's because I don't know what's going wrong in the first place, and if it is possible to fix it, I'd prefer to fix the bigger problem first.
« Last Edit: December 20, 2012, 01:13:49 AM by Sparen »

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #373 on: December 20, 2012, 02:08:51 AM »
I have another very annoying question (probably can find dozens of errors in the slightly updated script).

http://pastebin.com/embed_js.php?i=ZmqJJkHi

Basically, after calling the spell once, nothing spawns (expected that much). Once the invincibility period is up, nothing happens. Once the set of yields before the End() is done executing, the player disappears, the option graphics disappear, and all of the lives are gone (or at least the icons are lost). Calling a spellcard again has an OK cutin, but immediately after, Danmakufu crashes.

If you have something to say about the leaf tasks, refer it back to the main spell_talisman task if possible, since those two were copies of the original.

Thanks.


You haven't used ObjEffect_SetVertexXY yet. UV coordinates is where on the image each vertex corresponds to. XY coordinates is where in the playing field you want each vertex, relative to the object's position. This makes it possible to warp images if you wish to do so. As you're probably just trying to make each image look the same, and the UV coordinates indicate to me that your talisman is 17x24, you probably want to add the following code:
Code: [Select]
    ObjEffect_SetVertexXY(objtalisman,0,-8,-12);
    ObjEffect_SetVertexXY(objtalisman,1,9,-12);
    ObjEffect_SetVertexXY(objtalisman,2,9,12);
    ObjEffect_SetVertexXY(objtalisman,3,-8,12);

Of course, you'll need to change your leaf tasks as well.

Quote
P.S. How do you control bullet speeds for spell objects? No other scripts I see have Obj_SetSpeed or Obj_SetAngle (which I understand to be normal object bullet commands).
If Obj_SetSpeed and Obj_SetAngle don't work, then manually move them every frame with Obj_SetPosition.
<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.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #374 on: December 20, 2012, 02:23:00 AM »
Thanks!

Now the talismans appear! Of course, the images still disappear, danmakufu still crashes, and they don't execute the commands I want them to execute, but at least they appear!

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #375 on: December 20, 2012, 03:26:55 AM »
Judging by what you meant by "normal object bullet commands", you seem to think that spell objects are object bullets. They aren't. Spell objects are a subset of effect objects, which themselves are also not object bullets. You should still be able to use SetAngle and SetSpeed with spell objects, but they won't affect the graphical angle of the object.

First off, the line to change the vertex alpha values is written before the vertices are created. This might be the cause of the crash?
Next, make sure to adjust your talismanxpos and ypos each frame, otherwise the intersection circle stays at their spawn point. Or rather, since you're still using spell objects, do as Blargel said and use Obj_SetXY to move the object, and then use Obj_GetXY in place of your talismanpos variables.

You also never increase spellcount, so it will never make the child shots. Oh yes you do, you just do it in a weird way. The thing is, you don't really need to reference the global spellcount in order to fire your shots. This part:
Code: [Select]
while(!Obj_BeDeleted(objtalisman)){
   ObjSpell_SetIntersecrionCircle(objtalisman,talismanxpos,talismanypos,30,10,true);
   if(spellcount == 90 || spellcount == 0){ //Split at 90, 180 only.
      spell_leaf1(Obj_GetAngle(objtalisman) - 30, Obj_GetX(objtalisman), Obj_GetY(objtalisman));
      spell_leaf1(Obj_GetAngle(objtalisman) + 30, Obj_GetX(objtalisman), Obj_GetY(objtalisman));
   }
   yield;
}
can be trivially changed to
Code: [Select]
loop(90){
   ObjSpell_SetIntersecrionCircle(objtalisman,talismanxpos,talismanypos,30,10,true);
   yield;
}
spell_leaf1(Obj_GetAngle(objtalisman) - 30, Obj_GetX(objtalisman), Obj_GetY(objtalisman));
spell_leaf1(Obj_GetAngle(objtalisman) + 30, Obj_GetX(objtalisman), Obj_GetY(objtalisman));
loop(90){
   ObjSpell_SetIntersecrionCircle(objtalisman,talismanxpos,talismanypos,30,10,true);
   yield;
}

and it can be done similarly in the first leaf function when waiting 90 frames from its creation to make the second leaves.
« Last Edit: December 20, 2012, 03:39:41 AM by Drakums »

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

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #376 on: December 20, 2012, 03:33:34 AM »
You never increase spellcount, so it will never make the child shots.

Code: [Select]
while(spellcount < 240){
      if(spellcount == 0){
spellangle = 0;
loop(30){
  spell_talisman(spellangle, GetPlayerX, GetPlayerY);
  spellangle += 12;
}
      }
      spellcount++;
      yield;
    } //closes while statement

I'm sure that the spell count++ is enclosed within the while(spell count < 240) statement. Or is it something that involves the spell talisman task not reading the spellcount increment?

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #377 on: December 20, 2012, 03:43:49 AM »
My mistake, yes. I corrected it immediately but I included another suggestion and you got here before I could submit it.

It's good practice to not use global variables in tasks and functions unless completely necessary. Instead if you need to you should be passing the global variables as arguments. This keeps everything needed in the function inside of that function and only that function. I didn't see your use of spellcount because in most cases you would use a local spellcount variable per task rather than referencing the one, or omit its usage entirely like my above suggestion.

Additionally, with the way you have it set up, once you get this working you can compact your three tasks into one recursive task and save a bunch of space.
« Last Edit: December 20, 2012, 03:47:11 AM by Drakums »

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

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #378 on: December 20, 2012, 04:33:23 AM »
OK. I see what you mean.

Basically, instead of incrementing the global var, I just set up an action for that time period (since my Main Loop has a yield, count is already being incremented, and the task is being done at the same rate), then perform an action (the eruption), then do the same procedure once more to create the desired effect.

It sort of looks like the organization of some of the stage scripts where you don't even increment a variable but just wait for a certain point before executing the next command. I think I can implement this part successfully (everything else is a different story).

Thank you very much.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #379 on: December 21, 2012, 12:18:17 AM »
Okay. The crash still occurs; I'll post a video of it.

The only major issues with the first player script now are the fact that the spell bullets don't change their heading when they fly at a different direction (can probably do this by looking at the previous responses and the Function list), and the issue regarding the crash, so this script is almost bug free.

Code: [Select]
fixme:d3d8:d3d8_device_GetInfo iface 0x1a15e0, info_id 0x4, info 0x328534, info_size 16 stub!
Assertion failed: (iface->lpVtbl == (const IDirect3DBaseTexture8Vtbl *)&Direct3DTexture8_Vtbl || iface->lpVtbl == (const IDirect3DBaseTexture8Vtbl *)&Direct3DCubeTexture8_Vtbl || iface->lpVtbl == (const IDirect3DBaseTexture8Vtbl *)&Direct3DVolumeTexture8_Vtbl), function unsafe_impl_from_IDirect3DBaseTexture8, file texture.c, line 1160.
wine: Assertion failed at address 0x000b:0x9389d9c6 (thread 0009), starting debugger...

Above is the error message that appeared in the Terminal Window.

Below is the Video Link:
http://www.youtube.com/watch?v=V4xQetjxsEE&feature=youtu.be

The most likely cause of the bug is the following:
For the main script, I have a picture called "Suiroga.png" that holds all of the spell data, shot and user pictures, etc.
This is called during @Initialize of the main script as a variable.
The same picture is also used in the spells, but is called with a different variable name. At the end of the spell, in @Finalize, this variable is deleted.

Perhaps Danmakufu deleted data for the first (called in the main script's Initialize) call as well? If so, then I just move it to a different image.
« Last Edit: December 21, 2012, 12:25:31 AM by Sparen »

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #380 on: December 21, 2012, 12:50:13 AM »
EDIT: Crash resolved. However, Danmakufu cannot read the new .png for some reason. (although I just renamed an edited copy of the original shotsheet.)

Code: [Select]
script_spell TalismanEruption{
  let spellcount=0;
  let spellangle=0;
  let spimg_suiroga = GetCurrentScriptDirectory()~"spellA.png";
  task spell_talisman(angle, x, y){
    let objtalisman=Obj_Create(OBJ_SPELL);
    let talismanangle=angle;
    Obj_SetPosition(objtalisman, x, y);
    Obj_SetAngle(objtalisman, angle);
    Obj_SetSpeed(objtalisman, 5);
    ObjEffect_SetTexture(objtalisman,spimg_suiroga);
    ObjEffect_SetRenderState(objtalisman,ADD);
    ObjEffect_CreateVertex(objtalisman,4);
    ObjEffect_SetPrimitiveType(objtalisman,PRIMITIVE_TRIANGLEFAN);
    ObjEffect_SetVertexUV(objtalisman,0,10,7);
    ObjEffect_SetVertexUV(objtalisman,1,27,7);
    ObjEffect_SetVertexUV(objtalisman,2,27,31);
    ObjEffect_SetVertexUV(objtalisman,3,10,31);
    ObjEffect_SetVertexXY(objtalisman,0,-8,-12);
    ObjEffect_SetVertexXY(objtalisman,1,9,-12);
    ObjEffect_SetVertexXY(objtalisman,2,9,12);
    ObjEffect_SetVertexXY(objtalisman,3,-8,12);
    //Obj_SetAlpha(objtalisman,200); //Orig
    ascent(i in 0..4){ObjEffect_SetVertexColor(objtalisman, i, 255, 255, 255, 255);}

Above is the code that lists the object properties. Below is a screenshot proving that spellA.png exists.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #381 on: December 21, 2012, 01:58:22 AM »
I don't see anything particularly wrong with the posted code, so let's get the obvious question out of the way.

Did you load the image? It's definitely not in the code snippet you gave us.
<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.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #382 on: December 21, 2012, 02:12:24 AM »
I don't see anything particularly wrong with the posted code, so let's get the obvious question out of the way.

Did you load the image? It's definitely not in the code snippet you gave us.

O_O

...Oops.

Edit: My SuirogaA player script now works beautifully (except for the artwork). I don't thing the angular direction matters much, and the bomb has been weakened to the point that no longer does 18000 damage point blank. Thanks! (Now I'll start asking questions about spell lasers and image control).
« Last Edit: December 21, 2012, 02:43:40 AM by Sparen »

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #383 on: December 21, 2012, 05:56:14 AM »
Whoo, another annoying question. But I've been searching everywhere for the problem.
http://pastebin.com/tsV2Geve <----Code Basic Stuff, The firing looks confusing, want to test it but...
http://puu.sh/1DpZw BAM Error Message with japanese that I can't understand  :V
And then BAM, another error message with the same message saying that about SetGraphicScale in Drawloop.
I tried lots of stuff, like taking the commands out, but the error message just targeted another command to pinpoint an error to. Why is this doing this?
Thanks in advance.  :3
Currently a normal player

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #384 on: December 21, 2012, 07:16:47 AM »
Quote
dir++;
dir++;
dir++;
dir++;
dir++;
oh god dir+=5; please
Quote
wait(60);
yield;
wait(61);

You forgot your #ScriptVersion[2].

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

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #385 on: December 22, 2012, 03:42:53 AM »
OK. In a player script, how would you use player lasers?

Code: [Select]
  task LighdraOption{ //INCOMPLETE
    //Following adapted from AliceMain (Team Sorcery script)
    //In all honesty, it'd be more efficient to have them just move along...
    let obj_bluelaser = Obj_Create(OBJ_LASER);
    ObjShot_SetGraphic(obj_bluelaser, 11);
    ObjShot_SetDamage(obj_bluelaser, 0.5);
    ObjShot_SetPenetration(obj_bluelaser, 10000);
    ObjLaser_SetWidth(obj_bluelaser, 5);
    ObjLaser_SetLength(obj_bluelaser, GetClipMaxY());
    ObjLaser_SetSource(obj_bluelaser, false); //delay cloud at source shown or not
    Obj_SetAlpha(obj_bluelaser, 230);
    Obj_SetAngle(obj_bluelaser, 270);
    Obj_SetSpeed(obj_bluelaser, 0);
    Obj_SetAutoDelete(obj_bluelaser,true); //I'm going to delete every frame, so... //MotK: This part is questionable, and feel free to tell me to set it to false.
  }

My aim for this task is to get the options to fire a laser forwards and backwards, similar to the attached picture. It moves along with the option. However, it only lasts when that shottype is in action (you can change shottypes in mid-battle by pressing C, which alters a global variable and changes the DrawLoop, shots, etc.). The issue is making sure that the laser stops firing when the variable changes, and that the image loads correctly. Also, the laser hitbox moves along with the options, allowing for sweeping the enemies in a stage clean.

The picture attached shows the NetLogo original; what I am planning to do is for Danmakufu, add lasers going at a 180 degree heading (danmakufu 90 degrees) from the options.

Any help would be greatly appreciated; the source from where I derived the above code has been cited in the second comment.

Lunasa Prismriver

  • Poltergeist Violinist
  • Himorogi, Burn in Violet
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #386 on: December 22, 2012, 11:11:05 AM »
I'm not sure if it would work but you can try.  :ohdear:
Add this in your task.
Code: [Select]
while(!Obj_BeDeleted(obj_bluelaser)){
    if(GetCommonData("ShotTypeGlobalVariable") != "C"){ //Test your global variable
        Obj_Delete(obj_bluelaser);
    }
    yield;
}

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #387 on: December 22, 2012, 03:06:21 PM »
Thanks for the Obj_Delete help.

Now... how exactly do you use 'User Defined Arguments?' In one script, they were put inside [], and I assume that in that scenario, they chose which option task's variables to access. Is that correct?

Either way, this is my current code for options firing lasers up and downwards. The lasers should move along with the options, and continuously pierce.

Code: [Select]
task LighdraOption(OrigX,OrigY,dir,optionID){ //INCOMPLETE
    //Following adapted from AliceMain (Team Sorcery script) and MarisaA
    //In all honesty, it'd be more efficient to have them just move along...
    //while not being deleted, set the lasers to options with GetPlayer#+optionpos.[ID] (ID of options)
    let obj_bluelaser = Obj_Create(OBJ_LASER);
    ObjShot_SetGraphic(obj_bluelaser, 11);
    ObjShot_SetDamage(obj_bluelaser, 0.5);
    ObjShot_SetPenetration(obj_bluelaser, 10000);
    ObjLaser_SetWidth(obj_bluelaser, 5);
    ObjLaser_SetLength(obj_bluelaser, 512); //Alt, GetClipMaxY or GetClipMinY
    ObjLaser_SetSource(obj_bluelaser, false); //delay cloud at source shown or not
    Obj_SetPosition(OrigX, OrigY);
    Obj_SetAlpha(obj_bluelaser, 230);
    Obj_SetAngle(obj_bluelaser, dir);
    Obj_SetSpeed(obj_bluelaser, 0);
    Obj_SetAutoDelete(obj_bluelaser,false);
    Obj_SetCollisionToPlayer(obj_bluelaser,false);
    while(!Obj_BeDeleted(obj_bluelaser)){
      if(Veetype != 2){ //Test your global variable
        Obj_Delete(obj_bluelaser);
        }
      Obj_SetX(obj_bluelaser, Obj_GetX(obj_option)[optionID]);
      yield;
      }
    }

The following code is called within the option tasks.

Code: [Select]
if(veetype == 2){ //Lighdra
  //LighdraOption(GetPlayerX()+optionxpos,GetPlayerY()+optionypos,90,ID)
  //LighdraOption(GetPlayerX()+optionxpos,GetPlayerY()+optionypos,270,ID)
}

Each option task begins like this:

Code: [Select]
task OptionL(position) {
    let ID=position;

I'm not specifically asking if the code works (because it probably doesn't as of right now). However, it any of you can give some advice on laser shots, I'd appreciate it. Thank you.

P.S. I don't know if the image I used is long enough. Would the solution be to alter the Y direction scale of the image and have the actual image of the laser as a seperate Obj_Effect?

puremrz

  • Can't stop playing Minecraft!
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #388 on: December 22, 2012, 08:38:43 PM »
I'm trying to create a semi-random number generator without any success so far.
At the beginning of the script a CommonData is made with a number between 0.00001 and 1 which will be used as a seed for the rest of the script.

This is what I have so far:
Code: [Select]
step 1: function Random(value){
step 2: GetCommonData("RandomNumber")*value???
step 3: return(a new number between 0 and 1); }
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

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #389 on: December 22, 2012, 11:07:49 PM »
What you want is psrand to set the seed and prand or prand_int to generate the random number.
<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.