Hey guys ive got this script with text function working and choosing fighting or talking with left/right but its not what i want in the end , i mean i want it to be super compact and use just one animation for entire negotiation so i can just switch to other animation for other negotiations instead of using new txt files for each, now i had to split this into a couple of animations because i was getting infinite loop issue if i pressed let/right quickly a couple of times and engine crashed.Now it does not crash how i set it up.
Any clue how to do it in one animation ? Theres 3 or 4 options, one is highlighted "fight" , other one is highlighted "talk" and last two are confirmations of the ones above that are activated with attack button.So ideally it would use 4 frames of animation, maybe five because first frame would be sound of menu appearing.
I tried updateframe and one animation but im getting infinite loop, also with "delay -1" detecting keys pressed does not work, delay has to be quite low, 10 or 20.
Its a quick test to try if it works, it does work but i dont want to make new entity for every conversation/negotiation onscreen.
Any clue how to do it in one animation ? Theres 3 or 4 options, one is highlighted "fight" , other one is highlighted "talk" and last two are confirmations of the ones above that are activated with attack button.So ideally it would use 4 frames of animation, maybe five because first frame would be sound of menu appearing.
I tried updateframe and one animation but im getting infinite loop, also with "delay -1" detecting keys pressed does not work, delay has to be quite low, 10 or 20.
Its a quick test to try if it works, it does work but i dont want to make new entity for every conversation/negotiation onscreen.
Code:
name dial
type text
subject_to_minz 0
subject_to_maxz 0
subject_to_wall 0
subject_to_hole 0
anim idle
loop 1 2
delay 5
@script
void self = getlocalvar("self");
int iPIndex = getentityproperty(self,"playerindex"); //Get player index
void p2 = playerkeys(iPIndex, 0, "moveleft");
void at = playerkeys(iPIndex, 0, "attack");
if ( frame > 1 && p2 ){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW1"));
}
if (frame > 1 && at){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW3"));
}
@end_script
OFFSET 1 1
SOUND DATA/sounds/LASER2.wav
frame NONE
frame NONE
@cmd settextobj 1 420 300 0 -1 "MAKE_A_CHOICE_! " openborvariant("elapsed_time")+150
@cmd settextobj 2 700 400 1 -1 "FIGHT_! " openborvariant("elapsed_time")+150
@cmd settextobj 3 200 400 0 -1 "TALK_! " openborvariant("elapsed_time")+150
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
anim follow1
loop 1 2
delay 5
@script
void self = getlocalvar("self");
int iPIndex = getentityproperty(self,"playerindex"); //Get player index
void p1 = playerkeys(iPIndex, 0, "moveright");
void at = playerkeys(iPIndex, 0, "attack");
if (frame > 1 && p1){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW2"));
}
if (frame > 1 && at){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW3"));
}
@end_script
OFFSET 1 1
SOUND DATA/sounds/beep.wav
frame NONE
frame NONE
@cmd settextobj 1 420 300 0 -1 "MAKE_A_CHOICE_! " openborvariant("elapsed_time")+150
@cmd settextobj 2 700 400 0 -1 "FIGHT_! " openborvariant("elapsed_time")+150
@cmd settextobj 3 200 400 1 -1 "TALK_! " openborvariant("elapsed_time")+150
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
anim FOLLOW2
loop 1 2
delay 5
@script
void self = getlocalvar("self");
int iPIndex = getentityproperty(self,"playerindex"); //Get player index
void p2 = playerkeys(iPIndex, 0, "moveleft");
void at = playerkeys(iPIndex, 0, "attack");
if (frame > 1 && p2){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW1"));
}
if (frame > 1 && at){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW3"));
}
@end_script
OFFSET 1 1
SOUND DATA/sounds/beep.wav
frame NONE
frame NONE
@cmd settextobj 1 420 300 0 -1 "MAKE_A_CHOICE_! " openborvariant("elapsed_time")+150
@cmd settextobj 2 700 400 1 -1 "FIGHT_! " openborvariant("elapsed_time")+150
@cmd settextobj 3 200 400 0 -1 "TALK_! " openborvariant("elapsed_time")+150
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
frame NONE
anim FOLLOW3
loop 0
delay 100
OFFSET 1 1
SOUND DATA/sounds/beep2.wav
@cmd settextobj 1 440 300 3 -1 "SUCCESS_! " openborvariant("elapsed_time")+250
@cmd settextobj 2 420 400 3 -1 "_ " openborvariant("elapsed_time")+250
@cmd settextobj 3 420 500 3 -1 "_ " openborvariant("elapsed_time")+250
frame NONE
frame NONE