Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

A problem with a script

Page: 1 of 1
 DarthStoney
04-16-2010, 2:47 PM
#1
I'm having an issue with an on-enter script ,the first part(controlled by the global QGM_Arena_Type ==1) runs correctly but when it's set to 2 it just loads the new module without firing the convo. Originally this was part of another larger script(created by Glovemaster) and the convo fired properly but it had other issues with the global at 1.

void main() {
object oEntering = GetEnteringObject();
if (oEntering == GetFirstPC()) {
if ((GetGlobalNumber("QGM_ARENA_TYPE") == 1)) {
location location7 = Location(GetPosition(GetObjectByTag("BossSpawn", 0)), 90.0);
string string3;
if ((GetGlobalNumber("QGM_ARENA_BOSS") == 0)) {
object object25 = CreateObject(1, "qgm_firstboss", location7, 1);
AssignCommand(GetFirstPC(), SetFacingPoint(GetPosition(object25)));
AssignCommand(object25, SetFacingPoint(GetPosition(GetFirstPC())));
AssignCommand(GetFirstPC(), ActionStartConversation(GetFirstPC(), "qgm_arena_start", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));
DelayCommand(3.0, ChangeToStandardFaction(object25, 1));
DelayCommand(3.0, ExecuteScript("k_ai_master", object25, 1003));
}
else {
if ((GetGlobalNumber("QGM_ARENA_BOSS") == 1)) {
object object25 = CreateObject(1, "qgm_secondboss", location7, 1);
AssignCommand(GetFirstPC(), SetFacingPoint(GetPosition(object25)));
AssignCommand(object25, SetFacingPoint(GetPosition(GetFirstPC())));
AssignCommand(GetFirstPC(), ActionStartConversation(GetFirstPC(), "qgm_arena_start", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));
DelayCommand(3.0, ChangeToStandardFaction(object25, 1));
DelayCommand(3.0, ExecuteScript("k_ai_master", object25, 1003));
}
else {
if ((GetGlobalNumber("QGM_ARENA_BOSS") == 2)) {
object object25 = CreateObject(1, "qgm_thirdboss", location7, 1);
AssignCommand(GetFirstPC(), SetFacingPoint(GetPosition(object25)));
AssignCommand(object25, SetFacingPoint(GetPosition(GetFirstPC())));
AssignCommand(GetFirstPC(), ActionStartConversation(GetFirstPC(), "qgm_arena_start", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));
DelayCommand(3.0, ChangeToStandardFaction(object25, 1));
DelayCommand(3.0, ExecuteScript("k_ai_master", object25, 1003));
}
else {
if ((GetGlobalNumber("QGM_ARENA_BOSS") == 3)) {
object object25 = CreateObject(1, "qgm_fourthboss", location7, 1);
AssignCommand(GetFirstPC(), SetFacingPoint(GetPosition(object25)));
AssignCommand(object25, SetFacingPoint(GetPosition(GetFirstPC())));
AssignCommand(GetFirstPC(), ActionStartConversation(GetFirstPC(), "qgm_arena_start", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));
DelayCommand(3.0, ChangeToStandardFaction(object25, 1));
DelayCommand(3.0, ExecuteScript("k_ai_master", object25, 1003));
}
else {
object object25 = CreateObject(1, "qgm_lastboss", location7, 1);
AssignCommand(GetFirstPC(), SetFacingPoint(GetPosition(object25)));
AssignCommand(object25, SetFacingPoint(GetPosition(GetFirstPC())));
AssignCommand(GetFirstPC(), ActionStartConversation(GetFirstPC(), "qgm_arena_start", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));
DelayCommand(3.0, ChangeToStandardFaction(object25, 1));
DelayCommand(3.0, ExecuteScript("k_ai_master", object25, 1003));
}
}
}
if ((GetGlobalNumber("QGM_ARENA_TYPE") == 2)) {
AssignCommand(GetFirstPC(), ActionStartConversation(GetFirstPC(), "qgm_skirm_start", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));
}
}
}
}
}
 VarsityPuppet
04-16-2010, 4:00 PM
#2
You could try a switch statement maybe?

Here, I wrote up the code real quickly for you

void main() {
object oEntering = GetEnteringObject();
if (oEntering == GetFirstPC()) {
if ((GetGlobalNumber("QGM_ARENA_TYPE") == 1)) {
location location7 = Location(GetPosition(GetObjectByTag("BossSpawn", 0)), 90.0);
string string3;

int onEnter = GetGlobalNumber("QGM_ARENA_BOSS");

switch(onEnter){
case 0:
object object25 = CreateObject(1, "qgm_firstboss", location7, 1);
AssignCommand(GetFirstPC(), SetFacingPoint(GetPosition(object25)));
AssignCommand(object25, SetFacingPoint(GetPosition(GetFirstPC())));
AssignCommand(GetFirstPC(), ActionStartConversation(GetFirstPC(), "qgm_arena_start", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));
DelayCommand(3.0, ChangeToStandardFaction(object25, 1));
DelayCommand(3.0, ExecuteScript("k_ai_master", object25, 1003));
break;
case 1:
object object25 = CreateObject(1, "qgm_secondboss", location7, 1);
AssignCommand(GetFirstPC(), SetFacingPoint(GetPosition(object25)));
AssignCommand(object25, SetFacingPoint(GetPosition(GetFirstPC())));
AssignCommand(GetFirstPC(), ActionStartConversation(GetFirstPC(), "qgm_arena_start", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));
DelayCommand(3.0, ChangeToStandardFaction(object25, 1));
DelayCommand(3.0, ExecuteScript("k_ai_master", object25, 1003));
break;
case 2:
object object25 = CreateObject(1, "qgm_thirdboss", location7, 1);
AssignCommand(GetFirstPC(), SetFacingPoint(GetPosition(object25)));
AssignCommand(object25, SetFacingPoint(GetPosition(GetFirstPC())));
AssignCommand(GetFirstPC(), ActionStartConversation(GetFirstPC(), "qgm_arena_start", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));
DelayCommand(3.0, ChangeToStandardFaction(object25, 1));
DelayCommand(3.0, ExecuteScript("k_ai_master", object25, 1003));
break;
case 3:
object object25 = CreateObject(1, "qgm_fourthboss", location7, 1);
AssignCommand(GetFirstPC(), SetFacingPoint(GetPosition(object25)));
AssignCommand(object25, SetFacingPoint(GetPosition(GetFirstPC())));
AssignCommand(GetFirstPC(), ActionStartConversation(GetFirstPC(), "qgm_arena_start", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));
DelayCommand(3.0, ChangeToStandardFaction(object25, 1));
DelayCommand(3.0, ExecuteScript("k_ai_master", object25, 1003));
break;
case 4:
object object25 = CreateObject(1, "qgm_lastboss", location7, 1);
AssignCommand(GetFirstPC(), SetFacingPoint(GetPosition(object25)));
AssignCommand(object25, SetFacingPoint(GetPosition(GetFirstPC())));
AssignCommand(GetFirstPC(), ActionStartConversation(GetFirstPC(), "qgm_arena_start", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));
DelayCommand(3.0, ChangeToStandardFaction(object25, 1));
DelayCommand(3.0, ExecuteScript("k_ai_master", object25, 1003));
break;
}
}
if ((GetGlobalNumber("QGM_ARENA_TYPE") == 2)) {
AssignCommand(GetFirstPC(), ActionStartConversation(GetFirstPC(), "qgm_skirm_start", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));
}
}
}

The other thing is that sometimes starting a conversation with yourself doesn't work... well it's NEVER worked for me anyways.
 Darth InSidious
04-16-2010, 4:50 PM
#3
Is this specifically a problem with the script when it's set to two? And can we see the whole script?

There's a fair amount of gunk in there. I'm pretty sure you can do without the empty quote marks, for example. But more generally, you've assigned the PC to start a conversation with himself.

I'm also not too sure about the setup of the script as a whole, either. I'd think it more preferable to have separate objects rather than redefining object25 in each case.

VP's suggestion of using a switch is also, frankly, easier to read, and probably less buggy. As a rule, I prefer only to use if/else if there's only two options or so.

I'd suggest you try setting object25 as the actor in the AssignCommand clause. No promises that that'll solve the issue, mind.


object object25 = CreateObject(1, "qgm_thirdboss", location7, 1);
AssignCommand(GetFirstPC(), SetFacingPoint(GetPosition(object25)));
AssignCommand(object25, SetFacingPoint(GetPosition(GetFirstPC())));
AssignCommand(object25, ActionStartConversation(GetFirstPC(), "qgm_arena_start"));
DelayCommand(3.0, ChangeToStandardFaction(object25, 1));
DelayCommand(3.0, ExecuteScript("k_ai_master", object25, 1003));
 DarthStoney
04-16-2010, 7:20 PM
#4
Is this specifically a problem with the script when it's set to two? And can we see the whole script?

Yes, only when the global is set to 2,when set to 1 it works fine.
Here is GM's original script
void main() {
string sModule = GetModuleFileName();
if ((sModule == "770qgm")) {
}
if ((sModule == "771qgm")) {
if ((!GetIsObjectValid(GetObjectByTag("Atton", 0)))) {
object oQgm_atton = CreateObject(1, "qgm_atton", Location(Vector((-17.0304), (-11.29583), 0.0), 0.0), 0);
AssignCommand(oQgm_atton, ActionPlayAnimation(38, 1.0, (-1.0)));
}
else {
AssignCommand(GetObjectByTag("Atton", 0), ActionPlayAnimation(38, 1.0, (-1.0)));
}
if ((!GetIsObjectValid(GetObjectByTag("BaoDur", 0)))) {
object oQgm_baodur = CreateObject(1, "qgm_baodur", Location(Vector((-16.22431), (-11.49853), 0.0), 90.0), 0);
AssignCommand(oQgm_baodur, ActionPlayAnimation(38, 1.0, (-1.0)));
}
else {
AssignCommand(GetObjectByTag("BaoDur", 0), ActionPlayAnimation(38, 1.0, (-1.0)));
}
if ((!GetIsObjectValid(GetObjectByTag("Kreia", 0)))) {
object oQgm_kreia = CreateObject(1, "qgm_kreia", Location(Vector((-1.0), 0.0, 1.0), 0.0), 0);
AssignCommand(oQgm_kreia, ActionPlayAnimation(16, 1.0, (-1.0)));
}
else {
AssignCommand(GetObjectByTag("Kreia", 0), ActionPlayAnimation(16, 1.0, (-1.0)));
}
if ((!GetIsObjectValid(GetObjectByTag("HK47", 0)))) {
object oQgm_hk47 = CreateObject(1, "qgm_hk47", Location(Vector((-8.68361), 5.54739, 0.16033), 135.0), 0);
}
if ((!GetIsObjectValid(GetObjectByTag("T3M4", 0)))) {
object oQgm_t3m4 = CreateObject(1, "qgm_t3m4", Location(Vector((-11.17176), 4.99482, 0.0), 55.0), 0);
}
if ((!GetIsObjectValid(GetObjectByTag("Mira", 0)))) {
object oQgm_mira = CreateObject(1, "qgm_mira", Location(Vector(11.42863, (-14.34767), 0.0), 235.0), 0);
}
}
if ((sModule == "772qgm")) {
if ((GetGlobalNumber("QGM_ARENA_TYPE") == 77)) {
AssignCommand(GetFirstPC(), ActionStartConversation(GetObjectByTag("GameMaster", 0), "", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));
}
}
if ((sModule == "773qgm")) {
int nGlobal = GetGlobalNumber("QGM_ARENA_TYPE");
if ((nGlobal == 1)) {
int int10 = GetGlobalNumber("QGM_ARENA_BOSS");
location location7 = Location(GetPosition(GetObjectByTag("BossSpawn", 0)), 90.0);
string string3;
if ((int10 == 0)) {
string3 = "qgm_firstboss";
}
else {
if ((int10 == 1)) {
string3 = "qgm_secondboss";
}
else {
string3 = "qgm_thirdboss";
}
}
object object25 = CreateObject(1, string3, location7, 1);
AssignCommand(GetFirstPC(), SetFacingPoint(GetPosition(object25)));
AssignCommand(object25, SetFacingPoint(GetPosition(GetFirstPC())));
AssignCommand(GetFirstPC(), ActionStartConversation(GetFirstPC(), "qgm_arena_start", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));
DelayCommand(3.0, ChangeToStandardFaction(object25, 1));
DelayCommand(3.0, ExecuteScript("k_ai_master", object25, 1003));
}
else {
if ((nGlobal == 2)) {
}
}
}
}

update; I got it working this way and no extra spawning of FirstBoss droid.
void main() {
object oEntering = GetEnteringObject();
if (oEntering == GetFirstPC()) {
location location7 = Location(GetPosition(GetObjectByTag("BossSpawn", 0)), 90.0);
if ((GetGlobalNumber("QGM_ARENA_BOSS") == 0) && (GetGlobalNumber("QGM_ARENA_TYPE") == 1)) {
object object25 = CreateObject(1, "qgm_firstboss", location7, 1);
AssignCommand(GetFirstPC(), SetFacingPoint(GetPosition(object25)));
AssignCommand(object25, SetFacingPoint(GetPosition(GetFirstPC())));
AssignCommand(GetFirstPC(), ActionStartConversation(GetFirstPC(), "qgm_arena_start", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));
DelayCommand(3.0, ChangeToStandardFaction(object25, 1));
DelayCommand(3.0, ExecuteScript("k_ai_master", object25, 1003));
}
if ((GetGlobalNumber("QGM_ARENA_BOSS") == 1) && (GetGlobalNumber("QGM_ARENA_TYPE") == 1)) {
object object25 = CreateObject(1, "qgm_secondboss", location7, 1);
AssignCommand(GetFirstPC(), SetFacingPoint(GetPosition(object25)));
AssignCommand(object25, SetFacingPoint(GetPosition(GetFirstPC())));
AssignCommand(GetFirstPC(), ActionStartConversation(GetFirstPC(), "qgm_arena_start", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));
DelayCommand(3.0, ChangeToStandardFaction(object25, 1));
DelayCommand(3.0, ExecuteScript("k_ai_master", object25, 1003));
}
if ((GetGlobalNumber("QGM_ARENA_BOSS") == 2) && (GetGlobalNumber("QGM_ARENA_TYPE") == 1)) {
object object25 = CreateObject(1, "qgm_thirdboss", location7, 1);
AssignCommand(GetFirstPC(), SetFacingPoint(GetPosition(object25)));
AssignCommand(object25, SetFacingPoint(GetPosition(GetFirstPC())));
AssignCommand(GetFirstPC(), ActionStartConversation(GetFirstPC(), "qgm_arena_start", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));
DelayCommand(3.0, ChangeToStandardFaction(object25, 1));
DelayCommand(3.0, ExecuteScript("k_ai_master", object25, 1003));
}
if ((GetGlobalNumber("QGM_ARENA_BOSS") == 3) && (GetGlobalNumber("QGM_ARENA_TYPE") == 1)) {
object object25 = CreateObject(1, "qgm_fourthboss", location7, 1);
AssignCommand(GetFirstPC(), SetFacingPoint(GetPosition(object25)));
AssignCommand(object25, SetFacingPoint(GetPosition(GetFirstPC())));
AssignCommand(GetFirstPC(), ActionStartConversation(GetFirstPC(), "qgm_arena_start", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));
DelayCommand(3.0, ChangeToStandardFaction(object25, 1));
DelayCommand(3.0, ExecuteScript("k_ai_master", object25, 1003));
}
if ((GetGlobalNumber("QGM_ARENA_BOSS") == 4) && (GetGlobalNumber("QGM_ARENA_TYPE") == 1)) {
object object25 = CreateObject(1, "qgm_lastboss", location7, 1);
AssignCommand(GetFirstPC(), SetFacingPoint(GetPosition(object25)));
AssignCommand(object25, SetFacingPoint(GetPosition(GetFirstPC())));
AssignCommand(GetFirstPC(), ActionStartConversation(GetFirstPC(), "qgm_arena_start", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));
DelayCommand(3.0, ChangeToStandardFaction(object25, 1));
DelayCommand(3.0, ExecuteScript("k_ai_master", object25, 1003));
}
if ((GetGlobalNumber("QGM_ARENA_TYPE") == 2)) {
AssignCommand(GetFirstPC(), ActionStartConversation(GetFirstPC(), "qgm_skirm_start", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));
}
}
}
Page: 1 of 1