I have slightly modified the OnSpawn script to run a custom function to generate the loot on a creature. The problem is all NWN 2 templates use the standard function. Is there a way to force them to use my custom script whithout having to change it from the properties? I need it especially for encounters. The script has the same name of the original one, but it is saved within the module.
Force template to use modified default on spawn script
Débuté par
Ext3rmin4tor
, avril 30 2013 05:30
#1
Posté 30 avril 2013 - 05:30
#2
Posté 30 avril 2013 - 06:11
nope - you have to set it
(if a single script - if you were changing the entire script set there is a function but then it would only be stock script sets)
(if a single script - if you were changing the entire script set there is a function but then it would only be stock script sets)
#3
Posté 30 avril 2013 - 07:52
Ext3rmin4tor wrote...
The script has the same name of the original one, but it is saved within the module.
save your module as a directory and copy your script to your override folder. now your script should globally override the original one with the same name. beware, you should have add your changed loot spawn to the vanilla script and comment out the old loot creation. this way the spawn script keeps all the other functions besides loot.
#4
Posté 30 avril 2013 - 08:29
How do you save a module as directory?
Also I need to include the module in a campaign. Can this be done anyway?
Also I need to include the module in a campaign. Can this be done anyway?
#5
Posté 30 avril 2013 - 09:07
file > save as directory.
dunno if adding modules to the main campaigns works at all but you have to edit the campaign itself with the campaign plugin. there your module must be added to the list and afterwards you should place it within the modules folder of your nwn2 installation directory as a .mod file.
guess that's only useful if you want to implement lots of new content to the original campaigns. if your mod only contains altered scripts the override folder is your place.
dunno if adding modules to the main campaigns works at all but you have to edit the campaign itself with the campaign plugin. there your module must be added to the list and afterwards you should place it within the modules folder of your nwn2 installation directory as a .mod file.
guess that's only useful if you want to implement lots of new content to the original campaigns. if your mod only contains altered scripts the override folder is your place.
#6
Posté 30 avril 2013 - 09:17
Does this work using the override campaign folder as well? I mean overriding the script.
#7
Posté 30 avril 2013 - 10:01
As I recall the default OnSpawn script can call another script if you specify the script name in the properties of the creature being spawned. So that is one option, but would necessitate that you change the blueprints of the creatures you are spawning.
Alternatively just modify the standard spawn script to use your function and compile it and save it in your campaign folder. All of your modules will use it automatically then. You don't need to do anything with the override folder. You should never require people to install things in their override folder, instead use your campaign folder.
Regards
Alternatively just modify the standard spawn script to use your function and compile it and save it in your campaign folder. All of your modules will use it automatically then. You don't need to do anything with the override folder. You should never require people to install things in their override folder, instead use your campaign folder.
Regards
#8
Posté 30 avril 2013 - 10:35
then i misread the opening post. i thought he wanted to modify the original campaigns to use his custom loot script without the need to alter the blue prints. after reading again it made more sense 
what silverwand said's right.
what silverwand said's right.
#9
Posté 30 avril 2013 - 11:15
Kaldor Silverwand wrote...
As I recall the default OnSpawn script can call another script if you specify the script name in the properties of the creature being spawned. So that is one option, but would necessitate that you change the blueprints of the creatures you are spawning.
For future reference:
Set a variable on the creature called 'SpawnScript' and give it a string value that matches the name of the custom script you also want to run. The default OnSpawn script will check the creature for that variable and execute the custom script.
You can also specify a custom OnDeath script using the same method, using the variable name 'DeathScript'.
#10
Posté 01 mai 2013 - 11:55
DannJ wrote...
Kaldor Silverwand wrote...
As I recall the default OnSpawn script can call another script if you specify the script name in the properties of the creature being spawned. So that is one option, but would necessitate that you change the blueprints of the creatures you are spawning.
For future reference:
Set a variable on the creature called 'SpawnScript' and give it a string value that matches the name of the custom script you also want to run. The default OnSpawn script will check the creature for that variable and execute the custom script.
You can also specify a custom OnDeath script using the same method, using the variable name 'DeathScript'.
The problem with this is it runs both my loot script and the standard one, I don't want this to happen, so I used the solution with the Campaign folder. Everything works fine. Thanks.
#11
Posté 01 mai 2013 - 01:37
Although you have it working now, I'll just mention here that disabling the default loot script can also be done with the standard spawn script by putting a local integer X2_L_NOTREASURE = 1 on the blueprint.





Retour en haut






