No success making an activatable magic weapon ...
Atrophiederic
Member, Mobile Tester Posts: 147
Greetings, forum friends, and Happy Hollidays!
I have been attempting to create a magic item that is a standard long sword, until its power is activated, and then all sorts of nifty bonuses are applied. Then, when you activate the power again, the nifty bonuses are stripped off the weapon, so you are left with a normal longsword again. So far, I've had no success with it, as the thread title suggests.
Can anyone offer any eyeballs and suggestions? This is what I have so far ...
I start with a longsword item, tag of "magicfiresword". It has the "unique power self only unlimited" on it. It also has a variable on it, also "magicfiresword", set to 0.
I have an entry in my module's "x2_mod_def_act" script that looks like this:
Everything compiles fine, so far. Now for the "magicfiresword" script itself - this is what it looks like:
I was thinking to use the variable to notate when the sword is powered or not.
The script compiles with no errors. Whenever I activate the sword's power, I get nothing.
I have other items which assign properties in the "ExecuteScript" fashion, so I am not sure what I am doing wrong.
If anyone can offer any assistance, I will be eternally grateful! And I apologize in advance if I have left out any relevant pieces of information!
Eric
(The code in this post was edited to reflect a change in the variable used, from "magicfiresword" to "mfs", to help reduce confusion.)
I have been attempting to create a magic item that is a standard long sword, until its power is activated, and then all sorts of nifty bonuses are applied. Then, when you activate the power again, the nifty bonuses are stripped off the weapon, so you are left with a normal longsword again. So far, I've had no success with it, as the thread title suggests.
Can anyone offer any eyeballs and suggestions? This is what I have so far ...
I start with a longsword item, tag of "magicfiresword". It has the "unique power self only unlimited" on it. It also has a variable on it, also "magicfiresword", set to 0.
I have an entry in my module's "x2_mod_def_act" script that looks like this:
{ if (GetTag(GetItemActivated()) == "magicfiresword") ExecuteScript("magicfiresword", OBJECT_SELF); {
Everything compiles fine, so far. Now for the "magicfiresword" script itself - this is what it looks like:
void main() { object oTarget; oTarget = GetObjectByTag("magicfiresword"); // If the local int is exactly 0. if (GetLocalInt(oTarget, "mfs") == 0) { // Run scripts to add properties to item. ExecuteScript("_dmgbns_1d10fir", OBJECT_SELF); ExecuteScript("_viseff_fir", OBJECT_SELF); ExecuteScript("_lgtbrt_orng", OBJECT_SELF); // Set local int to 1 SetLocalInt(oTarget, "mfs", 1); } else // If the local int is exactly 1. if (GetLocalInt(oTarget, "mfs") == 1) { // Run scripts to remove properties from item. ExecuteScript("remove_fir1d10", OBJECT_SELF); ExecuteScript("rmv_viseff_fir", OBJECT_SELF); ExecuteScript("rmv_brt_lgt_orng", OBJECT_SELF); // Set local int to 0. SetLocalInt(oTarget, "mfs", 0); } }
I was thinking to use the variable to notate when the sword is powered or not.
The script compiles with no errors. Whenever I activate the sword's power, I get nothing.
I have other items which assign properties in the "ExecuteScript" fashion, so I am not sure what I am doing wrong.
If anyone can offer any assistance, I will be eternally grateful! And I apologize in advance if I have left out any relevant pieces of information!
Eric
(The code in this post was edited to reflect a change in the variable used, from "magicfiresword" to "mfs", to help reduce confusion.)
Post edited by Atrophiederic on
0
Comments
And there's no need to refefine it inside the conditionals. It will work just at the beginning.
I removed the definition inside the conditionals, as you can see in the edit of my original script above.
As far as going from to - the script compiles fine, but gives the same result as my initial script, nothing.
Regardless, thank you for your help!
Eric
and so on where you put what's actually going to happen. Also, I would probably delaycommand some of those execute script commands so they're not all trying to fire at once, like 0.2, 0.4, 0.6, and then delay command the variable to 1.0.
Also, make sure you have in your module's OnModuleLoad event the following not commented out:
While I'd personally avoid all of those other ExecuteScript calls and just do it directly, probably the smallest-change to fix for your code is to change the `x2_mod_def_act` section to be as follows
Now once you get to the magicfiresword script, the sword itself will be OBJECT_SELF, and hopefully the other executes will work accordingly.
Once again, thank you all for your help, ideas, etc. Just one of many reasons why I still play NwN and why I love this community so much!
Be safe and be well!