SithRevan Posted July 21, 2006 Share Posted July 21, 2006 I was wondering how to spawn an item bsed on my alignment or if it is even possible to do such a thing, if it is would somebody help me with the script to do it, thanks. Link to comment Share on other sites More sharing options...
stoffe Posted July 21, 2006 Share Posted July 21, 2006 I was wondering how to spawn an item bsed on my alignment or if it is even possible to do such a thing, if it is would somebody help me with the script to do it, thanks. It's possible, here's a quick example of how it could be done: void main() { string sResref; int iGood = GetGoodEvilValue(GetFirstPC()); if (iGood > 60) sResref = "gooditem"; else if (iGood < 40) sResref = "evilitem"; else sResref = "neutralitem"; CreateItemOnObject(sResref, GetObjectByTag("mybox")); } This would put one out of 3 possible items inside the container with the Tag "mybox", depending on the force alignment of the main character: gooditem.uti for a lightsider, evilitem.uti for a darksider and neutralitem.uti for those in the gray zone in between. Link to comment Share on other sites More sharing options...
SithRevan Posted July 21, 2006 Author Share Posted July 21, 2006 thanks, that explains a lot. Link to comment Share on other sites More sharing options...
SithRevan Posted July 21, 2006 Author Share Posted July 21, 2006 I was wondering if that script could be used on placeables like containers, footlockers, bones, ect. Link to comment Share on other sites More sharing options...
stoffe Posted July 21, 2006 Share Posted July 21, 2006 I was wondering if that script could be used on placeables like containers, footlockers, bones, ect. Shouldn't be any problems, though if you assign the script to the placeable you can replace the GetObjectByTag("mybox") part with OBJECT_SELF instead. You probably want to make sure it only fires once as well if the player opens the container more than once. The modified example script in this case could look like: void main() { if (!GetLocalBoolean(OBJECT_SELF, 57)) { string sResref; int iGood = GetGoodEvilValue(GetFirstPC()); if (iGood > 60) sResref = "gooditem"; else if (iGood < 40) sResref = "evilitem"; else sResref = "neutralitem"; CreateItemOnObject(sResref, OBJECT_SELF); SetLocalBoolean(OBJECT_SELF, 57, TRUE); } } Save the script, compile it to NCS, put in the override folder along with the placeable UTP. Then assign it to the OnOpen event script slot of the placeable (in the UTP file) and it should fill the container with the proper item the first time it is opened. (You put the name of the script, minus the ".ncs" extension, in the OnOpen field in the UTP.) Make sure all the other event script fields are empty if you used an existing container as a blueprint for your new container. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.