Author Topic: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m [Closed, read last post!]  (Read 185533 times)

Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #780 on: May 17, 2014, 07:45:18 AM »
So I've been playing with Concealed the Conclusion and love the player scripts. Problem is, whenever I try to play as the various Marisas in certain scripts, I get errors before I can even start playing. This doesn't happen for any other player script that I've tried, only the CTC Marisas. Has there been a thread on this before, or is this just unsolvable using the CTC player scripts? For more info, I've checked with the other threads regarding error messages. Normally the error has to do with either trying to change a variable's type or comparing two different variables that can't be compared, like a string to a number.

This leads me to believe that something in the Marisas' coding seems to use certain variable names already, or something like that. But I have no idea where to go from there. For example, one problem line is "score=GetCommonData("Score");"which gives the changing a variable type error. Any ideas on what's going on? Are there versions of the  CTC Marisas that are compatible with other scripts?

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #781 on: May 17, 2014, 03:51:13 PM »
So I've been playing with Concealed the Conclusion and love the player scripts. Problem is, whenever I try to play as the various Marisas in certain scripts, I get errors before I can even start playing. This doesn't happen for any other player script that I've tried, only the CTC Marisas. Has there been a thread on this before, or is this just unsolvable using the CTC player scripts? For more info, I've checked with the other threads regarding error messages. Normally the error has to do with either trying to change a variable's type or comparing two different variables that can't be compared, like a string to a number.

This leads me to believe that something in the Marisas' coding seems to use certain variable names already, or something like that. But I have no idea where to go from there. For example, one problem line is "score=GetCommonData("Score");"which gives the changing a variable type error. Any ideas on what's going on? Are there versions of the  CTC Marisas that are compatible with other scripts?

Regarding the CommonData:
-This is the reason why player scripts meant for a certain script do not always work elsewhere. The default value for a CommonData is, I think, "0" or something along those lines. (Might be ""). If the Score CommonData is not set to a number outside of the player, problems may arise.

Then again, this *could* be a local issue

Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #782 on: May 17, 2014, 08:33:19 PM »
I think I fixed the problem! I made a duplicate of everything in the THC_MARISA folder first just so I still have the compatible version for CtC, but then looked at the code for the player in the duplicates I made. I started with the assumption I made and what you confirmed regarding CommonData, and looked for everything that had to do with that. I found a line in the Common file in the lib folder's THCCL folder. The line simply read "ClearCommonData();" which seemed problematic for other types of games. So I put two slashes // in front of it to block it out, and suddenly everything works. It might cause stability issues or something for the game these four were meant for, though, so I'd have to remove the double slashes again if I want to play CtC again. Thanks for the help!

TheTeff007

  • Best Touhou 2015!
  • So much cuteness...!
    • Youtube Channel
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #783 on: May 30, 2014, 05:14:51 AM »
Can somebody tell me why does this happen?

http://i61.tinypic.com/2ihmgyu.jpg

The laser is supposed to come out from the options, but it doesn't. Furthermore, if I adjust the summoning point so it appearsright on the spot, it's like  pixels away  from the actual damaging point.

The code is simple: [ CreatePlayerShot01(GetPlayerX - 45, GetPlayerY + 5, 30, 270, 0.02, 100, 3); ] and the shotdata for the laser is
[ ShotData { id = 3 rect = (256, 0, 270, 316) render = ADD alpha = 200 } //Laser ]

Whatever could be wrong here?
Small Teaser of my upcoming project~

No need to call me Teff007. Teff will do just as well~

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #784 on: May 30, 2014, 07:19:30 AM »
Impossible to judge this  because you're not providing any code.

TheTeff007

  • Best Touhou 2015!
  • So much cuteness...!
    • Youtube Channel
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #785 on: May 30, 2014, 12:11:23 PM »
This would be it. This pastebin includes both the code for Marisa's player character and her shotdata, separated by lots of ///////////

http://pastebin.com/F3GH6DYA
Small Teaser of my upcoming project~

No need to call me Teff007. Teff will do just as well~

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #786 on: May 30, 2014, 01:41:24 PM »
Ehm, is Blackout piece of code your laser graphic code? Or are you using CreatePlayerShot and simply defined the size of the "laser" from the sprite sheet?

In case of black out piece being your laser
As expected, you're trying to create a laser which hits like a regular shot bullet.  OT: Is there any specific reason you didn't went for a laser object instead?

Well, that is up to you to decide. To help you out with your problem (Drake suspected the same). You're using an effect object which you are most likely spawning somewhere. Please keep in mind that the actual centre point of an effect object is not always the starting point of your laser.
[attach=1]

You defined your vertex in an odd way so it is hard for me to read. But in basic: If you try to use an 128x128 image as effect object, then in common situations you use  x-64,y-64  for the first vertex (Ry. The image will be 128x128 as a result but your actual centre point for "moving" the sprite around is exactly at the centre. Which is logical as you drawn 64 to the left + right and 64 to the bottom and up.

You could also immediately draw the vertex at  x-64,y0 and x64,y0 for example forming the bottom side of the laser. Then the top two vertex would be -64,-128 and 64,-128. Your "centre" point will be the "bottom of the laser". So if you spawn it at the familiar, it will look proper.

This only fixes your graphical issue. The actual damage point is dependant on your CreatePlayerShot.

In case not
The centre of the rect code for your bullet is always the centre of the bullet. In your case, your laser is 256, 0, 270, 316  which is  270-256 > 14 pixels from left to right and 316 pixels long. The centre of your "laser" is the centre of 14 and 316 rectangle. (see the image above). The laser appears exactly at that point but the graphical look will fool you since it is is 316 pixels long. This is also your error, as you're focussing too much on the graphical issue rather than the actual main problem.

How to solve it
If you're spawning a laser, use a Laser object. It is basically a regular laser shot object but by setting the damage parameters and penetration it becomes a player shot, which is: ObjShot_SetDamage();  and ObjShot_SetPenetration();

You will need most likely an effect object on top of this to display the laser. AFAIK setting a graphical texture doesn't show but  my 0.12m code is too ancient right now to confirm.

Good luck.
« Last Edit: May 30, 2014, 01:44:18 PM by Helepolis »

TheTeff007

  • Best Touhou 2015!
  • So much cuteness...!
    • Youtube Channel
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #787 on: May 30, 2014, 07:53:49 PM »
Well, what do you know?

http://i58.tinypic.com/2gsrfco.jpg

Ultimately, a simple, non-animated laser proved to function perfectly. I will deal with using other graphic later, I care more about playability right now.

Currently, I have yetto balance the damage, but that is not really a problem and more something of trial and error. Thanks a lot~!
Small Teaser of my upcoming project~

No need to call me Teff007. Teff will do just as well~

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #788 on: May 30, 2014, 08:10:11 PM »
The animated laser you basically spawn an effect obj (as I said previously) on top of your "real laser" then just give your Laser shot an non-existent ID so it becomes invisible. The animated laser will take care of that then.


Mahou Shoujo Nel!

  • Mahou shoujou
  • Well, let the Mahou begin Trinity!
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #789 on: June 02, 2014, 11:22:59 AM »
Well.... Is it possible to create a non-installed Object laser?
I want to create a simple laser like on "CreateLaser01".
The... "AddShot" function would also be a solution ,but i dont know how to use it probably ._.
Can anyone give me an example for one of these?

Ozzy

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #790 on: June 02, 2014, 11:18:39 PM »
Well.... Is it possible to create a non-installed Object laser?
I want to create a simple laser like on "CreateLaser01".
The... "AddShot" function would also be a solution ,but i dont know how to use it probably ._.
Can anyone give me an example for one of these?
The Obj_SetSpeed function does not work on object lasers. However, you can move them by repeatedly setting their positions with Obj_SetPosition. You will probably also want to use ObjLaser_SetSource to turn off the laser base glow.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #791 on: June 03, 2014, 12:53:01 AM »
Well.... Is it possible to create a non-installed Object laser?
I want to create a simple laser like on "CreateLaser01".
The... "AddShot" function would also be a solution ,but i dont know how to use it probably ._.
Can anyone give me an example for one of these?

I believe I have code for this (Miransu gave it to me for one of Pikachu's spells in PDD)

However, I edited it for use specifically in the spell it was used for and it's probably best not to use it. Do what Ozzy said; use SetPosition to move the laser depending on its speed and angle.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #792 on: June 03, 2014, 05:54:47 AM »
Can anyone give me an example for one of these?
See below. V is the speed of the laser which you can define yourself. Angle will be the direction it is moving to.  This will also make the laser extend first until it reaches max length then continue to move on. If you don't do this, the laser will pop up in full length looking more like a spear being thrown instead of a laser like laser01.

http://pastebin.com/VVihdFXQ

Mahou Shoujo Nel!

  • Mahou shoujou
  • Well, let the Mahou begin Trinity!
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #793 on: June 03, 2014, 01:23:46 PM »
Thank you all!
By the way... To make a simple 3D image mowing in a loop (like the water in EoSD in stage 2)
do i need to use the postion of the image or the graphic rect?

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #794 on: June 03, 2014, 03:40:12 PM »
do i need to use the postion of the image or the graphic rect?
Always scroll the graphic rect. Example:  SetGraphicRect(0+scroll,0,1024+scroll,1024); or which ever you wish.

Mahou Shoujo Nel!

  • Mahou shoujou
  • Well, let the Mahou begin Trinity!
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #795 on: June 05, 2014, 04:48:02 PM »
Thank you a lot ,Helepolis-sanbe!
And to all other people too! :P

TheTeff007

  • Best Touhou 2015!
  • So much cuteness...!
    • Youtube Channel
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #796 on: June 24, 2014, 07:31:11 PM »
http://i.imgur.com/ZWwT3yq.png

I need help regarding these three images in my folder:

Ring.png will just be placed on the field. It will be the frame for the other ones. I have no problems with this one.

BG.png will be drawn before Ring, so it's below and doesn't overlays with it. This image will be filling the empty space of the ring as a functions tracks the amount of items collected. When beggining, the image will be empty and will go filling little by little. I have no problems with this one either.

BG2.png is the troublesome one. I want this image to scroll over BG.png without going outside the borders. I don't know if I made myself clear, but this image must be withing the current borders that BG2 has. Is there any way to do it?
Small Teaser of my upcoming project~

No need to call me Teff007. Teff will do just as well~

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #797 on: June 24, 2014, 07:48:18 PM »
It is possible, you'll be needing an effect object forming a nice circle from vertex (You need the Primitive Fan type). Then you'll use UV mapping to place the texture and then simply scroll that. You can set the specific drawing layer to modify the order of drawing.

Hope that will help you out.

TheTeff007

  • Best Touhou 2015!
  • So much cuteness...!
    • Youtube Channel
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #798 on: June 24, 2014, 08:33:37 PM »
It is possible, you'll be needing an effect object forming a nice circle from vertex (You need the Primitive Fan type). Then you'll use UV mapping to place the texture and then simply scroll that. You can set the specific drawing layer to modify the order of drawing.

Hope that will help you out.

Wouldn't that be way to much vertex-es? I can do it, sure, but I wonder if it would cause danmakufu to lag a lot... (Unless it has something to do with the Fan type, since I only use Triangle Strip.
Small Teaser of my upcoming project~

No need to call me Teff007. Teff will do just as well~

Drake

  • *
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #799 on: June 24, 2014, 10:28:52 PM »
So I'm a bit confused here. Is this what you want?


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

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #800 on: June 25, 2014, 05:46:19 AM »
Wouldn't that be way to much vertex-es? I can do it, sure, but I wonder if it would cause danmakufu to lag a lot... (Unless it has something to do with the Fan type, since I only use Triangle Strip.
You can be at ease that it won't lag. And you won't be replacing/recalculating the vertex positions so the engine doesn't gets beaten. Triangle Strip is going to make your life harder, you'll be needing Fan. Because with Fan, you keep your first vertex at the centre then place the others around it connecting. If you play X-number of vertex in a circular position then you'll get a nice circle. See for yourself how smooth you need it to be and increase/decrease the number of vertex


Also: What Drake posted is what I imagined as well when I read your post. I am not sure if Drake has an alternative approach but you'll need to confirm that first.

« Last Edit: June 25, 2014, 05:49:57 AM by Helepolis »

TheTeff007

  • Best Touhou 2015!
  • So much cuteness...!
    • Youtube Channel
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #801 on: June 25, 2014, 05:55:45 AM »
@Drake: Exactly. What is the lines in your image would be BG2 scrolling towards a direction (Which I can do without troubles)

@Hele: Ok, then. I shall give it a try.
Small Teaser of my upcoming project~

No need to call me Teff007. Teff will do just as well~

Drake

  • *
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #802 on: June 25, 2014, 09:22:25 AM »
My idea was to use render targets to draw BG2 on top of the BG texture (and scroll BG2), and then drawing that combined texture (with the gradually increasing height). It would require you use add-blend for BG2 though, and it might be a bit awkward to script if you're unfamiliar with render targets. But it's pretty much exactly what you're asking for.
http://dmf.shrinemaiden.org/wiki/Render_Targets
« Last Edit: June 25, 2014, 09:25:54 AM by Drake »

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

AJS

  • Danmakufu Scripter
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #803 on: June 30, 2014, 02:22:07 AM »
How can I make an object bullet that will delete another (different) object bullet when it comes into contact with it?  I've tried using common data to exchange bullet position info between the object bullet tasks and setting a condition for the to-be-deleted bullet to delete itself if their positions are the same, but Danmakufu freaks out whenever I try to do that.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #804 on: July 02, 2014, 08:51:23 PM »
How can I make an object bullet that will delete another (different) object bullet when it comes into contact with it?  I've tried using common data to exchange bullet position info between the object bullet tasks and setting a condition for the to-be-deleted bullet to delete itself if their positions are the same, but Danmakufu freaks out whenever I try to do that.
Depends on how precise you want the collision to be. If it is just specifically object bullets then you cannot use the Collision_Obj_Obj function, because it is I think calculated from the centre for each bullet. You'll need to define one of the object bullets as global then apply custom collision detection for the other one in a circle. For example if distance of obj is x-pixels in range of the other obj > delete.
Code: [Select]
let bulletObj = (ry

task otherBullet {
let obj = (ry
<stuff about obj>

while(!Obj_BeDeleted) {

if(collision code(ry
}
}

If you don't care about whatever bullet is deleted, you can use DeleteEnemyShotInCircle(TYPE,x,y,radius); where TYPE =      ALL: Deletes all bullets, no exceptions.  SHOT: Ignores lasers and bomb-resistant bullets.  CHILD: Only deletes the bullets the enemy fired.  (wiki source).


Python

  • Plains of Chi-u have no end.
  • *
  • They are boundless and last forever.
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #805 on: July 04, 2014, 08:14:52 PM »
Uh, hello there. I'm new here and already complaining about Shit not working:
I use this Code in Order to reflect my Bullet off of the Screen Borders (found it somewhere on the Forum):
Code: [Select]
while(Obj_BeDeleted(obj) == false && reflect < 10){
ObjShot_Reflect(obj, 0);
reflect++;
yield;
}

The Function:

Code: [Select]
function ObjShot_Reflect(id, dist){
    if(Obj_GetX(id)<GetClipMinX-dist || Obj_GetX(id)>GetClipMaxX+dist){Obj_SetAngle(id, 180-Obj_GetAngle(id));}
    if(Obj_GetY(id)<GetClipMinY-dist || Obj_GetY(id)>GetClipMaxY+dist){Obj_SetAngle(id, 0-Obj_GetAngle(id));}
}

However Danmakufu seems to not run the While-Loop for whatever Reason. Might someone help me here, if possible?
I'll provide any additional Information needed. Thanks!  :)
Have a look at my truly scrumptious scripts!.

Drake

  • *
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #806 on: July 04, 2014, 10:55:14 PM »
First reaction is that it's just going to increment reflect for 10 frames then exit the loop. I assume you instead want it to increment only when it's reflected.

If you want to keep that code in a function, you could return true if the reflect condition is met and return false otherwise. Then your statement would become if(ObjShot_Reflect(obj, 0)){ reflect++; }.

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

Python

  • Plains of Chi-u have no end.
  • *
  • They are boundless and last forever.
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #807 on: July 05, 2014, 01:41:21 PM »
Thanks for answering, but it doesn't seem to work correctly (or I did something wrong :/ )
I changed the Code to:
Code: [Select]
while(Obj_BeDeleted(obj) == false && reflect < 10){
ObjShot_Reflect(obj, 0);
if(ObjShot_Reflect(obj, 0)){
reflect++;
}
yield;
}
and left the ObjShot_Reflect Function as before.

Also, if there is better Way to have a Bullet reflect off the Border a fixed Amount of Times, please say so.
Have a look at my truly scrumptious scripts!.

Drake

  • *
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #808 on: July 05, 2014, 10:39:50 PM »
No no, you want ObjShot_Reflect() to return a value: true if the object reflects, and false if the object does not reflect. So in your loop it would then ask if it returned true or false, and if it returned true (the bullet reflected), then increment the variable.

Code: [Select]
function ObjShot_Reflect(id, dist){
if(Obj_GetX(id)<GetClipMinX-dist || Obj_GetX(id)>GetClipMaxX+dist){
Obj_SetAngle(id, 180-Obj_GetAngle(id));
return true;
}
if(Obj_GetY(id)<GetClipMinY-dist || Obj_GetY(id)>GetClipMaxY+dist){
Obj_SetAngle(id, 0-Obj_GetAngle(id));
return true;
}
return false;
}

while(Obj_BeDeleted(obj) == false && reflect < 10){
if(ObjShot_Reflect(obj, 0) == true){
reflect++;
}
yield;
}
Like this.

But if you don't care about ObjShot_Reflect() being its own function, you could just plop its contents into the loop:
Code: [Select]
while(Obj_BeDeleted(obj) == false && reflect < 10){
if(Obj_GetX(id)<GetClipMinX-dist || Obj_GetX(id)>GetClipMaxX+dist){
Obj_SetAngle(id, 180-Obj_GetAngle(id));
reflect++;
}else if(Obj_GetY(id)<GetClipMinY-dist || Obj_GetY(id)>GetClipMaxY+dist){
Obj_SetAngle(id, 0-Obj_GetAngle(id));
reflect++;
}
yield;
}

Lastly I forgot to mention that you should make sure that your @MainLoop has a yield statement in it.

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

Python

  • Plains of Chi-u have no end.
  • *
  • They are boundless and last forever.
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #809 on: July 06, 2014, 07:33:45 AM »
Ohhhhhhh! OK! :)
I guess I misunderstood something. Thank you.

EDIT: To prevent Double-Posting, I'll post another Problem here:

For my Boss Script, I want a Conversation to occur between the Fight and the Last Spells, so I added a Talk Event into the Script of the last
Attack and put this in @MainLoop:

Code: [Select]
if(GetPlayerScriptName == "player\Flandre\Flandre.txt" || "player\Flandre\FlandreB.txt" && GetLife < 1){
CreateEventFromScript("flan");
}

if(GetPlayerScriptName == "player\Remilia\RemiA.txt" || "player\Remilia\RemiB.txt" && GetLife < 1){
CreateEventFromScript("remi");
}

All Player Scripts exist, of Course.
However upon clearing the Spell Card, the Enemy just dies and the Script ends. Once the Talk Event showed up for about one Second and
then the Script ended. What am I doing wrong?
« Last Edit: July 06, 2014, 04:52:09 PM by Python »
Have a look at my truly scrumptious scripts!.