maxman
Well-known member
I created an NPC type entity that serves as player's continue "substitute" to appear in the very last frame of player's death animation and one frame after it's killed/removed under a time-over animation. As for now, I'm only gonna show the one with player's time-over pose.
There are other issues that I couldn't get it right, but only one I succeeded. The one I succeeded is when a number of players do not exist where NPC is still there, he acts ready with a shout as you press start as player 1 and you return to select screen normally. However, this causes one issue as if a second player joins (player 1 is dead or removed) while the NPC is still there, the NPC shouts since one of the players starts to exist. Thus, two players start in the select screen. What I'm trying to do is to have P2 join in during the continue screen while eliminating P1 before P2 goes to the select screen alone. Also, while pressing start on the P2 side, I'm trying not to let NPC from dead P1 shout if P2 joins. I haven't added the continue-countdown text for P1 yet.
Another issue is the countdown trigger for NPC to die after it finishes. The problem I'm having with it is that NPC can't die after the countdown is over, as well as not reducing health points. I'm trying to deduct NPC's health points to 0, based on the countdown button trigger for skipping. You either skip it to the next frame or you wait for the next frame to start, so that its health point reduces 1 at a time. When it reaches to 0, the NPC starts to die with anim death.
Here's the one that plays a role in continue screen after player's death. (Yes, I know that script tags are not necessary, but I use them temporarily for testing purposes.)
Player's Time over:
Here's the countdown.
pastebin.com
contAnim.c:
keyall.c:
contkey.c:
EDIT: Do I need to use ondeathscript? I don't know how to create a death script. Is there any example of how to deal with it in players or any entity types?
There are other issues that I couldn't get it right, but only one I succeeded. The one I succeeded is when a number of players do not exist where NPC is still there, he acts ready with a shout as you press start as player 1 and you return to select screen normally. However, this causes one issue as if a second player joins (player 1 is dead or removed) while the NPC is still there, the NPC shouts since one of the players starts to exist. Thus, two players start in the select screen. What I'm trying to do is to have P2 join in during the continue screen while eliminating P1 before P2 goes to the select screen alone. Also, while pressing start on the P2 side, I'm trying not to let NPC from dead P1 shout if P2 joins. I haven't added the continue-countdown text for P1 yet.
Another issue is the countdown trigger for NPC to die after it finishes. The problem I'm having with it is that NPC can't die after the countdown is over, as well as not reducing health points. I'm trying to deduct NPC's health points to 0, based on the countdown button trigger for skipping. You either skip it to the next frame or you wait for the next frame to start, so that its health point reduces 1 at a time. When it reaches to 0, the NPC starts to die with anim death.
Here's the one that plays a role in continue screen after player's death. (Yes, I know that script tags are not necessary, but I use them temporarily for testing purposes.)
Code:
name Ryu_continue
type npc
health 9
speed 10
nomove 1
antigravity 100
death 1
nopain 1
setlayer 510000000
subject_to_minz 0
subject_to_maxz 0
subject_to_wall 0
subject_to_platform 0
subject_to_obstacle 0
diesound data/sounds/fighters/ryu/SND_PL00_0.wav
takedamagescript @script
void main(){
void self = getlocalvar("self");
int hp = getentityproperty(self, "health");
int skip = getglobalvar("MenuSelect");
if(skip == 1){
changeentityproperty(self, "health", hp-1);
}
}
@end_script
script @script
void main(){
void self = getlocalvar("self");
int PLAY = openborvariant("count_players");
int P1 = getplayerproperty(0, "entity");
int P2 = getplayerproperty(1, "entity");
int P1join = getplayerproperty(P1, "joining");
int P2join = getplayerproperty(P2, "joining");
if(PLAY == 1){
performattack(self, openborconstant("ANI_FOLLOW1"));
}
}
@end_script
onspawnscript @script
void main(){
void self = getlocalvar("self");
int xpos = openborvariant("xpos");
int ypos = openborvariant("ypos");
changeentityproperty(self, "position", xpos+91, ypos+182, NULL());
}
@end_script
anim spawn
delay 2
offset 28 97
frame data/CHARS/Ryu/0530000000.gif
frame data/CHARS/Ryu/0530000000.gif
anim idle #Groggy
loop 1
delay 30
offset 28 97
frame data/CHARS/Ryu/0530000000.gif
offset 28 96
frame data/CHARS/Ryu/0530000001.gif
offset 29 95
frame data/CHARS/Ryu/0530000002.gif
frame data/CHARS/Ryu/0530000003.gif
offset 29 97
frame data/CHARS/Ryu/0530000004.gif
offset 28 98
frame data/CHARS/Ryu/0530000005.gif
anim follow1 #Continue
#loop 1
delay 50
offset 25 99
sound data/sounds/ryu/shoryuken.wav
frame data/chars/ryu/0000000000.gif
@cmd killentity(getlocalvar("self"))
frame data/chars/ryu/0000000000.gif
anim death #Game over
delay 23
offset 31 94
frame data/CHARS/Ryu/0595000000.gif
delay 21
offset 26 68
frame data/CHARS/Ryu/0595000001.gif
offset 26 70
delay 65
frame data/CHARS/Ryu/0595000002.gif
delay 19
offset 31 65
frame data/CHARS/Ryu/0595000003.gif
delay 18
offset 40 58
frame data/CHARS/Ryu/0595000004.gif
delay 14
offset 46 58
frame data/CHARS/Ryu/0508000000.gif
offset 49 40
delay 595
frame data/chars/ryu/0504000010.gif
Player's Time over:
C:
anim follow15 #Time out
@script
void self = getlocalvar("self");
void Return = getglobalvar("Return");
void Current = openborvariant("current_branch");
int win1 = getglobalvar("win1");
int win2 = getglobalvar("win2");
int PLAY = openborvariant("count_players");
int P1 = getplayerproperty(0, "entity");
int P2 = getplayerproperty(1, "entity");
int set = openborvariant("current_set");
if(frame==5 && PLAY == 1 && set == 0){
if(win1 == 2 || win2 == 2){
void vSpawn; //Spawn object.
int XPos = openborvariant("xpos"); //Get screen edge's position
int YPos = openborvariant("ypos"); // Get camera position
int Screen = openborvariant("hResolution"); // Get screen width
void target = getentityproperty(self, "opponent");
void name = getentityproperty(target, "name");
clearspawnentry(); //Clear current spawn entry.
loadmodel("enemywin");
setspawnentry("name", "enemywin"); //Acquire spawn entity by name.
vSpawn = spawn(); //Spawn in entity.
if(name == "Ken"){
changeentityproperty(vSpawn, "position", 160 + XPos, 120);
changeentityproperty(vSpawn, "animation", openborconstant("ANI_FREESPECIAL"));
}else{
changeentityproperty(vSpawn, "position", 160 + XPos, 120);
}
setglobalvar("Wait", 1);
clearglobalvar();
} else {
jumptobranch(Current,1);
}
}
if(frame==5 && PLAY == 2 && set == 0){
if(win1 == 2 || win2 == 2){
void vSpawn; //Spawn object.
int XPos = openborvariant("xpos"); //Get screen edge's position
int YPos = openborvariant("ypos"); // Get camera position
int Screen = openborvariant("hResolution"); // Get screen width
clearspawnentry(); //Clear current spawn entry.
loadmodel("darkblue");
setspawnentry("name", "darkblue"); //Acquire spawn entity by name.
vSpawn = spawn(); //Spawn in entity.
changeentityproperty(vSpawn, "position", 160 + XPos, 246 + YPos);
changeentityproperty(vSpawn, "animation", openborconstant("ANI_FOLLOW4"));
setglobalvar("Wait", 1);
} else {
jumptobranch(Current,1);
}
}
// ANIM FOLLOW5 FOR SPAWNED MODEL NOT YET DONE
if(frame==5 && PLAY == 2 && set > 0){
if( win1 == 2 || win2 == 2 || (win1 == 2 && win2 == 2) ){
void vSpawn; //Spawn object.
int XPos = openborvariant("xpos"); //Get screen edge's position
int YPos = openborvariant("ypos"); // Get camera position
int Screen = openborvariant("hResolution"); // Get screen width
void target = getentityproperty(self, "opponent");
void name = getentityproperty(target, "name");
clearspawnentry(); //Clear current spawn entry.
loadmodel("darkblue");
setspawnentry("name", "darkblue"); //Acquire spawn entity by name.
vSpawn = spawn(); //Spawn in entity.
changeentityproperty(vSpawn, "position", 160 + XPos, 246 + YPos);
changeentityproperty(vSpawn, "animation", openborconstant("ANI_FOLLOW5"));
setglobalvar("Wait", 1);
clearglobalvar();
} else {
jumptobranch(Current,1);
}
}
@end_script
delay 9
offset 25 105
@cmd stop
custentity ryu_continue
spawnframe 6 0 200 0 0
frame data/chars/ryu/0017000000.gif #0- 9
offset 23 107
frame data/chars/ryu/0017000001.gif #1 - 18
frame data/chars/ryu/0017000002.gif #2 - 27
offset 23 108
frame data/chars/ryu/0017000003.gif #3 - 36
offset 23 109
delay 339
frame data/chars/ryu/0017000004.gif #4 - 365
delay 30
frame data/chars/ryu/0017000004.gif #5 - 425
delay 5
@cmd suicide
frame data/chars/ryu/0017000004.gif #6 - 430
#delay 250
frame data/chars/ryu/0017000004.gif
frame data/chars/ryu/0017000004.gif
Here's the countdown.
name CountDtype none#type textspeed 10subject_to_minz 0subject_to_maxz - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
contAnim.c:
C:
#include "data/scripts/scenefx.c"
void noplayerJoin (int iG)
{
// controls if other players can join the game or not
// 1 - players CAN NOT join, 0 play CAN join
// remember to set it 0 when you are done, or you will have a 1P only game.
// Douglas Baldan/O Ilusionista - 20/09/14
changeopenborvariant("nojoin", iG);
}
void noPJoin(int P, int iG){
void Player = getplayerproperty(P, "entity");
changeopenborvariant("nojoin", iG);
}
void Skip(int Frame){
void self = getlocalvar("self");
int skip = getglobalvar("MenuSelect"); // Look at contkey.c for key inputs
if(skip == 1){
updateframe(self, Frame);
}
}
void noCredits(){
void self = getlocalvar("self");
int P1 = getplayerproperty(0, "entity"); // This is IMPORTANT!!!
int P2 = getplayerproperty(1, "entity"); // This is IMPORTANT!!!
int P1Cred = getplayerproperty(P1, "credits");
int P2Cred = getplayerproperty(P2, "credits");
if(P1Cred < 1 || P2Cred < 1){
performattack(self, openborconstant("ANI_FOLLOW1"));
}
}
keyall.c:
C:
#import "data/scripts/dcancel.c"
#import "data/chars/misc/continueanim/contkey.c"
void main(){
daimaoKeyCancel();
continueKey();
}
contkey.c:
C:
void main(){
continueKey();
}
void continueKey()
{
int player = getlocalvar("player");
void self = getlocalvar("self");
void keySound = loadsample("data/sounds/common/beep4.wav");
int anybuttonH = playerkeys(player, 0, "anybutton"); // Hold any button key?
int anybutton = playerkeys(player, 1, "anybutton"); // Press any button key?
int anybuttonR = playerkeys(player, 2, "anybutton"); // Release any button key?
// Action/Movement event capture
if(anybutton){
setglobalvar("MenuSelect", 1); // Press?
}else if(anybuttonR){
setglobalvar("MenuSelect", 0); // Release?
}else if(anybuttonH){
setglobalvar("MenuSelect", 2); // Hold?
}
}
EDIT: Do I need to use ondeathscript? I don't know how to create a death script. Is there any example of how to deal with it in players or any entity types?
Last edited:
