Topic: ※ Danmakufu Q&A/Problem thread 3 ※  (Read 80587 times)

0 Members and 1 Guest are viewing this topic.

Drake

  • *
  • LOOK AT ME
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1590 on: December 03, 2018, 08:54:23 am »
The lasers are also player shots, so if you forbid player shots they will not fire. Why are you trying to forbid player shots? Do you just want to stop the player from firing while the spell card is active?

If this is what you want, you can add if(!IsPlayerSpellActive()) as a condition to fire your main player shots. You should also add some kind of wait before you delete the spell manager object, since that's the signal to say the spell is finished.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by あかがし -

Tad Marx Barba

  • Neophyte
  • Nickname: Marx
  • Gender: Male
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1591 on: December 03, 2018, 07:22:48 pm »
The lasers are also player shots, so if you forbid player shots they will not fire. Why are you trying to forbid player shots? Do you just want to stop the player from firing while the spell card is active?

Yes, I'm trying to forbid the player shots from firing during the spellcard.

If this is what you want, you can add if(!IsPlayerSpellActive()) as a condition to fire your main player shots. You should also add some kind of wait before you delete the spell manager object, since that's the signal to say the spell is finished.
Is that so easy to do? (sorry I'm new in creating player scripts, I want create MY OWN PLAYER SCRIPTS in order to quit using the player scripts that others made, I'm not comfortable using scripts that aren't mine)

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
  • Staff
  • LOOK AT ME
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1592 on: December 03, 2018, 08:21:27 pm »
Is that so easy to do? (sorry I'm new in creating player scripts, I want create MY OWN PLAYER SCRIPTS in order to quit using the player scripts that others made, I'm not comfortable using scripts that aren't mine)
If that is the case, then it is highly suggested to read and follow tutorials so you will be making your own player scripts.
  • Helepolis' Siege Workshop

Tad Marx Barba

  • Neophyte
  • Nickname: Marx
  • Gender: Male
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1593 on: December 03, 2018, 10:25:33 pm »
If that is the case, then it is highly suggested to read and follow tutorials so you will be making your own player scripts.
Where I search that tutorials? I need to improve my skills in creating player scripts!  :D :D :D :D

But I still have that question, How to use IsPlayerSpellActive ?
« Last Edit: December 03, 2018, 10:30:21 pm by Tad Marx Barba »

Drake

  • *
  • LOOK AT ME
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1594 on: December 04, 2018, 02:07:56 am »
In your foxShot task, you would add the condition before firing your player shots:

Code: [Select]
while(!Obj_IsDeleted(ID))
{
if(!IsPlayerSpellActive){
if(GetVirtualKeyState(VK_SHOT) == KEY_PUSH||[...]
[...]
}
wait(5);
}

If you only change this, it will seem like it doesn't do anything. This is because in your spell you delete the spell manager object right after you fire all the lasers:

Code: [Select]
task Bloody_Laser(frame, num, amnt)
{
[...]
// loop firing lasers
OSCURECER_PANTALLA(GetPlayerX(), GetPlayerY(), 40, [50, 110, 255], 405);
Blink;
Obj_Delete(man);
}

Which ends the spell after only a couple frames, even though the effects and lasers will still exist. You can see this if you try spamming bombs; you will get three of them overlapping at once.

If you add a delay before you delete the spell manager object, to mark where the spell should end, it will fix this issue:

Code: [Select]
task Bloody_Laser(frame, num, amnt)
{
[...]
// loop firing lasers
OSCURECER_PANTALLA(GetPlayerX(), GetPlayerY(), 40, [50, 110, 255], 405);
Blink;
wait(300);
Obj_Delete(man);
}

These two changes will be enough to stop the player from firing during the spell.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by あかがし -

Tad Marx Barba

  • Neophyte
  • Nickname: Marx
  • Gender: Male
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1595 on: December 04, 2018, 03:14:08 am »
So much Thanks Drake! I still learning how to do somethings in player script, 'cause I'm new in that

After take a bath, I couldn't stop thinking what was I've to do in that, I thought that putting the if conditional then the while loop of the player shot could be a way to correct the problem with the line
Code: [Select]
SetForbidPlayerShot(true);
But I couldn't thought that I have to put a wait before the spell manager erased. Thank you very much, Drake!  :blush: ::) ::)

I'll credit you for your help!

Kinedyme

  • Dream Magic - Duplex Spark!
  • Nickname: Kine
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1596 on: December 05, 2018, 12:24:55 pm »
I've noticed that when a text object inserts a line break in a string due to it hitting max length, the line break can be added in the middle of a word. Is there a way to stop this behaviour, short of manually specifying all line breaks?

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
  • Gender: Male
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1597 on: December 05, 2018, 02:39:26 pm »
I've noticed that when a text object inserts a line break in a string due to it hitting max length, the line break can be added in the middle of a word. Is there a way to stop this behaviour, short of manually specifying all line breaks?

I wrote a library for this.

https://github.com/Sparen/Sparen-DNH-STL/blob/master/lib_autoformat.dnh

Kappapa

  • Neophyte
  • Gender: Female
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1598 on: December 05, 2018, 09:24:00 pm »
Hello everyone, this is my first post here and I really hope that someone can help me :)

So! Recently I got into Danmakufu, more than once I tried to script in the past, but I always gave up until now. I already created a Spell Card for Yuyuko, Ringo and Sagume, just as a practice. Now I'm creating another one for a random character, but there is something that is bugging me:

Basically the Spell Card is about many blue and red bullets that go towards the upper part of the screen (in a "Geyser style") and when they reach a random section of the upper part they are supposed to aim at the player (or a random section where the player is) as if there was no gravity and with a different graphic. I've been able to recreate the first part of the Spell, but I really can't get past the second one.

I don't know how to change the bullets graphic and their direction.
I tried Booleans as well, but maybe I typed something wrong since I still have to understand them?
Anyway I hope someone can help. If you need the script, just ask and I'll send it privately.
And sorry for my bad English!

[INSERT USERNAME HERE]

  • Neophyte
  • Nickname: ZetA
  • Gender: Male
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1599 on: December 07, 2018, 02:33:41 pm »
Basically the Spell Card is about many blue and red bullets that go towards the upper part of the screen (in a "Geyser style") and when they reach a random section of the upper part they are supposed to aim at the player (or a random section where the player is) as if there was no gravity and with a different graphic. I've been able to recreate the first part of the Spell, but I really can't get past the second one.
Have you tried using "ObjMove_AddPatternA3"? You can use it to change the bullets' angle, speed, etc., and the bullet graphic.
If you want to change their direction in a random section on the upper part, you can try to make the code that's going to change the bullets' way/graphic get executed when they reach a certain y coordinate (for example 60), and make the code wait for random time (for example 20-60 frames).

AKA something like this:
Code: [Select]
//Shooting bullet(s), assuming they're defined to an object called "bullet"

//. . .

TBulletChange(bullet);

//. .​ .

task TBulletChange(obj){
if(ObjMove_GetY(obj) == 60){
ObjMove_AddPatternA3(obj, rand(25, 60), NO_CHANGE, GetAngletoPlayer(obj), NO_CHANGE, NO_CHANGE, ObjMove_GetSpeed(obj), "Bullet graphic ID you want to change into");
}
}
And I doubt it's the easiest way to do it, I just do it like this myself.
And sorry for my bad English!
Ah shush, your English isn't bad. ^-^

Note: If you're using CreateShotB2 to create bullets, the code above wouldn't work, and you need to find a different way to make bullets face to the player, which I don't know, sorry.

Kappapa

  • Neophyte
  • Gender: Female
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1600 on: December 08, 2018, 01:15:34 am »
Have you tried using "ObjMove_AddPatternA3"? You can use it to change the bullets' angle, speed, etc., and the bullet graphic.
If you want to change their direction in a random section on the upper part, you can try to make the code that's going to change the bullets' way/graphic get executed when they reach a certain y coordinate (for example 60), and make the code wait for random time (for example 20-60 frames).

AKA something like this:
Code: [Select]
//Shooting bullet(s), assuming they're defined to an object called "bullet"

//. . .

TBulletChange(bullet);

//. .​ .

task TBulletChange(obj){
if(ObjMove_GetY(obj) == 60){
ObjMove_AddPatternA3(obj, rand(25, 60), NO_CHANGE, GetAngletoPlayer(obj), NO_CHANGE, NO_CHANGE, ObjMove_GetSpeed(obj), "Bullet graphic ID you want to change into");
}
}
And I doubt it's the easiest way to do it, I just do it like this myself.Ah shush, your English isn't bad. ^-^

Note: If you're using CreateShotB2 to create bullets, the code above wouldn't work, and you need to find a different way to make bullets face to the player, which I don't know, sorry.


Ahhh thank you a lot, after a while I managed to do it and I'm quite pleased with the effect despite the difficulty ahah. I used AddPatternA3, but instead of creating another task I put it in the task with the current fired bullet so that after a couple frame they could have changed their graphic and angolation :D

Kinedyme

  • Dream Magic - Duplex Spark!
  • Nickname: Kine
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1601 on: December 10, 2018, 11:47:16 am »
What are the differences between Common Data and Area Common Data functions?

The documentation seems to imply that Area Common Data is a case of Common Data where you manually assign the location of the memory (indexed array?). If so, where is the regular Common Data stored?

And from a practical standpoint, which is easier/faster/safer to use?

Drake

  • *
  • LOOK AT ME
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1602 on: December 10, 2018, 12:12:59 pm »
Common Data Areas are groups of Common Data. If you have a lot of Common Data for related things (as would probably pop up in a large project), you might want to put them into areas to categorize them. The CommonData functions are a shortcut for the special case where the area name is "" (empty string), which is automatically created by default.

Fundamentally, a Common Data table is a dictionary structure, where you have strings as keys that map to arbitrary values. The Common Data Area table is also a dictionary, where strings (the area names) map to different Common Data tables.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by あかがし -

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
  • Staff
  • LOOK AT ME
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1603 on: December 11, 2018, 05:35:34 am »
Additionally, CommonDataArea can be saved to a file and thus become "persistent" data. CommonData is cleared once the game ends. Useful if you want to store progress (spellcard history etc.) / configuration settings and such of a player

  • Helepolis' Siege Workshop

Kinedyme

  • Dream Magic - Duplex Spark!
  • Nickname: Kine
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1604 on: December 11, 2018, 09:29:49 am »
Additionally, CommonDataArea can be saved to a file and thus become "persistent" data. CommonData is cleared once the game ends. Useful if you want to store progress (spellcard history etc.) / configuration settings and such of a player

Is this to say that the default CommonData area "" cannot be converted to persistent memory?
I also take it that this method of storing progress is recommended above the use of writing to file objects with ObjFile_OpenNW?

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
  • Staff
  • LOOK AT ME
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1605 on: December 11, 2018, 02:31:14 pm »
I discussed this with Drake on IRC. To be honest, I am not exactly sure what happens if you call SaveCommonDataArea without providing a value for the "area". The guess is that it will generate a file containing the commondata values. But I have never tried this thus one way to find out for you.

- Write a script that creates a CommonData with a key value pair and save it with empty string value as you wrote.
- Also write somewhere where the commondata is loaded and the data is read.
- Close the script/game
- Reboot game and see what happens.[/li][/list]

Do report your findings, I would say
  • Helepolis' Siege Workshop
 

SMF 2.0.15 | SMF © 2017, Simple Machines
Theme based on ModernDark64 design by BlocWeb
Page created in 0.076 seconds with 22 queries.