| AMIA ARCHIVE https://www.amiaworld.net/phpBB3/ |
|
| Toolset help https://www.amiaworld.net/phpBB3/viewtopic.php?f=2&t=50650 |
Page 1 of 1 |
| Author: | Hrothmus [ Thu, Sep 02 2010, 22:29 PM ] |
| Post subject: | Toolset help |
Howdy everyone. I have taken to working with the toolset. I'm really new at it but I understand the general way it works and all and I'm discovering more and more about it as I tinker with it. What I need help with is scripting. I was wondering if anyone might be available to chat with me and walk me through a few simple scripts until i get the hang of it. The script I am wanting to write right now is one that is initiated on area load and applies the effect int VFX_DUR_PROT_SHADOW_ARMOR to any objects in the area that have a specific tag. If anyone is available to help you can either just pm me, ill send you my msn messenger details, or look for me in the amia chat room (currently in there now) Thanks for any and all help |
|
| Author: | Dev Disco [ Fri, Sep 03 2010, 7:28 AM ] |
| Post subject: | Re: Toolset help |
Best way to do this is via a trigger, not the OnAreaEnter script. Just place the trigger over the whole area. OK, the script: First of all you make sure it only runs once Code: if ( GetLocalInt( OBJECT_SELF, "done" ) == TRUE ){ return; } else{ SetLocalInt( OBJECT_SELF, "done", TRUE ) } You then create the effect Code: effect eSkin = EffectVisualEffect( VFX_DUR_PROT_SHADOW_ARMOR ); You loop through the area and apply the effect Code: object oArea = GetArea( OBJECT_SELF ); object oObject = GetFirstObjectInArea( oArea ); while ( GetIsObjectValid( oObject ) ) { if ( GetTag( oObject ) == "PaintThis" ){ ApplyEffectToObject( DURATION_TYPE_PERMANENT, eSkin, oObject ); } oObject = GetNextObjectInArea( oArea ); } And finally you remove the trigger. Not 100% sure if you need to look at the timing. Theoretically you should be able to remove the trigger right after the "GetArea( OBJECT_SELF )" statement, but you never know. Code: DestroyObject( OBJECT_SELF, 1.0 );
|
|
| Author: | Ace of Swords [ Fri, Sep 03 2010, 8:49 AM ] |
| Post subject: | Re: Toolset help |
Have a browse through this: NWN Lexicon (Sort of like a Wikipedia for the nuts and bolts of NWN) NWN Lexicon Function List NWN Lexicon Constants List I also suggest having a look at Lilac Soul's script generator- not as a crutch but as a learning tool for the more basic scripts. Don't go near it if you're looking for something more complex, it's only useful for fairly simple scripts. Disco's right that a trigger in that fashion would be pretty much the best and most reliable way to handle it. Just be warned- once you place that trigger it's going to be all kinds of hell to do anything in that area afterwards unless you turn display of triggers off. I've placed areawide triggers before and you have this annoying habit of clicking on them and moving them (thus messing up their geometry, which the 'undo' function can't fix) and forcing yourself to redraw them. But yeah, the trigger will only need to run once in that case. Or you could try dropping it in the OnModuleLoad script and skip the trigger entirely, though I personally haven't tried making said script apply effects like that on loading the module. Either way the idea is to only make it run once since that's all you should need. I'm not the best of scripters but I know a couple people who are practically legendary. I won't name names since they probably wouldn't like it, but I'll have a chat with the ones I know play here and see if they can give you some pointers. Disco's probably as qualified as they are but he's got this whole module thing to run. Pesky responsibilities. |
|
| Author: | Hrothmus [ Fri, Sep 03 2010, 11:06 AM ] |
| Post subject: | Re: Toolset help |
Thanks a ton for the replies, when I get back from class I'll see what I can do about implementing it. |
|
| Author: | Dev Disco [ Fri, Sep 03 2010, 18:03 PM ] |
| Post subject: | Re: Toolset help |
You can also put the tag of the objects that need an effect and the effect number as a local variable on the trigger. Import them in your script and you can use it for more stuff. |
|
| Author: | Hrothmus [ Fri, Sep 03 2010, 19:28 PM ] |
| Post subject: | Re: Toolset help |
Allright. I'm still working this around. So here is what I did. I saved the code you posted as a script X. void main() { if ( GetLocalInt( OBJECT_SELF, "done" ) == TRUE ) { return; } else{ SetLocalInt( OBJECT_SELF, "done", TRUE ) ; } effect eSkin = EffectVisualEffect( VFX_DUR_PROT_SHADOW_ARMOR ); object oArea = GetArea( OBJECT_SELF ); object oObject = GetFirstObjectInArea( oArea ); while ( GetIsObjectValid( oObject ) ) { if ( GetTag( oObject ) == "PaintThis" ){ ApplyEffectToObject( DURATION_TYPE_PERMANENT, eSkin, oObject ); } oObject = GetNextObjectInArea( oArea ); } DestroyObject( OBJECT_SELF, 1.0 ); } then I set the the tag for the rug I want changed to Paint This Then I created a general trigger that onEnter runs the script above. I painted the trigger area over the entire area. So this didn't seem to work. Where did I go wrong here. |
|
| Author: | Ace of Swords [ Fri, Sep 03 2010, 22:46 PM ] |
| Post subject: | Re: Toolset help |
Is the rug static? If so changes to it won't show up until you leave the area and return or otherwise go beyond the placeable draw distance limit. |
|
| Author: | Hrothmus [ Fri, Sep 03 2010, 23:50 PM ] |
| Post subject: | Re: Toolset help |
The start area is near the rug and I loaded the module? and I was walking around within the boundaries i set for the areaenter trigger. |
|
| Author: | Hrothmus [ Sat, Sep 04 2010, 18:14 PM ] |
| Post subject: | Re: Toolset help |
Ace of Swords wrote: Is the rug static? If so changes to it won't show up until you leave the area and return or otherwise go beyond the placeable draw distance limit. Aye that was the issue. Now, i turned a round carpet using that effect but the floor shows through it. So after experimenting I have come to the conclusion that something black will need to be directly under it to show up the way I want it. Is there a way to turn a large round carpet pure black? If so than I can just layer it underneath my shadow carpet. |
|
| Author: | Dev Disco [ Sun, Sep 05 2010, 7:59 AM ] |
| Post subject: | Re: Toolset help |
Not that I know. |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |
|