sekan Posted April 3, 2008 Posted April 3, 2008 Hi, I have made a dialog and have put this script to activate a quest that's in another module. void main() { SetGlobalNumber("Tar_VulkarElevator", 1); } In the other module i attached this script to a .utc heartbeat void main() { object oEntering = GetEnteringObject(); object oPC=GetFirstPC(); if (GetIsPC(oEntering) && !(GetGlobalNumber("Tar_VulkarElevator") == 1) && !GetLocalBoolean(OBJECT_SELF, 40)) { vector vPos; float fAngle; vPos.x = 106.24; vPos.y = 238.01; vPos.z = 17.15; fAngle = 0.0; CreateObject(OBJECT_TYPE_CREATURE, "jedimaster", Location(vPos, fAngle)); vPos.x = 108.96; vPos.y = 232.28; vPos.z = 16.23; fAngle = 0.0; CreateObject(OBJECT_TYPE_CREATURE, "czerka_leader", Location(vPos, fAngle)); vPos.x = 108.61; vPos.y = 229.49; vPos.z = 15.98; fAngle = 0.0; CreateObject(OBJECT_TYPE_CREATURE, "czerka_01", Location(vPos, fAngle)); vPos.x = 111.47; vPos.y = 231.36; vPos.z = 15.92; fAngle = 0.0; CreateObject(OBJECT_TYPE_CREATURE, "czerka_02", Location(vPos, fAngle)); vPos.x = 111.50; vPos.y = 226.28; vPos.z = 15.29; fAngle = 0.0; CreateObject(OBJECT_TYPE_CREATURE, "czerka_03", Location(vPos, fAngle)); vPos.x = 112.68; vPos.y = 228.28; vPos.z = 15.44; fAngle = 0.0; CreateObject(OBJECT_TYPE_CREATURE, "czerka_04", Location(vPos, fAngle)); vPos.x = 112.71; vPos.y = 226.93; vPos.z = 15.19; fAngle = 0.0; CreateObject(OBJECT_TYPE_CREATURE, "wookie_01", Location(vPos, fAngle)); vPos.x = 110.60; vPos.y = 228.49; vPos.z = 15.64; fAngle = 0.0; CreateObject(OBJECT_TYPE_CREATURE, "wookie_02", Location(vPos, fAngle)); vPos.x = 111.53; vPos.y = 229.04; vPos.z = 15.63; fAngle = 0.0; CreateObject(OBJECT_TYPE_CREATURE, "lrwooli", Location(vPos, fAngle)); SetLocalBoolean(OBJECT_SELF, 40, TRUE); } } After i have talked thought the dialog and activated the first script i go to that module that uses the second script. But nobody spawns. I hope somebody can help me with this. Thanks and take care
shockix Posted April 3, 2008 Posted April 3, 2008 The problem must be here : if (GetIsPC(oEntering) && [color=red][b]![/b][/color]GetGlobalNumber("Tar_VulkarElevator") && !GetLocalBoolean(OBJECT_SELF, 40)) This script will fire only if the Global number is not set (because of the !). I believe you want the opposite.
sekan Posted April 3, 2008 Author Posted April 3, 2008 The problem must be here : if (GetIsPC(oEntering) && [color=red][b]![/b][/color]GetGlobalNumber("Tar_VulkarElevator") && !GetLocalBoolean(OBJECT_SELF, 40)) This script will fire only if the Global number is not set (because of the !). I believe you want the opposite. I guess you mean that the script should look like: if (GetIsPC(oEntering) && (GetGlobalNumber("Tar_VulkarElevator") == 1) && (GetLocalBoolean(OBJECT_SELF, 40))) Well i tried this in my script and it still doesn't work.
stoffe Posted April 3, 2008 Posted April 3, 2008 In the other module i attached this script to a .utc heartbeat object oEntering = [b]GetEnteringObject()[/b]; if (GetIsPC(oEntering) && !(GetGlobalNumber("Tar_VulkarElevator") == 1) && !GetLocalBoolean(OBJECT_SELF, 40)) The problem is most likely your use of the GetEnteringObject() function in a OnHeartbeat event script. This function will only return a valid object reference in OnEnter event scripts (for areas, triggers etc). Thus you are essentially checking if (GetIsPC(OBJECT_INVALID) ..., which never returns true. Also, in your changed script above you'd need to put the negation back in front of GetLocalBoolean(OBJECT_SELF, 40) in the if-statement since you want it to fire if it hasn't been done before; you set Local Boolean 40 when the code within the if-block has been run.
sekan Posted April 3, 2008 Author Posted April 3, 2008 The problem is most likely your use of the GetEnteringObject() function in a OnHeartbeat event script. This function will only return a valid object reference in OnEnter event scripts (for areas, triggers etc). Thus you are essentially checking if (GetIsPC(OBJECT_INVALID) ..., which never returns true. Also, in your changed script above you'd need to put the negation back in front of GetLocalBoolean(OBJECT_SELF, 40) in the if-statement since you want it to fire if it hasn't been done before; you set Local Boolean 40 when the code within the if-block has been run. Thanks Stoffe Now i only have one problem left... When trying to compile this new script i get Error: Syntax error at && if (GetGlobalNumber("Tar_VulkarElevator") == 1) && !GetLocalBoolean(OBJECT_SELF, 40) I can't see any problem on this line at all. Thanks and take care
stoffe Posted April 3, 2008 Posted April 3, 2008 Now i only have one problem left... When trying to compile this new script i get Error: Syntax error at && I can't see any problem on this line at all. I can You haven't wrapped the condition parameters of the if statement within parenthesises, which is required in NWScript: if ((GetGlobalNumber("Tar_VulkarElevator") == 1) && !GetLocalBoolean(OBJECT_SELF, 40))
sekan Posted April 3, 2008 Author Posted April 3, 2008 I can You haven't wrapped the condition parameters of the if statement within parenthesises, which is required in NWScript: if ((GetGlobalNumber("Tar_VulkarElevator") == 1) && !GetLocalBoolean(OBJECT_SELF, 40)) Thanks everything works now
Recommended Posts
Archived
This topic is now archived and is closed to further replies.