View unanswered posts | View active topics * FAQ    * Search
* Login 




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 10 posts ] 
Hrothmus
 
PostPosted: Thu, Sep 02 2010, 22:29 PM 

User avatar

Player

Joined: 08 Jan 2010
Location: Virginia

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

_________________
Characters:

Fel'Brin - I am one with the shadows


 
      
Dev Disco
 
PostPosted: Fri, Sep 03 2010, 7:28 AM 

User avatar

HRM Chicken I of Amia

Joined: 02 Jun 2005
Location: Amsterdam

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 );

_________________
Say 'no' to JSBF!


 
      
Ace of Swords
 
PostPosted: Fri, Sep 03 2010, 8:49 AM 

User avatar

Player

Joined: 21 Jun 2010

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. :P

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.


 
      
Hrothmus
 
PostPosted: Fri, Sep 03 2010, 11:06 AM 

User avatar

Player

Joined: 08 Jan 2010
Location: Virginia

Thanks a ton for the replies, when I get back from class I'll see what I can do about implementing it.

_________________
Characters:

Fel'Brin - I am one with the shadows


 
      
Dev Disco
 
PostPosted: Fri, Sep 03 2010, 18:03 PM 

User avatar

HRM Chicken I of Amia

Joined: 02 Jun 2005
Location: Amsterdam

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.

_________________
Say 'no' to JSBF!


 
      
Hrothmus
 
PostPosted: Fri, Sep 03 2010, 19:28 PM 

User avatar

Player

Joined: 08 Jan 2010
Location: Virginia

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.

_________________
Characters:

Fel'Brin - I am one with the shadows


 
      
Ace of Swords
 
PostPosted: Fri, Sep 03 2010, 22:46 PM 

User avatar

Player

Joined: 21 Jun 2010

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.


 
      
Hrothmus
 
PostPosted: Fri, Sep 03 2010, 23:50 PM 

User avatar

Player

Joined: 08 Jan 2010
Location: Virginia

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.

_________________
Characters:

Fel'Brin - I am one with the shadows


 
      
Hrothmus
 
PostPosted: Sat, Sep 04 2010, 18:14 PM 

User avatar

Player

Joined: 08 Jan 2010
Location: Virginia

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.

_________________
Characters:

Fel'Brin - I am one with the shadows


 
      
Dev Disco
 
PostPosted: Sun, Sep 05 2010, 7:59 AM 

User avatar

HRM Chicken I of Amia

Joined: 02 Jun 2005
Location: Amsterdam

Not that I know.

_________________
Say 'no' to JSBF!


 
      
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 10 posts ] 


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group