How can I recover mana when hitting enemies?

kimduck

Member
I would like to implement a feature where mana is recovered every time I hit an enemy, like in Guardians / Denjin Makai II by Banpresto.
If anyone knows how to do this, I’d really appreciate your help.
 
Solution
I thought that if someone wrote actual source code, I would be able to understand it.

Okay, I've coded simple script for this purpose:
MPFill.c
C:
void main(){
    void self = getlocalvar("self");
    void vAniID = getentityproperty(self,"animationID");
    int MP = getentityproperty(self,"mp");

    if(vAniID != openborconstant("ANI_SPECIAL")){
      changeentityproperty(self, "mp", MP + 1);
    }
}

Save this in your data/scripts folder. Declare this script in your character's header with this line:

didhitscript data/scripts/mpfill.c

With this script, successful hit will refill 1 MP unit per hit except ones from SPECIAL animation.
I've added animation check if you want certain animation not to refill MP.

HTH
Welcome to the community @kimduck.

I would like to implement a feature where mana is recovered every time I hit an enemy, like in Guardians / Denjin Makai II by Banpresto.
If anyone knows how to do this, I’d really appreciate your help.

That's already the default behavior. You don't really need to do anything other than enabling MP in the first place. See MP in the manual.

DC
 
Why not use the search box or press Ctrl+F at the same time to find what you are looking for? Wait a sec. Isn't typemp the one you're looking for?

typemp {int}

  • Controls the conditions under which a player's MP can recover.
    • 0 (or leave blank) = players will recover MP slowly over time.
    • 1 = players will recover some MP when they hit an enemy.
    • 2 = players can't recover MP without using items or dying.

It should be in levels.txt file but you can add it under a certain game mode.

Example:
Code:
set    Arcade_Mode
lives 5
credits 5
nosame 1
typemp 1
#noshare 1
musicoverlap 1
maxplayers 4

branch    Stage1
z    394 488
scene   data/scenes/target/tar1.txt
file    data/levels/miami.txt
next
scene   data/scenes/target/tar2.txt
branch Stage2-1
z    190 265
file    data/levels/italy1.txt
branch Stage2-2
z    183 266
file    data/levels/italy2.txt

For reading the manual, I suggest you take your time reading it. You don't have to read it like a book which you start from the beginning to the end. You can use Ctrl+F for searching. It's important to read the manual if you want to know the commands.

I did share this in the past about reading comprehension on OpenBOR, but now I'm not sure if it's related to the manual or not after rewatching the video. (Hopefully it is; it's been so long I've not watched this.)
 
검색창을 이용하거나 Ctrl+F를 동시에 눌러 원하는 것을 찾아보세요. 잠깐만요. typemp가 당신이 찾는 프로그램이 아닌가요?


Thanks, bro. But using typemp 0 or typemp 1 recovers +5 MP per hit.
I want to recover +1 MP for each hit instead.


Also, I want to implement an mprate system in the character’s properties, so MP regenerates over time even when standing still, in addition to recovering when landing attacks.


Right now, since I don’t know a better way, I added this to the hitflash (FqBlood1) like this:

@script
int iMP = 0;
int i;
void ip;
if(frame == 0){
for(i = 0; i <= 3; i++){
ip = getplayerproperty(i, "entity");
iMP = getentityproperty(ip, "mp");
changeentityproperty(ip, "mp", iMP + 1);
}
}
@end_script
 
Thanks, bro. But using typemp 0 or typemp 1 recovers +5 MP per hit.
I want to recover +1 MP for each hit instead.


Also, I want to implement an mprate system in the character’s properties, so MP regenerates over time even when standing still, in addition to recovering when landing attacks.


Right now, since I don’t know a better way, I added this to the hitflash (FqBlood1) like this:

@script
int iMP = 0;
int i;
void ip;
if(frame == 0){
for(i = 0; i <= 3; i++){
ip = getplayerproperty(i, "entity");
iMP = getentityproperty(ip, "mp");
changeentityproperty(ip, "mp", iMP + 1);
}
}
@end_script

This method adds +1 MP to every player whenever a hit lands, which is not ideal.


Also, it’s annoying because I have to copy this to every single hitflash.


If you can teach me a better method, I’d be very grateful.
 
There is an mprate setting in the character's .txt file.
However, when using typemp 1, the character’s mprate doesn’t work.
Also, typemp 1 always restores +5 MP per hit, and I want to reduce that amount.


In addition, I want to exclude MP recovery for certain attacks like projectiles or special moves.


Since I don’t know how to do that, I’ve been using this workaround:

attack1
hitflash FqBlood1

And in FqBlood1.txt
@script
int iMP = 0;
int i;
void ip;
if(frame == 0){
for(i = 0; i <= 3; i++){
ip = getplayerproperty(i, "entity");
iMP = getentityproperty(ip, "mp");
changeentityproperty(ip, "mp", iMP + 1);
}
}
@end_script
But this method causes all players to recover MP, even if they didn’t hit anything.


So I’m looking for a better way to handle this, but I haven’t found one yet.
If you can teach me how, I’d really appreciate it.
 
The manual is too long, so I couldn't find the relevant section.
If you could tell me which part of the manual it’s in, or what keyword I should search for, I’d really appreciate it.

We just did... I do not wish to be obtuse or unfriendly, but not only did you ignore us, you're flat out refusing to take the most basic learning steps. Tons of effort goes into this forum and the documentation. If you refuse to use it because you think there's too much, that says straight away you have virtually no chance of completing a project. It's also extremely disrespectful and does not give us much to work with in terms of helping you.

DC
 
I do agree with Damon. If you refuse to read the manual beacuse "its too long", nobody will jump to help you because any non-short explanation won't be read too.

plus,
so I couldn't find the relevant section.
as someone who updates that manual for years, its a bit disrespectful. Maybe its a language barrier...
 
방금... 무뚝뚝하거나 불친절하게 굴고 싶지는 않지만, 당신은 우리를 무시했을 뿐만 아니라 가장 기본적인 학습 단계조차 따르지 않으려고 하시는군요. 이 포럼과 문서 작성에 정말 많은 노력을 쏟고 있습니다. 너무 많다고 생각해서 사용을 거부한다면, 프로젝트를 완료할 가능성이 거의 없다는 뜻입니다. 또한 매우 무례한 행동이며, 우리가 당신을 도울 수 있는 여지도 거의 없습니다.

DC
It's not that I haven't read it. It's that I can't read it.
There is just too much content to translate all of it.
I can only make rough guesses. Even with page translation tools, there are limitations.
To be honest, I can't even tell whether it's programming language, an explanation, or a translation.
However, I have analyzed and modified many text files in some OpenBOR games on my own, and tested them directly.
That's how I was able to understand the contents of the txt files by myself. But even that had its limits.
So, I came here to the OpenBOR development side and tried reading the manuals.
But since I'm not an English speaker, I found it very difficult to understand the manuals.


Honestly, it's easier for me to understand a pattern of source code that I can analyze directly myself.
If I offended anyone, I apologize. I've read the manual before, too.
But due to the language barrier, there are limits to my understanding.
That's why I came here to ask questions.


I thought that if someone wrote actual source code, I would be able to understand it.


I know the manuals were written with great effort, but I'm truly unable to read them.
I'm sorry. If I made anyone feel bad, I sincerely apologize.
 
I thought that if someone wrote actual source code, I would be able to understand it.

Okay, I've coded simple script for this purpose:
MPFill.c
C:
void main(){
    void self = getlocalvar("self");
    void vAniID = getentityproperty(self,"animationID");
    int MP = getentityproperty(self,"mp");

    if(vAniID != openborconstant("ANI_SPECIAL")){
      changeentityproperty(self, "mp", MP + 1);
    }
}

Save this in your data/scripts folder. Declare this script in your character's header with this line:

didhitscript data/scripts/mpfill.c

With this script, successful hit will refill 1 MP unit per hit except ones from SPECIAL animation.
I've added animation check if you want certain animation not to refill MP.

HTH
 
Solution
It's not that I haven't read it. It's that I can't read it.
There is just too much content to translate all of it.
I can only make rough guesses. Even with page translation tools, there are limitations.
To be honest, I can't even tell whether it's programming language, an explanation, or a translation.
However, I have analyzed and modified many text files in some OpenBOR games on my own, and tested them directly.
That's how I was able to understand the contents of the txt files by myself. But even that had its limits.
So, I came here to the OpenBOR development side and tried reading the manuals.
But since I'm not an English speaker, I found it very difficult to understand the manuals.


Honestly, it's easier for me to understand a pattern of source code that I can analyze directly myself.
If I offended anyone, I apologize. I've read the manual before, too.
But due to the language barrier, there are limits to my understanding.
That's why I came here to ask questions.


I thought that if someone wrote actual source code, I would be able to understand it.


I know the manuals were written with great effort, but I'm truly unable to read them.
I'm sorry. If I made anyone feel bad, I sincerely apologize.

That makes sense. We're used to most people avoiding source code like the plague, but if that's what you prefer source-code, we can help. See @bloobane's answer above.

DC
 
알겠습니다. 이 목적을 위해 간단한 스크립트를 작성했습니다.
MPFill.c
[코드=c]
void main(){
void self = getlocalvar("self");
void vAniID = getentityproperty(self,"애니메이션ID")
int MP = getentityproperty(자기 자신, "mp");

if(vAniID != openborconstant("ANI_SPECIAL")){
changeentityproperty(self, "mp", MP + 1);
}
}
[/암호]

이 스크립트를 data/scripts 폴더에 저장하세요. 캐릭터 헤더에 다음 줄을 추가하여 스크립트를 선언하세요.

didhitscript 데이터/스크립트/mpfill.c

이 스크립트를 사용하면 SPECIAL 애니메이션을 제외하고 명중이 성공할 때마다 MP가 1씩 채워집니다.
특정 애니메이션이 MP를 다시 채우지 않도록 하려면 애니메이션 확인을 추가했습니다.

HTH
Wow~ Really, thank you, brother. I've asked ChatGPT so many times just to make this work, but it kept giving me strange answers.
I don’t know anything about programming — I just found an OpenBOR game that was so much fun, and I wanted to modify it.
I spent the whole day searching for a solution. In the end, I discovered that one character had a move that restored MP for all allies,
and I used that idea. I used hitflash FqBlood1 in the character’s script and then added the MP restore code into FqBlood1.txt.
That was the best I could do.
Oh~ this is amazing. Thank you!
 
Back
Top Bottom