Jump to content

Home

NWNNSSCOMP & Spawn Scripts


Darth InSidious

Recommended Posts

The only version of nwnnsscomp I can get to work is one with a "compileall" .bat with it. Any other versions open and close instantly, and this one isn't able to handle all the doohickeys in K2's scripts. Edith: I'm an idiot. Is there a version which will work properly with XP, and will be able to support the K2 scripting functions?

 

Also, for some reason, when I attach spawn scripts to dialogues, they almost never fire.

 

Finally, could someone tell me how to ensure something has saved as 32 bits?

 

Thanks,

Insidious

Link to comment
Share on other sites

This following script is from Stoffe's very nice puppet-making tutorial...I'm afraid I can't remember what it does, though...

 

// ST: st_ai_puppethb.nss

#include "k_inc_generic"

 

void main() {

object oEnemy = GetNearestCreature(

CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN,

OBJECT_SELF, 1,

CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY,

CREATURE_TYPE_IS_ALIVE, TRUE

);

 

if(!GN_GetSpawnInCondition(SW_FLAG_AI_OFF)) {

if(GetIsPuppet()

&& (GetIsObjectValid(GetPUPOwner())

&& (GetCurrentAction(OBJECT_SELF) != ACTION_MOVETOPOINT)

&& (GetCurrentAction(OBJECT_SELF) != ACTION_FOLLOWOWNER)

&& !GetIsConversationActive()

&& !GN_GetSpawnInCondition(SW_FLAG_SPECTATOR_STATE)

&& GetCommandable()

&& (GetDistanceBetween2D(OBJECT_SELF, GetPUPOwner()) > 3.0)

&& (!GetIsObjectValid(oEnemy) || (GetDistanceBetween(oEnemy, OBJECT_SELF) > 20.0))))

{

ClearAllActions();

ActionFollowOwner(2.0);

}

}

 

if(GN_GetSpawnInCondition(SW_FLAG_EVENT_ON_HEARTBE AT))

SignalEvent(OBJECT_SELF, EventUserDefined(1001));

}

 

 

This next script was generated by the KotOR Script Generator,and is meant to be some kind of ice-power, IIRC...

 

// Generated by jmac7142's KotOR Script Generator

// Offensive FP

#include "k_inc_force"

 

void main()

{

SWPF_DAMAGE_TYPE = DAMAGE_TYPE_ION;

 

object oSource = OBJECT_SELF;

object oTarget = GetSpellTargetObject();

 

effect eBeam = EffectBeam(VFX_BEAM_ION_RAY_01, oSource, BODY_NODE_HAND_LEFT, FALSE);

effect eVFX = EffectVisualEffect(VFX_DUR_STEALTH_PULSE);

effect eSource = EffectVisualEffect(VFX_COM_FORCE_RESISTED);

 

int nDamage = GetHitDice(oTarget)2;

effect eDamage = EffectDamage(nDamage);

 

ApplyEffectToObject(1, eBeam, oTarget);

ApplyEffectToObject(1, eVFX, oTarget);

ApplyEffectToObject(1, eSource, oSource);

ApplyEffectToObject(0, eDamage, oTarget);

}

Link to comment
Share on other sites

This next script was generated by the KotOR Script Generator,and is meant to be some kind of ice-power, IIRC...

 

(snip)
   SWPF_DAMAGE_TYPE = DAMAGE_TYPE_ION;
(snip)
   int nDamage = GetHitDice(oTarget)2;
   effect eDamage = EffectDamage(nDamage); 
(snip)

 

I don't know if this has anything to do with your problem, but the second script has two errors in it:

 

You are missing a multiplication (I assume) operator between GetHitDice(oTarget) and 2 on the line quoted above. This would probably prevent the script from compiling successfully.

 

Further, the script will cause damage of the "Universal" type to its target, not Ion damage, which I assume is what was intended from the first quoted line above. You never assign the damage type in the EffectDamage() effect constructor, thus it will use the default damage type. This shouldn't prevent it from compiling properly though.

 

When you are applying the effects, you have not assigned any duration to the duration effects (the beam and the visual) you apply to the target. Also, you are applying the visual to the caster as a temporary effect even though it's a Fire&Forget visual, which should be applied as Instant.

 

Last, you are not signalling the target that they have been struck by a Hostile force power, thus their combat AI will not react to being attacked by it.

 

Your script should probably look something like:

// Generated by jmac7142's KotOR Script Generator
// Offensive FP

void main() {
   object oSource = OBJECT_SELF;
   object oTarget = GetSpellTargetObject();

   effect eBeam   = EffectBeam(VFX_BEAM_ION_RAY_01, oSource, BODY_NODE_HAND_LEFT, FALSE);
   effect eVFX    = EffectVisualEffect(VFX_DUR_STEALTH_PULSE);
   effect eSource = EffectVisualEffect(VFX_COM_FORCE_RESISTED);

   int nDamage    = GetHitDice(oTarget) * 2;
   effect eDamage = EffectDamage(nDamage, DAMAGE_TYPE_ION);

   SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId(), TRUE));

   ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBeam, oTarget, 1.0);
   ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVFX, oTarget, 1.0);
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eSource, oSource);
   ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oTarget);   
}

 

(This is assuming that this is supposed to be a fairly powerful force power, since it will pass right through force resistance and offers no saving throw.)

Link to comment
Share on other sites

Hey DS, what (if any) does your .bat file look like? You can open it up with notepad to see. ;)

 

I'm wondering if you're missing the "pause" feature to make the window stay open...

 

My Compile .bat file looks like this:

nwnnsscomp -c -g 2 --outputdir "C:\Documents and Settings\ChAiNz\Desktop\CompileDump\Output" *.nss
pause

 

and my De-compile .bat looks like this:

nwnnsscomp -d -g 2 --outputdir "C:\Documents and Settings\ChAiNz\Desktop\CompileDump\Output" *.nss
pause 

 

Of course, your output directory would be different (if you specify one).. but I had a similar problem when I didn't use the "pause" feature.

 

I'm also using "nwnnsscomp.exe v1.03" found in the thread that Fred gave a link to...

Link to comment
Share on other sites

yes but if he's using Fred's compiler, he'll have to specify the game -g 1 for K! and -g 2 for K2.

 

Darth Insidious, if the above doesn't work, let's try the other way around. Can you give us this info:

 

- location to which you extracted nwnnsscomp.exe

- location of your scripts to compile

- Do you have the int'l version of the game or the US version?

- command that you are entering to get nwnnsscomp to work.

 

Perhaps with this we will be able to figure out exactly what's wrong.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...