Hey guys,
I have been trying to implement a morphing sequence using script, but I have been unsuccessful. The game crashes each time the morphing sequence starts.
As it is right now, when you start to morph the player calls in a new entity showing a closeup of the character calling on his or her dinosaur. Or Tigerzord/Dragonzord. The sequence is planned like this:
- Player assumes "morphin' time" pose
- Entity called "morphbolt" is called. This is the traditional MMPR bolt that is shown at the begining of the morphing sequence. At the end of "morphbolt"'s animation, it calls a new entity: "morphtommy".
- "morphtommy" (the closeup of tommy calling on his Tigerzord powers) first checks if either player 1 or 2 is using "white_ranger" as a character. If so, it will show its animation in its entirety. If not, it will not show Tommy yelling "Tigerzord" but rather go to the next entity in line...
- Which is tommy yelling Dragonzord. Again, it checks if the player is using "green_ranger" and if not, it jumps to the next ranger in line and so on until we cycle through all seven of them.
Right now the issue is with the entity "morphtommy", the first in the sequence to use script. The program crashes when it gets to it.
I am attacking the .txt of "morphtommy" and hopefully you guys will be able to pick up on the issue.
name morphtommy
type text
subtype noskip
antigravity 100
setlayer 500
shadow 0
Health 1
nolife 1
nomove 1 1
facing 1
load morphtommy_o
animationscript data/scripts/script.c
anim spawn
@script
void self = getlocalvar("self");
int P1 = getentityproperty(0, "model");
int P2 = getentityproperty(1, "model");
if(P1 == "white_ranger" || P2 == "white_ranger"){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW1"));
} else {
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW2"));
}
@end_script
offset 120 196
delay 4
frame data/chars/misc/morphs/kim/22f.gif
anim FOLLOW1
offset 120 196
delay 4
sound data/CHARS/blue_ranger/billycall.wav
frame data/chars/misc/morphs/tommy/01.png
frame data/chars/misc/morphs/tommy/02.png
frame data/chars/misc/morphs/tommy/03.png
frame data/chars/misc/morphs/tommy/04.png
frame data/chars/misc/morphs/tommy/05.png
frame data/chars/misc/morphs/tommy/06.png
frame data/chars/misc/morphs/tommy/07.png
frame data/chars/misc/morphs/tommy/08.png
frame data/chars/misc/morphs/tommy/09.png
frame data/chars/misc/morphs/tommy/10.png
frame data/chars/misc/morphs/tommy/11.png
frame data/chars/misc/morphs/tommy/12.png
frame data/chars/misc/morphs/tommy/13.png
frame data/chars/misc/morphs/tommy/14.png
frame data/chars/misc/morphs/tommy/15.png
frame data/chars/misc/morphs/tommy/16.png
frame data/chars/misc/morphs/tommy/17.png
frame data/chars/misc/morphs/tommy/18.png
frame data/chars/misc/morphs/tommy/19.png
frame data/chars/misc/morphs/tommy/20.png
frame data/chars/misc/morphs/tommy/21.png
frame data/chars/misc/morphs/tommy/22f.gif
frame data/chars/misc/morphs/tommy/23f.gif
frame data/chars/misc/morphs/tommy/24f.gif
@cmd spawn06 "morphtommy_o" 120 0 200
frame data/chars/misc/morphs/kim/22f.gif
anim FOLLOW2
offset 120 196
delay 1
@cmd spawn06 "morphtommy_o" 120 0 200
frame data/chars/misc/morphs/kim/22f.gif
This is what says on the log after the crash:
There's an exception while executing script 'animationscript' data/chars/misc/morphs/tommy/morphtommy.txt
Not terribly informative.
Just in case, this is the "morphtommy" segment of the scriptlog:
####animationscript function main#####
# data/chars/misc/morphs/tommy/morphtommy.txt
########################################
void main()
{
int frame = getlocalvar("frame");
int animhandle = getlocalvar("animhandle");
if(animhandle==50)
{
void self = getlocalvar("self");
int P1 = getentityproperty(0, "model");
int P2 = getentityproperty(1, "model");
if(P1 == "white_ranger" || P2 == "white_ranger"){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW1"));
} else {
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW2"));
}
return;
}
if(animhandle==51)
{
if(frame==24)
{
spawn06("morphtommy_o", 120, 0, 200);
}
return;
}
if(animhandle==52)
{
if(frame==0)
{
spawn06("morphtommy_o", 120, 0, 200);
}
return;
}
}
The entity previous to "morphtommy", "morphbolt", works fine so that's not the issue.
Ideas?