I'm back for more sagely council. I'm starting to play with switches, and am having some problems. I'm trying to use each case to generate a randomly determined encounter (an gladitorial arena battle, specifically.)
I'll post the script, but each random case currently identical. Ignore that. I just haven't gotten far enough into making the various encounters yet.
Not only does this not compile, but NOTHING happens when it runs. I don't understand.
Here's the script...
#include "nw_i0_2q4luskan"
void main()
{
if (GetLocalInt(OBJECT_SELF, "Spectate Colosseum Go")== 0)
return;
if (GetLocalInt(OBJECT_SELF, "Gladiators In Game")!= 0)
return;
object oTarget;
oTarget = GetObjectByTag("NorthGameEntrance");
SetLocked(oTarget, FALSE);
AssignCommand(oTarget, ActionOpenDoor(oTarget));
oTarget = GetObjectByTag("SouthGameEntrance");
SetLocked(oTarget, FALSE);
AssignCommand(oTarget, ActionOpenDoor(oTarget));
switch( Random( 4 ))
{ case 0: SetLocalInt(OBJECT_SELF, "Gladiators In Game", 4);
location lTarget;
oTarget = GetWaypointByTag("NorthColosseumSpawn");
lTarget = GetLocation(oTarget);
CreateObject(OBJECT_TYPE_CREATURE, "carpathian", lTarget);
DelayCommand(2.0, CreateObjectVoid(OBJECT_TYPE_CREATURE, "carpathian", lTarget));
oTarget = GetWaypointByTag("SouthColosseumSpawn");
lTarget = GetLocation(oTarget);
CreateObject(OBJECT_TYPE_CREATURE, "sacrentian", lTarget);
DelayCommand(2.0, CreateObjectVoid(OBJECT_TYPE_CREATURE, "sacrentian", lTarget));
break;
case 1: SetLocalInt(OBJECT_SELF, "Gladiators In Game", 4);
location lTarget;
oTarget = GetWaypointByTag("NorthColosseumSpawn");
lTarget = GetLocation(oTarget);
CreateObject(OBJECT_TYPE_CREATURE, "carpathian", lTarget);
DelayCommand(2.0, CreateObjectVoid(OBJECT_TYPE_CREATURE, "carpathian", lTarget));
oTarget = GetWaypointByTag("SouthColosseumSpawn");
lTarget = GetLocation(oTarget);
CreateObject(OBJECT_TYPE_CREATURE, "Sacrentian", lTarget);
DelayCommand(2.0, CreateObjectVoid(OBJECT_TYPE_CREATURE, "sacrentian", lTarget));
break;
case 2: SetLocalInt(OBJECT_SELF, "Gladiators In Game", 4);
location lTarget;
oTarget = GetWaypointByTag("NorthColosseumSpawn");
lTarget = GetLocation(oTarget);
CreateObject(OBJECT_TYPE_CREATURE, "carpathian", lTarget);
DelayCommand(2.0, CreateObjectVoid(OBJECT_TYPE_CREATURE, "carpathian", lTarget));
oTarget = GetWaypointByTag("SouthColosseumSpawn");
lTarget = GetLocation(oTarget);
CreateObject(OBJECT_TYPE_CREATURE, "Sacrentian", lTarget);
DelayCommand(2.0, CreateObjectVoid(OBJECT_TYPE_CREATURE, "sacrentian", lTarget));
break;
case 3: SetLocalInt(OBJECT_SELF, "Gladiators In Game", 4);
location lTarget;
oTarget = GetWaypointByTag("NorthColosseumSpawn");
lTarget = GetLocation(oTarget);
CreateObject(OBJECT_TYPE_CREATURE, "carpathian", lTarget);
DelayCommand(2.0, CreateObjectVoid(OBJECT_TYPE_CREATURE, "carpathian", lTarget));
oTarget = GetWaypointByTag("SouthColosseumSpawn");
lTarget = GetLocation(oTarget);
CreateObject(OBJECT_TYPE_CREATURE, "Sacrentian", lTarget);
DelayCommand(2.0, CreateObjectVoid(OBJECT_TYPE_CREATURE, "sacrentian", lTarget));
break;
}
}
Switches making me twitch.
Débuté par
One Thousand Talons Mao Ra
, nov. 09 2010 11:06
#1
Posté 09 novembre 2010 - 11:06
#2
Posté 09 novembre 2010 - 11:23
#include "nw_i0_2q4luskan"
void main()
{
if (GetLocalInt(OBJECT_SELF, "Spectate Colosseum Go")== 0)
return;
if (GetLocalInt(OBJECT_SELF, "Gladiators In Game")!= 0)
return;
object oTarget;
location lTarget;
oTarget = GetObjectByTag("NorthGameEntrance");
SetLocked(oTarget, FALSE);
AssignCommand(oTarget, ActionOpenDoor(oTarget));
oTarget = GetObjectByTag("SouthGameEntrance");
SetLocked(oTarget, FALSE);
AssignCommand(oTarget, ActionOpenDoor(oTarget));
switch( Random( 4 ))
{ case 0: SetLocalInt(OBJECT_SELF, "Gladiators In Game", 4);
//location lTarget;
oTarget = GetWaypointByTag("NorthColosseumSpawn");
lTarget = GetLocation(oTarget);
CreateObject(OBJECT_TYPE_CREATURE, "carpathian", lTarget);
DelayCommand(2.0, CreateObjectVoid(OBJECT_TYPE_CREATURE, "carpathian", lTarget));
oTarget = GetWaypointByTag("SouthColosseumSpawn");
lTarget = GetLocation(oTarget);
CreateObject(OBJECT_TYPE_CREATURE, "sacrentian", lTarget);
DelayCommand(2.0, CreateObjectVoid(OBJECT_TYPE_CREATURE, "sacrentian", lTarget));
break;
case 1: SetLocalInt(OBJECT_SELF, "Gladiators In Game", 4);
//location lTarget;
oTarget = GetWaypointByTag("NorthColosseumSpawn");
lTarget = GetLocation(oTarget);
CreateObject(OBJECT_TYPE_CREATURE, "carpathian", lTarget);
DelayCommand(2.0, CreateObjectVoid(OBJECT_TYPE_CREATURE, "carpathian", lTarget));
oTarget = GetWaypointByTag("SouthColosseumSpawn");
lTarget = GetLocation(oTarget);
CreateObject(OBJECT_TYPE_CREATURE, "Sacrentian", lTarget);
DelayCommand(2.0, CreateObjectVoid(OBJECT_TYPE_CREATURE, "sacrentian", lTarget));
break;
case 2: SetLocalInt(OBJECT_SELF, "Gladiators In Game", 4);
//location lTarget;
oTarget = GetWaypointByTag("NorthColosseumSpawn");
lTarget = GetLocation(oTarget);
CreateObject(OBJECT_TYPE_CREATURE, "carpathian", lTarget);
DelayCommand(2.0, CreateObjectVoid(OBJECT_TYPE_CREATURE, "carpathian", lTarget));
oTarget = GetWaypointByTag("SouthColosseumSpawn");
lTarget = GetLocation(oTarget);
CreateObject(OBJECT_TYPE_CREATURE, "Sacrentian", lTarget);
DelayCommand(2.0, CreateObjectVoid(OBJECT_TYPE_CREATURE, "sacrentian", lTarget));
break;
case 3: SetLocalInt(OBJECT_SELF, "Gladiators In Game", 4);
//location lTarget;
oTarget = GetWaypointByTag("NorthColosseumSpawn");
lTarget = GetLocation(oTarget);
CreateObject(OBJECT_TYPE_CREATURE, "carpathian", lTarget);
DelayCommand(2.0, CreateObjectVoid(OBJECT_TYPE_CREATURE, "carpathian", lTarget));
oTarget = GetWaypointByTag("SouthColosseumSpawn");
lTarget = GetLocation(oTarget);
CreateObject(OBJECT_TYPE_CREATURE, "Sacrentian", lTarget);
DelayCommand(2.0, CreateObjectVoid(OBJECT_TYPE_CREATURE, "sacrentian", lTarget));
break;
}
}
Modifié par Lightfoot8, 09 novembre 2010 - 11:25 .
#3
Posté 09 novembre 2010 - 05:40
Just to clarify, the problem that lightfoot is suggesting you fix is that you're attempting to declare a variable in a case - something the bioware compiler doesn't allow. You can get around this restriction by either declaring everything up top, as his fix has you doing, or by putting brackets around any case you want to declare in.
Funky
Funky
#4
Posté 09 novembre 2010 - 07:42
Here is a link that better discribes the problem you are having with the switch/case.
http://social.biowar...5019199#5026795
http://social.biowar...5019199#5026795
#5
Posté 09 novembre 2010 - 07:50
Ahhh. Simple enough. I would have never figured that out! Excellent. Thank you. =D





Retour en haut






