PDA

View Full Version : Question about onenter script's


n1gamer
05-08-2007, 08:19 AM
I am going to use an onenter script to play the music files i want to put into the game (a_hatchopen is the script and it is for tsl peragus). I was just woundering if i create a new script to replace a_hatchopen what about the code that was inside the orignal a_hatchopen. Is it used for some special events during that level or does it really matter.

Pavlos
05-08-2007, 01:00 PM
I am going to use an onenter script to play the music files i want to put into the game (a_hatchopen is the script and it is for tsl peragus). I was just woundering if i create a new script to replace a_hatchopen what about the code that was inside the orignal a_hatchopen. Is it used for some special events during that level or does it really matter.

a_hatchopen.nss looks like this:

void sub1() {
object oT3m4 = GetObjectByTag("t3m4", 0);
if (GetIsObjectValid(oT3m4)) {
AurPostString("destroying t3 off the map", 5, 15, 10.0);
DestroyObject(oT3m4, 0.0, 0, 0.0, 0);
}
SetNPCSelectability(8, 0);
object oPC = GetFirstPC();
effect efNext = GetFirstEffect(oPC);
while (GetIsEffectValid(efNext)) {
if ((GetEffectType(efNext) == 27)) {
RemoveEffect(oPC, efNext);
}
efNext = GetNextEffect(oPC);
}
SetGlobalFadeIn(0.0, 2.0, 0.0, 0.0, 0.0);
}

void main() {
object oEntering = GetEnteringObject();
if ((GetEnteringObject() == GetFirstPC())) {
if ((GetGlobalNumber("101PER_Sion_Arrives") > 0)) {
PlayRoomAnimation("101PERzc", 1);
}
else {
PlayRoomAnimation("101PERzc", 2);
}
if (GetLoadFromSaveGame()) {
SetGlobalFadeOut(0.0, 0.0, 0.0, 0.0, 0.0);
SetFadeUntilScript();
DelayCommand(2.0, SetGlobalFadeIn(1.0, 1.0, 0.0, 0.0, 0.0));
return;
}
if (GetGlobalBoolean("PER_TURNINTO_T3M4")) {
SetGlobalBoolean("PER_TURNINTO_T3M4", 0);
DelayCommand(0.1, sub1());
}
if ((GetGlobalNumber("105PER_T3_End") == 1)) {
SetGlobalFadeIn(0.0, 1.0, 0.0, 0.0, 0.0);
SetGlobalNumber("105PER_T3_End", 2);
object oAtton = GetObjectByTag("Atton", 0);
DelayCommand(0.5, AssignCommand(oAtton, ClearAllActions()));
DelayCommand(0.5, AssignCommand(oAtton, ActionStartConversation(oEntering, "101Atton", 0, 0, 1, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0)));
}
object oWP_wakeup_donnie = GetObjectByTag("WP_wakeup_donnie", 0);
if ((GetIsObjectValid(oWP_wakeup_donnie) && GetLocalBoolean(oWP_wakeup_donnie, 29))) {
PlayRoomAnimation("101per2b", 3);
}
else {
if ((0 == GetGender(oEntering))) {
SetGlobalBoolean("000_PLAYER_GENDER", 1);
return;
}
SetGlobalFadeOut(0.0, 0.0, 0.0, 0.0, 0.0);
SetFadeUntilScript();
}
}
}

As decompiled by the wonderful DeNCS. As you can see, it deals with the setting of various globals.

n1gamer
05-09-2007, 05:48 AM
I guess that means that it does matter, but can i apply my script to this without anything going wrong, lets say at the bottom of the a_hatchopen script.

Pavlos
05-09-2007, 01:50 PM
I guess that means that it does matter, but can i apply my script to this without anything going wrong, lets say at the bottom of the a_hatchopen script.

If you tell us what exactly you want to do (words or a script) then someone around here can help you implement it, provided you haven't already done it, of course :).

n1gamer
05-09-2007, 02:42 PM
If you tell us what exactly you want to do (words or a script) then someone around here can help you implement it, provided you haven't already done it, of course :).



Sorry about the trouble this is taking but here is the code i want to use in the a_hatchopen script.


if (GetAppearanceType(GetFirstPC()) == 671)
{
ExecuteScript("newmusic",OBJECT_SELF);
ExecuteScript("ev_footlkr1",OBJECT_SELF);
ExecuteScript("sithsoilder99",OBJECT_SELF);
}

So would i be able to attach it to the end of the a_hatchopen script.

Thanks n1gamer