I have scripted a lengthy cutscene/series of battles. I'll give a basic rundown of what I want to happen, and then the problems I've discovered.
The player enters an area, several npcs (ie copies of the same npc reference) move to the player and trigger a battle. After the battle, the npcs are removed, a new set spawn at an entryway, move in and repeat.
The problem I am having is when it comes to NPC references. Basically, I use one NPC multiple times. I have set variables for each copy of the NPC so that I can easily manipulate them for movement. What I'm guessing happens, however, is that when I use destroy npc to delete some of them, and create npc to create the next "wave" , that the NPC references aren't being reset and are instead assigning new id numbers to the NPCs being created. Does that make sense?
Here is the script (warning, huge):
Code: Select all
plotscript, ghulfight, begin
#these variables are to make moving the NPCs easier
variable (ghul1, ghul2, ghul3, ghul4, ghul5, ghul6, ghul7, ghul8, ogre, talid1, talid2, talid3, talid4, zosimus, i)
ghul1 := NPC reference(3,0)
ghul2 := NPC reference(3,1)
ghul3 := NPC reference(3,2)
ghul4 := NPC reference(3,3)
ghul5 := NPC reference(3,4)
ghul6 := NPC reference(3,5)
ghul7 := NPC reference(3,6)
ghul8 := NPC reference(3,7)
ogre := NPC reference (6,0)
talid1 := NPC reference (7,0)
talid2 := NPC reference (7,1)
talid3 := NPC reference (7,2)
talid4 := NPC reference (7,3)
zosimus := NPC reference (8,0)
#DON'T WORRY ABOUT THIS STUFF, WORKS FINE
suspend player
show text box (452)
wait for text box
walk hero to x ( me, 8 )
wait for hero
walk hero (me, up, 4)
wait for hero
suspend caterpillar
walk hero (find hero (hero:Lint), right, 1)
wait for hero (find hero (hero:Lint))
walk hero (find hero (hero:Lint), up, 1)
wait for hero (find hero (hero:Lint))
focus camera ( 8, 15, 2 )
show text box (453)
wait for text box
#moving the ghuls into combat - AGAIN, THIS WORKS FINE SO FAR, AS GHULS1-4 ARE ALREADY PRESENT ON THE MAP
walk npc (ghul1, down, 2)
walk npc (ghul2, down, 2)
walk npc (ghul3, down, 7)
walk npc (ghul4, down, 7)
wait for npc (ghul1)
wait for npc (ghul2)
walk npc (ghul1, left, 1)
walk npc (ghul2, right, 1)
wait for npc (ghul1)
wait for npc (ghul2)
walk npc (ghul1, down, 3)
walk npc (ghul2, down, 3)
wait for npc (ghul1)
wait for npc (ghul2)
wait for npc (ghul3)
wait for npc (ghul4)
walk npc (ghul1, right, 1)
walk npc (ghul2, left, 1)
walk npc (ghul3, right, 3)
walk npc (ghul4, left, 3)
wait for npc (ghul1)
wait for npc (ghul2)
set npc direction (ghul1, down)
set npc direction (ghul2, down)
wait for npc (ghul3)
wait for npc (ghul4)
set npc direction (ghul3, up)
set npc direction (ghul4, up)
#screen fades out so npcs can be removed smoothly & zoticus npc created, battle is fought - EVERYTHING WORKING OK SO FAR
fade screen out
camera follows hero
set tag ( tag: ath_frontgate_MAIN, 1)
destroy NPC (ghul1)
destroy NPC (ghul2)
destroy NPC (ghul3)
destroy NPC (ghul4)
create NPC (5,8,27,up)
fight formation (24)
fade screen in
#zoticus (NPC 5) approaches the player, heroes move to gate, next wave of ghuls attack - HERE IS WHERE THE TROUBLES START.
walk npc (5, up, 7)
wait for npc (5)
set hero direction (me, down)
set hero direction (find hero (hero:Lint), down)
wait (8)
show text box (455)
walk hero (me, up, 1)
walk hero (find hero (hero:Lint), up, 1)
wait for hero (me)
wait for hero (find hero (hero:Lint))
walk hero (me, left, 1)
walk hero (find hero (hero:Lint), right, 1)
wait for hero (me)
wait for hero (find hero (hero:Lint))
walk npc (zoticus, up, 2)
walk hero (me, up, 3)
walk hero (find hero (hero:Lint), up, 3)
wait for hero (me)
wait for hero (find hero (hero:Lint))
walk hero (me, right, 1)
walk hero (find hero (hero:Lint), left, 1)
walk npc (zoticus, left, 1)
wait for hero (me)
wait for hero (find hero (hero:Lint))
walk hero (me, up, 1)
walk hero (find hero (hero:Lint), up, 1)
walk npc (zoticus, up, 3)
wait for npc (zoticus)
walk npc (zoticus, right, 1)
wait for npc (zoticus)
set npc direction (zoticus, down)
wait (8)
show text box (456)
wait for text box
create npc (3, 8, 11)
create npc (3, 9, 11)
walk npc (ghul1, down, 1)
walk npc (ghul2, down, 1)
wait for npc (ghul1)
wait for npc (ghul2)
create npc (3, 8, 11)
create npc (3, 9, 11)
walk npc (ghul1, down, 1)
walk npc (ghul2, down, 1)
wait for npc (ghul1)
wait for npc (ghul2)
walk npc (ghul3, down, 1)
walk npc (ghul4, down, 1)
walk npc (ghul1, left, 1)
walk npc (ghul2, right, 1)
wait for npc (ghul1)
wait for npc (ghul2)
wait for npc (ghul3)
wait for npc (ghul4)
walk npc (ghul3, down, 1)
walk npc (ghul4, down, 1)
set npc direction (ghul1, down)
set npc direction (ghul2, down)
wait for npc (ghul3)
wait for npc (ghul4)
wait (8)
fight formation (25)
#another text box, another wave
create npc (3, 8, 11)
create npc (3, 9, 11)
walk npc (ghul5, down, 1)
walk npc (ghul6, down, 1)
wait for npc (ghul5)
wait for npc (ghul6)
create npc (3, 8, 11)
create npc (3, 9, 11)
wait (8)
show text box (458)
wait for text box
fade screen out
fight formation (26)
#wipe middle ghuls, spawn ogre, walk ogre, ZOSIMUS arrives
destroy npc (ghul8)
destroy npc (ghul7)
destroy npc (ghul6)
destroy npc (ghul5)
destroy npc (ghul4)
destroy npc (ghul3)
fade screen in
show text box (460)
wait for text box
fade screen out
create npc (6, 9, 11)
wait (1)
fade screen in
wait (8)
walk npc (ogre, down, 1)
wait for npc (ogre)
walk hero (me, down, 1)
set hero direction (me, up)
walk hero (find hero (hero:Lint), down, 1)
set hero direction (find hero (hero:Lint), up)
wait for hero (me)
wait for hero (find hero (hero:Lint))
fade screen out (32, 0, 50)
create npc (7, 7, 22)
create npc (7, 7, 23)
create npc (7, 7, 24)
create npc (7, 7, 25)
create npc (8, 10, 15)
wait (1)
fade screen in
show text box (462)
wait for text box
#talid are created, run to position - final battle with ogre - I'M GUESSING I'M GOING TO HAVE ISSUES WITH THE "TALID" NPCS SIMILAR TO THE GHULS
walk npc (talid1, up, 2)
walk npc (talid2, up, 2)
walk npc (talid3, up, 2)
walk npc (talid4, up, 2)
wait for npc (talid1)
walk npc (talid1, left, 1)
walk npc (talid4, right, 1)
wait for npc (talid1)
walk npc (talid1, left, 1)
walk npc (talid2, left, 1)
walk npc (talid3, right, 1)
walk npc (talid4, right, 1)
wait for npc (talid1)
walk npc (talid1, up, 1)
walk npc (talid4, up, 1)
wait for npc (talid1)
walk npc (talid2, left, 1)
walk npc (talid3, right, 1)
wait for npc (talid2)
walk npc (talid1, up, 6)
walk npc (talid2, up, 6)
walk npc (talid3, up, 6)
walk npc (talid4, up, 6)
wait for npc (talid1)
walk npc (talid1, right, 1)
walk npc (talid4, left, 1)
wait for npc (talid1)
walk npc (talid2, up, 1)
walk npc (talid3, up, 1)
wait for npc (talid2)
set npc direction (talid2, right)
set npc direction (talid3, left)
wait (2)
fade screen out
fight formation (27)
destroy npc (ghul2)
destroy npc (ghul1)
destroy npc (ogre)
wait (1)
fade screen in
for(i,1,32,1),do,(
pan camera(random(0,3),1,random(1,5))
wait(1)
)
camera follows hero
fade screen out (63, 63, 63)
set tag ( tag: ath_frontgate_MAIN, 0)
teleport to map (19, 8, 15)
resume player
resume caterpillar
fade screen in
end
Many kind regards and thanks for your time.
-Guo