If I use a script to summon creatures to pre-destined WPs (OnEnter of a trigger) can I use the same creature resref and waypoint tag for X creatures or every summoned creature needs different resrefs and separate WP tags?
I can use scripts to summon a single creature to a specific waypoint just unsure if that may works for multiple instances. I want this for a possible attack what depends on the PC’s decision (if accept the quest then crossing a trigger may summon soldiers help the PC to accomplish the quest otherwise the area remain neutral).
You only need one resref if the creatures are all the same.
If you use one waypoint, the creatures will spawn in a mob nearby, which might suit your purpose.
Unique waypoints (with tags suffixed 1, 2, 3… or whatever) are only really necessary if you care about the exact spawn positions - for example, if guards must appear from several nearby doorways.
I made a possible script for a henchman betrayal. When save there is no error but not sure it would really work or that my script is the best solution…
#include "nw_i0_henchman"
#include "NW_I0_GENERIC"
void main()
{
SetFormerMaster(GetPCSpeaker(), OBJECT_SELF);
RemoveHenchman(GetPCSpeaker());
ClearAllActions();
SetIsTemporaryEnemy(GetPCSpeaker());
DetermineCombatRound();
}
Would it good or shall\need I add some more things?
From memory, that works.
I want trolls to be killed only if hit by fire and acid so I made this OnDeath script:
// void main ()
int nFireDamage = GetDamageDealtByType(DAMAGE_TYPE_FIRE);
int nAcidDamage = GetDamageDealtByType(DAMAGE_TYPE_ACID);
int nTotalFireAcidDamage = nFireDamage + nAcidDamage;
effect eHeal = EffectResurrection();
if nTotalFireAcidDamage <= 0;
{
SetIsDestroyable(FALSE, TRUE, TRUE);
DelayCommand(6.0f, ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, OBJECT_SELF, 0.0f));
DelayCommand(6.0f, (SetIsDestroyable(TRUE, FALSE, FALSE)));
}
But the compiler said the “if” statement’s declaration is wrong… Could it be fixed somehow or the whole script is wrong basicly?
needs to be
if (nTotalFireAcidDamage <= 0)
Note you should not have a semi-colon at the end of the if
and your condition needs to be enclosed in brackets. It’s like C/C++ and not like BASIC. See this pinned thread for links to tutorials -
The Starting Point - module building tutorials for beginners - and where to find them
or read my scripting tutorials -
TR’s Basics - Variables, Types and Functions (TBC)
TR’s Basics - Boolean Algebra
TR’s Basics - Decisions
TR’s Basics - Mostly Operators
TR
If you have Tyrants of the Moonsea, there are scripts in that module which will do what you want - no fuss , no muss.
Two things…
First and most important: Is there a tool I could use to create ambient sounds and other sounds (those globe-looking placeable sounds)?
Are here any 3D modeller who may could help me fix two reskinned models what appear bugged in toolset and game?
Audacity is a popular choice for editing recorded sounds into the correct MP3 format, but any decent audio tool will do. See wiki.
Put the sound file in a hak. You will find that you don’t need to change any 2da files - just edit an existing sound object template, noticing that your new sounds are now selectable. You can also play sounds in conversation or by script.
Area music is slightly different, as discussed earlier on the wiki page, if you want to take advantage of the built-in area music logic. Alternatively, you can just play an mp3 by script.
I am not a very skilled 3D modeller. However, there is a tool that might help if it is the model and not the texture(s) that have the problem. So have a look at Clean Models:EE.
Even if it doesn’t help now, it is a useful tool to have. Hope this helps.
TR
Ok, the Toolset started act really weird…
Error: Access violation
Abnormal program termination
…whaddahell?!
Restart, use the backup and save the module (rewrite the original) solves it for a while as I could continue make my module. Still not like those strange crash messages…
Perhaps it is Win7-related? Or the 4-core i5 CPU goes stupid? Or simply the toolset hates me?
Usually results from doing something illegal in the toolset, such as loading a bad model or selecting a resource that doesn’t exist.
What exactly are you doing when it crashes?
What did you do immediately before that?
Hard to tell without the trail of actions. Sometimes a perfectly legal action will crash the toolset because an action just before that corrupted the session.
As much as I could examine there are two areas what affected (both over 30x30 size). These two areas use models extracted from the CCC Ice Age-themed HAK and included them into mine to use as few haks for the module as possible.
But the troubles occur when I link new area transitions what connected to those areas (doors, triggers). If I load those areas and edit them I can save and exit fine. Also tested the module myself and those areas worked ingame just as fine.
I took yesterday quite a time to reveal that. So a few steps closer to some solutions… My guess are the models used on those maps (elk & whooly rhino, for check them in their respective CCC hak).
However the access violation errors suggests that the windows f**ked up something in the registry to add it’s own part to the troubles…
If you are building in 1.69, Wooly Rhino is not compatible, as noted here.
I tested that myself - it was a classic case where selecting the appearance seemed to work, but the toolset kept crashing on other actions until it was removed.
Don’t worry unduly about the Access Violation - it’s just what the toolset does when it goes buggy, and doesn’t normally indicate any problem with Windows.
May I ask if 1.69 toolset have duplication issues? I noted that some tilesets randomly create (sorry, the toolset do it with the tileset’s elements) invalid duplicates. When accidentally point on them or click to view\edit the toolset gives an “access violation error”. I wonder if this could be fixed or if there is any workaround…
The other access violatin error occurs because the registry sometimes searches for a toolset.ini (checked it in the registry) but such file not exists and as far as I remember never existed. If I edit the registry entry something rewrites\writes it back to the original state. No idea how to fix that permanently.
And the last access violation error I could reveal the source tied to multi-core processors. Not sure what is the exact trouble with the quad-core CPUs so have no idea what to do with it either…
That much so far I could research through try-check-repeat process. If anyone have any ideas about them or know some more issues… Well, please share with me!
Thanks!
Just checked \NeverwinterNights\NWN folder and the file should be called nwtoolset.ini not toolset.ini.
TR
@Tarot_Redhand
Thanks! Corrected!
else
I made this script (I am awfull with scripts) what intended to make patrols attack the PC on sight IF the PC made them hostile in a conversation:
#include "nw_i0_generic"
void main()
{
if
{
object oPC = GetLastPerceived();
if (!GetIsPC(oPC)) return;
if (!GetLastPerceptionSeen()) return;
if (GetLocalInt(oPC, "PatrolsHatePC")!= 50)
return;
object oTarget;
oTarget = OBJECT_SELF;
SetIsTemporaryEnemy(oPC, oTarget);
ActionAttack(oPC);
DetermineCombatRound(oPC);
}
else
ActionRandomWalk();
}
It seems I missed something again but the compiler not really tells me what because all it says “left bracket” is missed… ???
I want to use it as a HeartBeat script.
The missing brackets (the compiler is only telling you about the first one) is on your very first if statement. See my tutorial - TR’s Basics - Decisions - that will tell you how to use if statements.
TR
Question comes (again, sorry):
How can I code that a given amount of time pass?
To be more exact: I know how to make scripts jump the PC to a distant location in a distant area. But that jumps are instant however I want the time to pass during the jump. Like 1-2 days or such. I could use such code for make travel\sailing shorter while time do fly ingame for the PC…
Sorry if asked a foolish\profane question again…
Use -
Function - SetTime
void SetTime(int nHour, int nMinute, int nSecond, int nMillisecond);
From the lexicon, here is an example of how to use it -
// Advance the time of the module by 2 hours and 30 minutes.
// Maybe the party in the module had to rest for a while...
void main()
{
// Get current hour, minute, second and millisecond.
int nHour = GetTimeHour();
int nMinute = GetTimeMinute();
int nSecond = GetTimeSecond();
int nMillisecond = GetTimeMillisecond();
// Advance the hour and minute by 2 and 30 respectivly.
nHour += 2;
nMinute += 30;
// Set the new time
SetTime(nHour, nMinute, nSecond, nMillisecond);
}
TR