I really need someone to examine this script for me becasue i can't for the life of me figure out what's going wrong or how to fix it.
I've created a script that will allow my game characters to 'talk' to the player by spawning a 'gettable' actor (which is disguised as a blue key)
and having the script wait until the player 'picks up' the actor to spawn a lookalike dummy (which can't be piked up, and has a slightly smaller radius to ensure the object spawns) while the character says a little speech. After the speech is completed, the lookalike is removed and the origional gettable character is re-spawned to ensure the conversation can take place again.
After initially writing this script to work for one character (or multiple instinces of the same character) It worked fine so i decided to have the same script handle all 20 of my characters becasue i really didn't want to have 20 different scripts that basically did the same thing. Heres what the script looks like: (in all of its magnifigance and glory)
Code: Select all
#include "zcommon.acs"
#define ACTOR_VOCAL 255
#define CHANGE_SPEECH 254
world int 1: worm_speechnum;
world int 2: buny_speechnum;
world int 3: drft_speechnum;
world int 4: pond_speechnum;
world int 5: igho_speechnum;
world int 6: head_speechnum;
world int 7: wisp_speechnum;
world int 8: hp1_speechnum;
world int 9: hp2_speechnum;
world int 10: hp3_speechnum;
world int 11: hp4_speechnum;
world int 12: hp5_speechnum;
world int 13: kid1_speechnum;
world int 14: kid2_speechnum;
world int 15: kid3_speechnum;
world int 16: kid4_speechnum;
world int 17: kid5_speechnum;
world int 18: klng_speechnum;
world int 19: ksrt_speechnum;
world int 20: msrp_speechnum;
str world_id [20] = {
"worm_speechnum",
"buny_speechnum;",
"drft_speechnum;",
"pond_speechnum;",
"igho_speechnum;",
"head_speechnum;",
"wisp_speechnum;",
"hp1_speechnum;",
"hp2_speechnum;",
"hp3_speechnum;",
"hp4_speechnum;",
"hp5_speechnum;",
"kid1_speechnum;",
"kid2_speechnum;",
"kid3_speechnum;",
"kid4_speechnum;",
"kid5_speechnum;",
"klng_speechnum;",
"ksrt_speechnum;",
"msrp_speechnum;"};
// All the characters are defined here
// Reflectionworm is 1
str Creatures[40] = {
"GreenArmor",
"ReflectionWorm_Dummy",
"BlueArmor",
"ParanoidBunny_Dummy",
"HealthBonus",
"TheDrifter_Dummy",
"ArmorBonus",
"ThePonderer_Dummy",
"BlueCard",
"InsanityGhost_Dummy",
"RedCard",
"HeadGrower_Dummy",
"YellowCard",
"Wiseplant_Dummy",
"YellowSkull",
"HeadplantTenticle_Dummy",
"RedSkull",
"HeadplantSkull_Dummy",
"BlueSkull",
"HeadplantEyeguy_Dummy",
"Stimpack",
"HeadplantToothy_Dummy",
"Medkit",
"HeadplantFang_Dummy",
"Soulsphere",
"Child1_Dummy",
"InvulnerabilitySphere",
"Child2_Dummy",
"Berserk",
"Child3_Dummy",
"BlurSphere",
"Child4_Dummy",
"RadSuit",
"Child5_Dummy",
"Allmap",
"DazedChildLong_Dummy",
"Infrared",
"DazedChildShort_Dummy",
"Megasphere",
"MasterPlant_Dummy"
} ;
Script ACTOR_VOCAL (int defaultspeech, int thing, int place)
{
int x_tid, y_tid;
x_tid = place + 8000;
y_tid = place + 9000;
SpawnSpot(Creatures[thing-1], place, x_tid, 0);
delay (1); // Required, otherwise strange things happen.... -bg 2/28/04
while (thingcount (Creatures[thing-1], x_tid))
{delay (1); }
SpawnSpot(Creatures[thing], place, y_tid, 0);
if (!world_id[thing-1 /2])
{
ACS_Execute (world_id[thing-1 /2], 0);
ScriptWait(world_id[thing-1 /2]);
delay (1);
}
else
{
ACS_Execute (defaultspeech, 0);
ScriptWait(defaultspeech);
delay (1);
}
Thing_Remove(y_tid);
delay(1);
restart;
}
I don't know whats wrong, but then again this is the second major script i've ever written and i don't know jack about programming (as i am an art student). I tried writing these all as a switch (with the thing defining the case, whuch was all odd numbers) and the same thing still happened, with the exception of the first case, which worked fine (at least in one instance) The only way i know of to make the script behave correctly is to split it up into 20 different ones and have them individually manage and monitor my characters, but i thouight that would be a bit of overkill.
Can anybody help? I'll give you a screenshot.....