Hello!
I'm building a module for NWN, which is mostly the open world module with no set story and stuff...
Horses play a huge role in it. I've been trying to find a script I need on the web but no luck.
The situation should be as follows:
When a PC talks to a horse, some responses are available only if the PC owns the horse they are talking to. (It's needed because otherwise players would be able to steal each other's horses when playing this module multiplayer).
And that's basically it. I need a "text appears when" kind of script...
Also, a second thing, although not nearly as important as the first one.
It's about the unique power of an item - i made it so that a horse will spawn next to PC using the item. However, it would be better if a script would automatically make the PC the owner of the spawned horse. Is that possible?
Any help will be appreciated! Cheers!
Some horse scripts needed!
Débuté par
Grani
, nov. 13 2011 04:11
#1
Posté 13 novembre 2011 - 04:11
#2
Posté 13 novembre 2011 - 05:21
Here is a demo movie of my method, which sounds like it may interest you:
http://nwvault.ign.c...s.Detail&id=602
And the demo itself:
http://nwvault.ign.c....Detail&id=5921
As far as talking to the horse it would be simple with this method as you horse has the same name as it's owner except with the addition of horse. So you could just match the names or just check that it was the correct owner.
I think I did test it out where you can't even mount another persons horse, though in one particular case, that is where you enter a building without dismounting properly, that is you just use the Bioware auto dismount function, the horse will not retain the name of it's owner. Which is not really a problem as long as you dismount using the dismount function. Of course you can always reclaim your horse normally if you do use the Bioware function. Never had many problems though I have not tested it extensively in multiplayer.
http://nwvault.ign.c...s.Detail&id=602
And the demo itself:
http://nwvault.ign.c....Detail&id=5921
As far as talking to the horse it would be simple with this method as you horse has the same name as it's owner except with the addition of horse. So you could just match the names or just check that it was the correct owner.
I think I did test it out where you can't even mount another persons horse, though in one particular case, that is where you enter a building without dismounting properly, that is you just use the Bioware auto dismount function, the horse will not retain the name of it's owner. Which is not really a problem as long as you dismount using the dismount function. Of course you can always reclaim your horse normally if you do use the Bioware function. Never had many problems though I have not tested it extensively in multiplayer.
Modifié par ffbj, 13 novembre 2011 - 05:42 .
#3
Posté 13 novembre 2011 - 05:36
Well, that method seems really cool! But the thing is, I want to have several modules making one huge world in which it's possible to travel from one module to another. I don't want the owned horses to be lost, so I basically created some horse items - form a conversation with a horse you can unsummon it (destroy it), receiving the summoning item. When you use that item, the horse is summoned (created) again.
These items will be usable on every of these modules, so the horses won't be lost when travelling between them.
I need the scripts I wrote about to avoid horse stealing. I want only the owner of the horse to be able to unsummon it and receive the item.
Still, thanks
These items will be usable on every of these modules, so the horses won't be lost when travelling between them.
I need the scripts I wrote about to avoid horse stealing. I want only the owner of the horse to be able to unsummon it and receive the item.
Still, thanks
#4
Posté 13 novembre 2011 - 06:12
You just want to add a few lines to you item that sets the horse name to the rider's name and then disallow the mount script from firing.
#include "x2_inc_switches"
#include "x3_inc_horse"
void DoMount(object oHorse)
{
if ((GetIsObjectValid(oHorse) && (!HorseGetIsMounted(OBJECT_SELF))))
{
AssignCommand (OBJECT_SELF,HorseMount(oHorse,TRUE, TRUE, 0));
}
}
void main()
{
int nEvent = GetUserDefinedItemEventNumber();
object oItem = GetItemActivated();
object oPC = GetItemActivator();
object oHorse = HorseGetHorse(oPC,1);
string sRiderName = GetName (oPC,FALSE);
string sHorseName = (sRiderName);
if(((nEvent == X2_ITEM_EVENT_ACTIVATE) && (sRiderName == sHorseName)))
{
AssignCommand (oPC, DoMount(oHorse));
}
}
This would best be done when summoning the horse but since I don't have your script I just wrote up the above.
Of course the name check lines would have to be added to your mounting script.
#include "x2_inc_switches"
#include "x3_inc_horse"
void DoMount(object oHorse)
{
if ((GetIsObjectValid(oHorse) && (!HorseGetIsMounted(OBJECT_SELF))))
{
AssignCommand (OBJECT_SELF,HorseMount(oHorse,TRUE, TRUE, 0));
}
}
void main()
{
int nEvent = GetUserDefinedItemEventNumber();
object oItem = GetItemActivated();
object oPC = GetItemActivator();
object oHorse = HorseGetHorse(oPC,1);
string sRiderName = GetName (oPC,FALSE);
string sHorseName = (sRiderName);
if(((nEvent == X2_ITEM_EVENT_ACTIVATE) && (sRiderName == sHorseName)))
{
AssignCommand (oPC, DoMount(oHorse));
}
}
This would best be done when summoning the horse but since I don't have your script I just wrote up the above.
Of course the name check lines would have to be added to your mounting script.
Modifié par ffbj, 13 novembre 2011 - 06:15 .
#5
Posté 13 novembre 2011 - 06:34
Umm, I don't really understand where I should put this script You've written.
Here is my script item's script:
void main()
{
object oPC;
object oTarget;
object oSpawn;
location lTarget;
oPC = GetItemActivator();
oTarget = oPC;
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "kon", lTarget);
oTarget = oSpawn;
int nInt;
nInt = GetObjectType(oTarget);
if (nInt != OBJECT_TYPE_WAYPOINT) DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), oTarget));
else DelayCommand(0.5, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oTarget)));
}
I should probably add that I'm not a scripter really... Most of the scripts are either created with script generator or found on the Internet/other modules.
Thanks for help!
Here is my script item's script:
void main()
{
object oPC;
object oTarget;
object oSpawn;
location lTarget;
oPC = GetItemActivator();
oTarget = oPC;
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "kon", lTarget);
oTarget = oSpawn;
int nInt;
nInt = GetObjectType(oTarget);
if (nInt != OBJECT_TYPE_WAYPOINT) DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), oTarget));
else DelayCommand(0.5, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oTarget)));
}
I should probably add that I'm not a scripter really... Most of the scripts are either created with script generator or found on the Internet/other modules.
Thanks for help!
#6
Posté 14 novembre 2011 - 04:35
Anyone? Please, I need these scripts ;/ Especially the "text appears when" script...
#7
Posté 15 novembre 2011 - 10:37
I just need to know what I should add to the item's summoning script to change summoned horse's name to ie. "<FullName>'s horse" and then the condition for text to appear being the horse has such name. Could You please create such scripts? Thanks!
#8
Posté 15 novembre 2011 - 10:57
#include "x2_inc_switches"
void main()
{
if (GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE) return;
object oTarget = GetItemActivator();
location lTarget = GetLocation (oTarget);
object oSteed = CreateObject (OBJECT_TYPE_CREATURE, "put_resref_here", lTarget);
// Assigns the mount to oTarget. The delay is just to ensure the Steed is created fully first.
DelayCommand (0.3, AssignCommand (oTarget, ActionCastSpellAtObject (SPELL_HORSE_ASSIGN_MOUNT, oSteed, METAMAGIC_NONE, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)) );
DelayCommand (0.4, AssignCommand (oTarget, ActionCastSpellAtObject (SPELL_HORSE_ASSIGN_MOUNT, oTarget, METAMAGIC_NONE, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)) );
}
You "name" the mount by assigning it to an owner, which by script is easiest to do by having mount and owner cast SPELL_HORSE_ASSIGN_MOUNT at each other.
void main()
{
if (GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE) return;
object oTarget = GetItemActivator();
location lTarget = GetLocation (oTarget);
object oSteed = CreateObject (OBJECT_TYPE_CREATURE, "put_resref_here", lTarget);
// Assigns the mount to oTarget. The delay is just to ensure the Steed is created fully first.
DelayCommand (0.3, AssignCommand (oTarget, ActionCastSpellAtObject (SPELL_HORSE_ASSIGN_MOUNT, oSteed, METAMAGIC_NONE, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)) );
DelayCommand (0.4, AssignCommand (oTarget, ActionCastSpellAtObject (SPELL_HORSE_ASSIGN_MOUNT, oTarget, METAMAGIC_NONE, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)) );
}
You "name" the mount by assigning it to an owner, which by script is easiest to do by having mount and owner cast SPELL_HORSE_ASSIGN_MOUNT at each other.
#9
Posté 16 novembre 2011 - 03:22
You can also get the horse's name to reflect the rider's name by defining the strings thus:
string sRiderName = GetName (oPC);
string sHorseName = (sRiderName + " 's Horse ");
string sRiderName = GetName (oPC);
string sHorseName = (sRiderName + " 's Horse ");
Modifié par ffbj, 16 novembre 2011 - 03:23 .
#10
Posté 16 novembre 2011 - 06:31
Thanks a lot! But how will the condition look like, then?
#11
Posté 17 novembre 2011 - 01:33
You mean like the sc starting conditional?
int StartingConditional()
{
// Check if the name of the speaker is the same as object self in this case a horse. ffbj
object oPC = GetPCSpeaker();
string sRiderName = GetName (oPC);
if (GetName(OBJECT_SELF) == (sRiderName + "'s Horse "))
return TRUE;
else
return FALSE;
FloatingTextStringOnCreature(" HORSE THIEF! ", oPC,TRUE);
}
int StartingConditional()
{
// Check if the name of the speaker is the same as object self in this case a horse. ffbj
object oPC = GetPCSpeaker();
string sRiderName = GetName (oPC);
if (GetName(OBJECT_SELF) == (sRiderName + "'s Horse "))
return TRUE;
else
return FALSE;
FloatingTextStringOnCreature(" HORSE THIEF! ", oPC,TRUE);
}
#12
Posté 17 novembre 2011 - 12:12
Thanks ^^





Retour en haut







