maxman
Well-known member
This one is mainly about player VS enemy in a single player mode. I have no problem with players winning first round and on, but I am having trouble with the player win only in the second round.
I tried using this one:
Even this one too:
Both of them don't retain their display of the win counts after the opponent loses in the second round, so only for the win count display on player's side. Each of their win count from both sides after third round starts to show.
Here's a script for the win count.
Also, I tried this one, but it's still okay, despite having the count disappear after the enemy opponent loses.
Player txt with anim death:
Enemy's anim death:
EDIT: Here are the steps: First round, opponent wins. Second round, player wins.
I tried using this one:
Code:
if(win1 == 1 && win2 == 1){
if(P1 && Opp1){ // Player 1
drawsprite(win, 142, 25, 500);
drawsprite(win, 174, 25, 500);
}else if(P2 && Opp2){ // Player 2
drawsprite(win, 174, 25, 500);
drawsprite(win, 142, 25, 500);
}
}
Even this one too:
Code:
if(win1 == 1 && win2 == 1){
if(P1){ // Player 1
drawsprite(win, 142, 25, 500);
}if(P2){ // Player 2
drawsprite(win, 174, 25, 500);
}
if(Opp1){
drawsprite(win, 174, 25, 500);
}if(Opp2){
drawsprite(win, 142, 25, 500);
}
}
Both of them don't retain their display of the win counts after the opponent loses in the second round, so only for the win count display on player's side. Each of their win count from both sides after third round starts to show.
Here's a script for the win count.
Code:
void main(){
void win = getglobalvar("win");
int P1 = getplayerproperty(0, "entity"); // Player 1
int P2 = getplayerproperty(1, "entity"); // Player 2
void Opp1 = findtarget(P1); // Player 1's opponent
void Opp2 = findtarget(P2); // Player 2's opponent
void win1 = getglobalvar("win1"); // Win point for Player type in single player mode; player 1 in dual mode
void win2 = getglobalvar("win2"); // Win point for Enemy type in single player mode; player 2 in dual mode
int PLAY = openborvariant("count_players");
if(!win){
win = loadsprite("data/chars/misc/win.png");
setglobalvar("win", win);
}
if(PLAY == 2){ // 2 players in dual mode
if(win1 == 1){
if(P1){ // Player 1
drawsprite(win, 1, 25, 500);
}
}
if(win1 == 2){
if(P1){ // Player 1
drawsprite(win, 13, 25, 500);
drawsprite(win, 1, 25, 500);
}
}
if(win2 == 1){
if(P2){ // Player 2
drawsprite(win, 309, 25, 500);
}
}
if(win2 == 2){
if(P2){ // Player 2
drawsprite(win, 309, 25, 500);
drawsprite(win, 297, 25, 500);
}
}
}
if(PLAY == 1){ // Single player only?
if(win1 == 1){ // Fighter 1's single victory?
if(P1){ // Player 1
drawsprite(win, 142, 25, 500);
}if(P2){ // Player 2
drawsprite(win, 174, 25, 500);
}
}if(win1 == 2){ // Fighter 1's double victory?
if(P1){ // Player 1
drawsprite(win, 127, 25, 500);
drawsprite(win, 142, 25, 500);
}if(P2){ // Player 2
drawsprite(win, 189, 25, 500);
drawsprite(win, 174, 25, 500);
}
}
if(win2 == 1){ // Fighter 2's single victory?
if(Opp1){
drawsprite(win, 174, 25, 500);
}if(Opp2){
drawsprite(win, 142, 25, 500);
}
}
if(win2 == 2){ // Fighter 2's double victory?
if(Opp1){
drawsprite(win, 189, 25, 500);
drawsprite(win, 174, 25, 500);
}if(Opp2){
drawsprite(win, 127, 25, 500);
drawsprite(win, 142, 25, 500);
}
}
if(win1 == 1 && win2 == 1){ // Player wins 1 and Enemy wins 1
if(P1 || Opp2){ // Player 1
drawsprite(win, 142, 25, 500);
drawsprite(win, 174, 25, 500);
}if(Opp1 || P2){ // Player 2
drawsprite(win, 174, 25, 500);
drawsprite(win, 142, 25, 500);
}
}
if(win1 == 2 && win2 == 1){ // Player wins 2 and Enemy wins 1
if(P1){ // Player 1
drawsprite(win, 127, 25, 500);
drawsprite(win, 142, 25, 500);
}if(Opp1){
drawsprite(win, 174, 25, 500);
}if(P2){ // Player 2
drawsprite(win, 189, 25, 500);
drawsprite(win, 174, 25, 500);
}if(Opp2){
drawsprite(win, 142, 25, 500);
}
}
if(win1 == 1 && win2 == 2){ // Player wins 1 but Enemy wins 2
if(P1){ // Player 1
drawsprite(win, 142, 25, 500);
}if(Opp1){
drawsprite(win, 174, 25, 500);
drawsprite(win, 189, 25, 500);
}if(P2){ // Player 2
drawsprite(win, 174, 25, 500);
}if(Opp2){
drawsprite(win, 142, 25, 500);
drawsprite(win, 127, 25, 500);
}
}
}
}
/*
void ondestroy(){
void win = getglobalvar("win");
if(win) {
free(win);
setglobalvar("win", NULL());
}
}
void oncreate(){
void win = loadsprite("data/chars/misc/win.png");
setglobalvar("win", win);
}*/
Also, I tried this one, but it's still okay, despite having the count disappear after the enemy opponent loses.
Code:
if(win1 == 1 && win2 == 1){ // Player wins 1 and Enemy wins 1
if(P1 || Opp2){ // Player 1 or Opponent of Player 2
drawsprite(win, 142, 25, 500);
drawsprite(win, 174, 25, 500);
}if(Opp1 || P2){ // Player 2 or Opponent of Player 1
drawsprite(win, 174, 25, 500);
drawsprite(win, 142, 25, 500);
}
}
Code:
name RefPlays
type none
animationscript data/scripts/wasitS.c
ondrawscript data/scripts/playerwin.c
anim spawn
@script
if(frame==1 && openborvariant("count_players")==1){ // Player vs enemy
void P1 = getplayerproperty(0, "entity");
void P2 = getplayerproperty(1, "entity");
if(P1){
setglobalvar("F1", P1);
} else if(P2){
setglobalvar("F2", P2);
}
}
if(frame>=1 && openborvariant("count_players")==2){ // Player vs player
void P1 = getplayerproperty(0, "entity");
void P2 = getplayerproperty(1, "entity");
if(P1 && P2){
void self = getlocalvar("self");
setglobalvar("F1", P1);
setglobalvar("F2", P2);
changeentityproperty(P2, "direction", 0);
setidle(self, openborconstant("ANI_IDLE"));
}
}
@end_script
delay 2
offset 1 1
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
anim idle
@script
if(frame==1){
void self = getlocalvar("self");
int Habis = Desid();
if(Habis==1){
performattack(self, openborconstant("ANI_FOLLOW1"));
}
}
@end_script
loop 1
delay 2
offset 1 1
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
anim follow1
@script
if(frame == 0){
void P1 = getplayerproperty(0, "entity"); // Calling player 1
void P2 = getplayerproperty(1, "entity"); // Calling player 2
void EnemP1 = findtarget(P1); // Player 1's specific enemy
void EnemP2 = findtarget(P2); // Player 2's specific enemy
void self = getlocalvar("self");
void Model = getentityproperty(self, "model");
int CountP = openborvariant("count_players");
void P1name = getentityproperty(P1, "name");
void P2name = getentityproperty(P2, "name");
void EnemP1name = getentityproperty(EnemP1, "name");
void EnemP2name = getentityproperty(EnemP2, "name");
if(Model == "timer"){
performattack(Model, openborconstant("ANI_FOLLOW1"));
}
if(P1){ // Player 1?
changeentityproperty(P1, "noaicontrol", 1); // Stop moving
}
if(P2){
changeentityproperty(P2, "noaicontrol", 1); // Stop moving
}
if(EnemP1){ // Enemy of player 1?
changeentityproperty(EnemP1, "noaicontrol", 1);
}
if(EnemP2){
changeentityproperty(EnemP2, "noaicontrol", 1);
}
if(CountP == 1){
changelevelproperty("scrollspeed", 0);
}
}
if(frame==1){
void Lead = LeaderFind();
int PLAY = openborvariant("count_players");
if(PLAY == 2){
void P1 = getplayerproperty(0, "entity"); // Calling player 1
void P2 = getplayerproperty(1, "entity"); // Calling player 2
void P1name = getentityproperty(P1, "name");
void P2name = getentityproperty(P2, "name");
if(P1){
ShowTeks(+P1name+"_wins", 0, 1, 160, 100, 0); // ShowTeks(Text, Index, Font, x, y, z);
}
if(P2){
ShowTeks(+P2name+"_wins", 0, 0, 160, 100, 0);
}
}
changeentityproperty(Lead, "velocity", 0, 0, 0);
performattack(Lead, openborconstant("ANI_FOLLOW61"));
}
@end_script
delay 150
offset 1 1
@cmd setindexedvar "fightStarted" 0
frame data/chars/misc/empty.gif
delay 300
frame data/chars/misc/empty.gif
delay 10
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
Player txt with anim death:
Code:
anim death
@script
void self = getlocalvar("self");
void Return = getglobalvar("Return");
void Current = openborvariant("current_branch");
int win1 = getglobalvar("win1");
int win2 = getglobalvar("win2");
int COUNTPLAY = openborvariant("count_players");
int P1 = getplayerproperty(0, "entity");
int P2 = getplayerproperty(1, "entity");
int set = openborvariant("current_set");
if(frame==6 && COUNTPLAY == 1){
if(win2 == NULL()){
setglobalvar("win2", 1);
}
if(win2 == 1){
setglobalvar("win2", 2);
}
}
if(frame==8 && COUNTPLAY == 1 && set == 0){
if(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);
} else {
jumptobranch(Current,1);
//setglobalvar("Return", NULL());
}
}
if(frame==8 && COUNTPLAY == 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 {
//setglobalvar("Return", Current);
jumptobranch(Current,1);
}
}
// ANIM FOLLOW5 FOR SPAWNED MODEL NOT YET DONE
if(frame==8 && COUNTPLAY == 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
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"));
//jumptobranch("VS_Select", 1);
setglobalvar("Wait", 1);
clearglobalvar();
} else {
jumptobranch(Current,1);
}
}
@end_script
offset 49 40
delay 15
sound data/sounds/fall.wav
frame data/chars/ryu/0504000010.gif # 0 15
delay 250
frame data/chars/ryu/0504000010.gif # 1 265
delay 10
frame data/chars/ryu/0504000010.gif # 2 275
frame data/chars/ryu/0504000010.gif # 3 285
frame data/chars/ryu/0504000010.gif # 4 295
frame data/chars/ryu/0504000010.gif # 5 305
frame data/chars/ryu/0504000010.gif # 6 315
delay 50
frame data/chars/ryu/0504000010.gif # 7 365
frame data/chars/ryu/0504000010.gif # 8 415
frame data/chars/ryu/0504000010.gif # 9 465
Enemy's anim death:
Code:
anim death
@script
void self = getlocalvar("self");
int win1 = getglobalvar("win1");
int win2 = getglobalvar("win2");
int PLAY = openborvariant("count_players");
void Current = openborvariant("current_branch");
if(frame==6){
if(win1 == NULL()){
setglobalvar("win1", 1);
}
if(win1 == 1){
setglobalvar("win1", 2);
}
}
if(frame==8){
if(win1 == 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 = findtarget(self); // Calling target.
void name = getentityproperty(target, "name"); // Calling target's name.
clearspawnentry(); //Clear current spawn entry.
loadmodel("victory");
setspawnentry("name", "victory"); //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{ // Defaultly switch to Ryu?
changeentityproperty(vSpawn, "position", 160 + XPos, 120);
}
changeentityproperty(vSpawn, "position", 160 + XPos, 120);
//setglobalvar("Wait", 1);
clearglobalvar();
} else {
jumptobranch(Current,1);
}
}
@end_script
offset 49 40
delay 30
frame data/chars/ryu/0504000010.gif # 0
delay 40
frame data/chars/ryu/0504000010.gif # 1
@cmd spawnAni "WinLose" 160 120 240 "ANI_FOLLOW1" #"You Win" for players / Opponent's loss
#delay 15
frame data/chars/ryu/0504000010.gif # 2
frame data/chars/ryu/0504000010.gif # 3
frame data/chars/ryu/0504000010.gif # 4
frame data/chars/ryu/0504000010.gif # 5
frame data/chars/ryu/0504000010.gif # 6
delay 40
frame data/chars/ryu/0504000010.gif # 7
delay 2000
frame data/chars/ryu/0504000010.gif # 8
EDIT: Here are the steps: First round, opponent wins. Second round, player wins.
Last edited: