maxman
Well-known member
There's something I have in mind that probably no one has asked before. It's the issue on holding and releasing key triggers during pause menus or text type entities. Recently, I created a key script for pressing a specific button to spawn an entity, something like a moveset for a certain character, so that I press it anytime and anywhere instead of just being on the ground to press for its moveset to pop out like freespecial. However, I created a new fake entity that is used for mainly holding specific key triggers after pressing a button via keyscript. I also created a new keyscript for that fake entity which you release the given button (pressed or held). It removes itself after releasing it. I use a keyscript for pressing a given to spawn an entity. You hold the same button after pressing it until the text type entity (e.g., character moveset, conversation, etc.) pops up.
Here's a problem of what I'm facing. It's a multiplayer issue regarding the button conflict during pauses. For example, player A controls player 1 while player B controls player 2. Player A presses/holds A2 button first before player B does. Both of them have held that button on their controllers they're using until player 1's moveset pops up due to player A being the first to press. The problem is not holding the A2 button during the pause entity. The problem is when you let go off of that A2 button during the pause menu or text type entity. What happens when you release A2 during that pause before cancelling it with any button? That fake entity keeps running without pressing that same button until it shows its moveset screen.
Here's a chart on what I'm trying to point out on the multiplayer issue.
Here's an example of a keyscript for one particular character.
Example:
kuraaku.c:
Fake entity for holding keys:
Here's a (key)script for the movelist entity.
As for the movelist spawning in different animations based on the specified given player, here's an example.
How can I avoid the button conflict of multiple players from happening?
Here's a problem of what I'm facing. It's a multiplayer issue regarding the button conflict during pauses. For example, player A controls player 1 while player B controls player 2. Player A presses/holds A2 button first before player B does. Both of them have held that button on their controllers they're using until player 1's moveset pops up due to player A being the first to press. The problem is not holding the A2 button during the pause entity. The problem is when you let go off of that A2 button during the pause menu or text type entity. What happens when you release A2 during that pause before cancelling it with any button? That fake entity keeps running without pressing that same button until it shows its moveset screen.
Here's a chart on what I'm trying to point out on the multiplayer issue.
| Button Control Event | Player A | Player B | Note |
| Who presses/holds a specific button for showing movelist first? | Yes | No | Player A holds/presses A2 button first before player B |
| Who holds the button before their own character moveset shows up? | Yes | Yes | Both are holding A2 buttons for their movesets to show |
| While the first one shows moveset on screen, what would you do during the pause menu or text type entity playing? (alternative 1) | Cancel by pressing any button | Release A2 button | This results the fake entity to play by itself without controlling it after player B releases the button during the pause moment when player A cancels it |
| While the first one shows moveset on screen, what would you do during the pause menu or text type entity playing? (alternative 2) | Cancel by pressing any button | Hold A2 button before unpausing the game or player A cancels his own | Player B can continue holding A2 button for his character's own moveset to show |
Here's an example of a keyscript for one particular character.
Example:
kuraaku.c:
C:
#import "data/scripts/animation/default.c"
void main(){
if(openborvariant("in_level")){
int P1 = getplayerproperty(0, "ent");
int P2 = getplayerproperty(1, "ent");
int P3 = getplayerproperty(2, "ent");
int attack4 = playerkeys(0, 1, "attack4");
int attack42 = playerkeys(1, 1, "attack4");
int attack43 = playerkeys(2, 1, "attack4");
int movelist = getglobalvar("movelist");
int movelist2 = getglobalvar("movelist2");
int movelist3 = getglobalvar("movelist3");
void vSpawn;
clearspawnentry();
loadmodel("movelist");
setspawnentry("name", "movelist");
if(attack4){
if(movelist == NULL()){
setglobalvar("movelist", 1);
vSpawn = spawn004("movelist", "movelist", 0, 174, 0, 224, 0, 0, openborconstant("ANI_FOLLOW1), 0);
}else{
setglobalvar("movelist", NULL());
killentity(vSpawn);
}
}
if(attack42){
if(movelist2 == NULL()){
setglobalvar("movelist2", 1);
vSpawn = spawn004("movelist", "movelist", 0, 174, 0, 224, 0, 0, openborconstant("ANI_FOLLOW1"), 0);
}else{
setglobalvar("movelist2", NULL());
killentity(vSpawn);
}
}
if(attack43){
if(movelist3 == NULL()){
setglobalvar("movelist3", 1);
vSpawn = spawn004("movelist", "movelist", 0, 174, 0, 224, 0, 0, openborconstant("ANI_FOLLOW1"), 0);
}else{
setglobalvar("movelist3", NULL());
killentity(vSpawn);
}
}
}
}
Fake entity for holding keys:
Code:
name movelist
type none
load teriiport
load kuraakuport
animationscript data/scripts/lib001.c
script data/scripts/movelist.c
anim idle #Terry
delay 5
offset 1 1
@cmd keyint "ANI_IDLE" 0 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 1 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 2 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 3 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 4 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 5 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 6 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 7 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 8 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 9 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 10 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 11 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 12 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 13 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 14 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 15 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 16 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 17 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 18 "A3" 0 0
frame none
@cmd spawn06noDir "teriiport" 174 0 228
@cmd setglobalvar "movelist" NULL()
@cmd setglobalvar "movelist2" NULL()
@cmd setglobalvar "movelist3" NULL()
@cmd suicide
frame none
anim follow1 #Clark
delay 5
offset 1 1
@cmd keyint "ANI_IDLE" 0 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 1 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 2 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 3 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 4 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 5 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 6 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 7 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 8 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 9 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 10 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 11 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 12 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 13 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 14 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 15 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 16 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 17 "A3" 0 0
frame none
@cmd keyint "ANI_IDLE" 18 "A3" 0 0
frame none
@cmd spawn06noDir "kuraakuport" 174 0 228
@cmd setglobalvar "movelist" NULL()
@cmd setglobalvar "movelist2" NULL()
@cmd setglobalvar "movelist3" NULL()
@cmd suicide
frame none
Here's a (key)script for the movelist entity.
Code:
void main(){
void self = getlocalvar("self");
void parent = getentityproperty(self, "parent");
int P1 = getplayerproperty(0, "ent");
int P2 = getplayerproperty(1, "ent");
int P3 = getplayerproperty(2, "ent");
int attack4r; int attack4h;
int frame = getentityproperty(self, "animpos");
int movelist = getglobalvar("movelist");
int movelist2 = getglobalvar("movelist2");
int movelist3 = getglobalvar("movelist3");
if(frame >= 0 && frame < 19 && movelist == 1){
if(parent == P1){
attack4r = playerkeys(0, 2, "attack4");
attack4h = playerkeys(0, 0, "attack4");
if(attack4r){
setglobalvar("movelist", NULL());
killentity(self);
}
}
}
if(frame >= 0 && frame < 19 && movelist2 == 1){
if(parent == P2){
attack4r = playerkeys(1, 2, "attack4");
attack4h = playerkeys(1, 0, "attack4");
if(attack4r){
setglobalvar("movelist2", NULL());
killentity(self);
}
}
}
if(frame >= 0 && frame < 19 && movelist3 == 1){
if(parent == P3){
attack4r = playerkeys(2, 2, "attack4");
attack4h = playerkeys(2, 0, "attack4");
if(attack4r){
setglobalvar("movelist3", NULL());
killentity(self);
}
}
}
}
As for the movelist spawning in different animations based on the specified given player, here's an example.
Code:
name kuraakuport
health 1
type text
facing 1
setlayer 999999999
subject_to_hole 0
subject_to_obstacle 0
subject_to_platform 0
subject_to_gravity 0
animationscript data/scripts/animation/default.c
anim idle
loop 0
delay 2
offset 174 224
bbox 0 0 0 0
drawmethod alpha 6
drawmethod channel 0.10
frame data/sprites/portraits/axel-kof-rod.png
drawmethod channel 0.20
frame data/sprites/portraits/axel-kof-rod.png
drawmethod channel 0.30
frame data/sprites/portraits/axel-kof-rod.png
drawmethod channel 0.40
frame data/sprites/portraits/axel-kof-rod.png
drawmethod channel 0.50
frame data/sprites/portraits/axel-kof-rod.png
drawmethod channel 0.60
frame data/sprites/portraits/axel-kof-rod.png
drawmethod channel 0.70
frame data/sprites/portraits/axel-kof-rod.png
drawmethod channel 0.80
frame data/sprites/portraits/axel-kof-rod.png
drawmethod channel 0.90
frame data/sprites/portraits/axel-kof-rod.png
delay -1
drawmethod alpha 0
frame data/sprites/portraits/axel-kof-rod.png
@cmd suicide
frame data/chars/misc/empty.gif
Code:
name Clark
type player
speed 9
health 100
mp 100
gfxshadow 1
atchain 1 2 3 4 5
icon data/chars/heroes/clark/clark.png 1
keyscript data/scripts/keys/kuraaku.c
How can I avoid the button conflict of multiple players from happening?
Last edited: