I have this script here..
void main()
{
GetLastSpellCaster();
GetLastSpell();
if(GetLastSpell() == SPELL_GREATER_DISPELLING)
{
DeleteLocalInt(OBJECT_SELF,"Arcane_Lock");
SetLocked(OBJECT_SELF, FALSE);
ActionOpenDoor(OBJECT_SELF);
SetLockKeyRequired(OBJECT_SELF, FALSE);
}
if(GetLastSpell() == SPELL_MORDENKAINENS_DISJUNCTION)
{
DeleteLocalInt(OBJECT_SELF,"Arcane_Lock");
SetLocked(OBJECT_SELF, FALSE);
ActionOpenDoor(OBJECT_SELF);
SetLockKeyRequired(OBJECT_SELF, FALSE);
}
}
Now, how do I make it so it will only go if the variable Arcane_Lock is on it, and set to 5?
Arcane Lock
Débuté par
WhenTheNightComes
, févr. 18 2013 05:17
#1
Posté 18 février 2013 - 05:17
#2
Posté 18 février 2013 - 05:46
I'll maybe say something wrong but whatever I'll try...
What if you make a variable check in the very beginning of your script, then an if Arcane_Lock == 5, the rest of your script, and a return on the else after it?
What if you make a variable check in the very beginning of your script, then an if Arcane_Lock == 5, the rest of your script, and a return on the else after it?
#3
Posté 18 février 2013 - 06:55
Okay, new script... It seems not to be unlocking and opening the door, though.
#include "nw_i0_spells"
void main()
{
GetLastSpellCaster();
GetLastSpell();
object oPC = OBJECT_SELF;
if ( GetLocalInt(oPC, "Arcane_Lock") == 5 )
{
}
else if(GetLastSpell() == SPELL_GREATER_DISPELLING)
{
DeleteLocalInt(OBJECT_SELF,"Arcane_Lock");
SetLocked(OBJECT_SELF, FALSE);
ActionOpenDoor(OBJECT_SELF);
SetLockKeyRequired(OBJECT_SELF, FALSE);
RemoveSpecificEffect(EFFECT_TYPE_VISUALEFFECT, OBJECT_SELF);
return;
}
else if(GetLastSpell() == SPELL_MORDENKAINENS_DISJUNCTION)
{
DeleteLocalInt(OBJECT_SELF,"Arcane_Lock");
SetLocked(OBJECT_SELF, FALSE);
ActionOpenDoor(OBJECT_SELF);
SetLockKeyRequired(OBJECT_SELF, FALSE);
RemoveSpecificEffect(EFFECT_TYPE_VISUALEFFECT, OBJECT_SELF);
return;
}
}
#include "nw_i0_spells"
void main()
{
GetLastSpellCaster();
GetLastSpell();
object oPC = OBJECT_SELF;
if ( GetLocalInt(oPC, "Arcane_Lock") == 5 )
{
}
else if(GetLastSpell() == SPELL_GREATER_DISPELLING)
{
DeleteLocalInt(OBJECT_SELF,"Arcane_Lock");
SetLocked(OBJECT_SELF, FALSE);
ActionOpenDoor(OBJECT_SELF);
SetLockKeyRequired(OBJECT_SELF, FALSE);
RemoveSpecificEffect(EFFECT_TYPE_VISUALEFFECT, OBJECT_SELF);
return;
}
else if(GetLastSpell() == SPELL_MORDENKAINENS_DISJUNCTION)
{
DeleteLocalInt(OBJECT_SELF,"Arcane_Lock");
SetLocked(OBJECT_SELF, FALSE);
ActionOpenDoor(OBJECT_SELF);
SetLockKeyRequired(OBJECT_SELF, FALSE);
RemoveSpecificEffect(EFFECT_TYPE_VISUALEFFECT, OBJECT_SELF);
return;
}
}
#4
Posté 18 février 2013 - 09:28
Something looks strange with your brackets. I think you've got nothing under the condition Arcane_Lock = 5 because the following brackets are just empty.
By the way I'm not sure we can have multiple if statements in a single script, I've read something like that somewhere... and well I'm a newbie so forgive me if I say anything... just trying to help...
By the way I'm not sure we can have multiple if statements in a single script, I've read something like that somewhere... and well I'm a newbie so forgive me if I say anything... just trying to help...
#5
Posté 19 février 2013 - 02:17
If I understand what you want it to do correctly:
Take out the } and the else right before the line with the SPELL_GREATER_DISPELLING conditional. and add another one at the end of the script. That will put the 2 GetLastSpell() checks
inside the condition for Arcane_lock == 5 so that only if that is true and one of the two spells is cast will the lock open.
Also, you're looking for the Arcane_Lock variable on the PC not the door.
For most practical purposes you can have as many if statements as you need in a script.
Cheers,
Meaglyn
Take out the } and the else right before the line with the SPELL_GREATER_DISPELLING conditional. and add another one at the end of the script. That will put the 2 GetLastSpell() checks
inside the condition for Arcane_lock == 5 so that only if that is true and one of the two spells is cast will the lock open.
Also, you're looking for the Arcane_Lock variable on the PC not the door.
For most practical purposes you can have as many if statements as you need in a script.
Cheers,
Meaglyn
#6
Posté 19 février 2013 - 02:41
#include "nw_i0_spells"
void main()
{
int nSpellIndex = GetLastSpell();
// object oPC = OBJECT_SELF; // If you are running this from a door event OBJECT_SELF would be the door.
if ( GetLocalInt(oPC, "Arcane_Lock") == 5&&(nSpellIndex == SPELL_GREATER_DISPELLING || nSpellIndex == SPELL_MORDENKAINENS_DISJUNCTION ) )
{
DeleteLocalInt(OBJECT_SELF,"Arcane_Lock");
SetLocked(OBJECT_SELF, FALSE);
ActionOpenDoor(OBJECT_SELF);
SetLockKeyRequired(OBJECT_SELF, FALSE);
RemoveSpecificEffect(EFFECT_TYPE_VISUALEFFECT, OBJECT_SELF);
}
}
#7
Posté 19 février 2013 - 06:38
Good point LF. I didn't notice the line where he was setting oPC to object self.
However, if you comment that out then the check for Arcane_lock == 5 is again on the wrong
object ...
However, if you comment that out then the check for Arcane_lock == 5 is again on the wrong
object ...





Retour en haut






