so i have a script in my custom module where if you do a certain action based on your alignment, 3 things are supposed to happen;
visual effect plays
pc plays an animation
alignment changes 1 point
now i can either make the alignment change by 1 or i can make the visual effect play with the animation, but all 3 will not work together, here is my script here;
void main()
{
effect eVFX;
// Get the PC who is in this conversation.
object oPC = GetPCSpeaker();
// Have the PC perform a sequence of actions.
AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_WORSHIP, 1.0, 3.0));
// Apply a visual effect.
eVFX = EffectVisualEffect(VFX_FNF_SUNBEAM);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC);
with this script here, only the visual effect and bowing works, but the alignment change doesnt, which is weird because i used this alignment change everywhere else and it works just fine
You have two scripts there. Which one are you using?
If they are both in the same file maybe the compiler is too stupid to notice and is just running the first main() routine. But really it should fail to compile.
the formatting makes this a bit confusing for me, but if this is one single script, you shouldnât have two main(). try this :
void main()
{
object oPC = GetPCSpeaker(); // if object returned is valid, will always be a PC
effect eVFX = EffectVisualEffect(VFX_FNF_SUNBEAM);
if (GetIsObjectValid(oPC) // test against being called while character not in conversation
&& !GetLocalInt(OBJECT_SELF, ânChaosHitâ)) // ...& we haven't done this yet
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC);
AdjustAlignment(oPC, ALIGNMENT_CHAOTIC, 1);
SetLocalInt(OBJECT_SELF, "nChaosHit", 1);
}
}
note that this could present problems if youâre using it in a multi-player environment because it will affect only the first player to access the altar. to make it suitable for multiplayer, youâd have to change the variable name to use a non-ambiguous player identifier.
this is missing the âprayâ animation and also i get an error saying;
ERROR: VARIABLE DEFINED WITHOUT TYPE
and itâs highlighting;
&& !GetLocalInt(OBJECT_SELF, ânChaosHitâ)) // âŚ& we havenât done this yet
the goal of the script is this;
have the visual effect play
have the character bow down for 3 seconds
and then have their alignment increase by 1 in the given direction
so if i have too much fluff in there, then by all means it can be taken out, for the alignment part the reason why i have all that ânChaosHitâ stuff is because that is the only way an alignment shift would work at all, when using just a normal 1 line of code alignment shift, it never seemed to work
holy flying fignewton sticks boys and jewels, somehow my smooth brain figured it out, to get the outcome of; play visual effect, worship for 3 seconds and have alignment move 1 the script was this;
void main()
{
effect eVFX;
// Get the creature who triggered this event.
object oPC = GetLastUsedBy();
// Apply a visual effect.
eVFX = EffectVisualEffect(VFX_FNF_SUNBEAM);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC);
// Have the PC perform a sequence of actions.
AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_WORSHIP, 1.0, 3.0));
// The PC (only) has become more Lawful.
ah. when i copied/pasted your code, i should have noticed that the web site had âhelpfullyâ formatted the variable name, placing it between âsmartâ quotes rather than âstraightâ quotes, and unfortunately i didnât have an nwn in front of me at the time to test-compile it. in any case, i see that in the meantime youâve found a solution that works for you. great!