I thought I'd share a list of ten of the most common types of mistake I have made while scripting modules. Some of these have taken me hours to identify and correct. I hope these comments save you from making the same mistakes!
Regarding your problem with variables declared in loops, that is not a problem with nwn. It is because the nwn scripting language is based off of some member of the C family of programming languages(C, C++, Java, etc). In these languages, any variable declared (created, not necessarily initialized) inside a set of braces({}) does not exist outside of the braces. I'm not sure why this was decided on when the languages were created, but bioware will almost definitely not "fix" it.
Posted by Cuthbert503 at 2005-06-11 08:26:15 Voted 10.00 on 06/11/05
This is a compilation of the old system into a single score. There were 2 that made this score of 7.50 then rounded to 8.
Posted by John McA ( ..xxx.xxx ) at 2003-08-07 01:11:00
I just thought, regarding the RemoveEffect function, that the way to program it is to generate the effect as you stated, and then use SetLocalEffect([effect name]) with the recipient of the effect as the owner. To remove the effect in a different script, use GetLocalEffect to get the specific instance and then remove it.
I'll try this.
Posted by John McA ( ..xxx.xxx ) at 2003-08-06 08:47:00
Thanks for the comments.
Classic, thanks for the tip. I normally program effects in the way you said, but I'll double check my scripts where it failed.
Posted by B ( ..xxx.xxx ) at 2003-08-04 12:20:00
Thanks for this document! For those of us with little (modern) programming experience, things like this help. Even point number one was well taken - its easy for the distinction between tag and resref to slip your mind when you're building a mod. :)
Posted by Classic ( ..xxx.xxx ) at 2003-08-04 02:18:00
I see you have been having problems with removing effects from objects/characters. I believe the solution is as follows:
Instead of directly using the ApplyEffect on your target, set up a variable Effect eEffect = "Whatever-effect-you-want". Then apply this specific effect eEffect to your target - ApplyEffect(eEffect) or something like that. This will make the effect a specific one and not just a generic one, and therefore it can be easily removed with RemoveEffect.
Hope that made sense, else check the scripting forum at Bioware.
You must be Logged In to post comments in this section.