Sarge's I need help thread
#1
Posté 29 janvier 2011 - 12:36
I have started my first (very basic) module and while I have made progress near completion, I am stuck on a few things that are keeping it from all coming together. I need help with some things that I'm sure are elementary to the more advanced scripters and I am seeking to learn from you.
I will start with the two things that has me stuck and then as each question gets answered, I'll ask a new one. Just to keep things organized.
It all starts as most adventures do. The player has decided he is bored and takes off to seek fame and fortune. The first place (1st module) he comes to is a village in which the Mayor asks the player to find out why the towns miners have not returned from the mine.
1st problem- I noticed that when you make a new character, he doesn't have any weapons. How did you solve this without knowing what kind of character class a player would make?
2nd problem- I made 5 Companions that are standing by the mine but I only want the PC to be able to take 4 of them in. How do I do that? Right now he can take all 5. I may even add more to give more choices but I only want 4 in the party no matter what.
2a- Also, what if he changes his mind and comes out of the mine and wants the rogue to join so he can open doors? How do you script that? I don't have it where he can switch out companions (dont know how).
Anyway, that's it for this round of questions. Please keep in mind that I'm an uber n00b when it comes to scripting so the more detailed (step by step) your answers the better.
THANKS !!!
Sarge
#2
Posté 29 janvier 2011 - 02:58
The chest option is used in the original campaign (OC)
Try getting that working and update us on your progress.
#3
Posté 29 janvier 2011 - 03:35
I like the idea of giving the PC some starter gold. I have a store with all of the basic items in the game and I could give him just enough to buy a basic weapon no matter what character class he picks to play.
This is where my lack of understanding scripting comes in.I know how to get to the Module Properties and see the onEnter area. I'm guessing you would use the ga_give_gold script that reads as follows:
// ga_give_gold
/*
This gives the player some gold
nGP = The amount of gold coins given to the PC
bAllPartyMembers = If set to 1 it gives gold to all the PCs in the party (MP only)
*/
// FAB 9/30
// MDiekmann 4/9/07 using GetFirst and NextFactionMember() instead of GetFirst and NextPC(), changed nAllPCs to bAllPartyMembers
void main(int nGP, int bAllPartyMembers)
{
object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());
if ( bAllPartyMembers == 0 )
GiveGoldToCreature( oPC,nGP );
else
{
object oTarg = GetFirstFactionMember(oPC);
while(GetIsObjectValid(oTarg))
{
GiveGoldToCreature( oTarg,nGP );
oTarg = GetNextFactionMember(oPC);
}
}
}
Where in all that mess do I put in the amount of gold if I just wanted to give him 25 gold?
Modifié par Sgt KillEmAll, 29 janvier 2011 - 03:37 .
#4
Posté 29 janvier 2011 - 04:25
void main()
{
object oPC = GetFirstPC();
GiveGoldToCreature(oPC, 500);
}
500 could be any hard coded number you might choose.
It really is pretty straight forward if you pick it all apart from the ga_** scripts.
Don't forget to compile the script and save your project before testing.
#5
Posté 29 janvier 2011 - 04:28
http://nwvault.ign.c...s.Detail&id=124
It was written by a bloke that is a strong scripter known as Knightmare - you will see him around these forums a lot.
#6
Posté 29 janvier 2011 - 05:11
The beauty of a DM'd campaign is that not everything has to be (nor should be) scripted and very few conversations need to be written out. Want to give him starting gear when his character first appears in the game world? Great! Log in via the DM client, open the Creator, and give him the items or grant him gold through the normal context menus. If you aren't a solid scripter (which, once again I'll make an assumption--you probably aren't based on this question), you'll save yourself hours of pain AND ultimately be more adaptive and immersive.
If you want your campaign to progress at a relatively good pace (as in not spend 2-4 weeks between modules while you figure out how to script stuff) then script and write as little as possible. Dedicate most of your time to crafting an excellent plot, creating the necessary NPCs, monsters, and items, and creating or finding the necessary maps. Use prefabs as much as possible. Run your NPCs ab-lib with notes like you would in PnP.
Truthfully, the only things you should be scripting are things you can't accomplish with a few clicks of the DM client. For example, your core module events can't really be emulated (okay son, I'm now going to roll a real life die to see if you stabilize and recover from bleeding out--don't respawn yet!).
Now, if you're planning on being a player as well, that changes things completely.
I respect the world out of Morbane (his posts are always extremely helpful for a novice like myself), but for a DM'd campaign his recommendation is not the solution..
#7
Posté 29 janvier 2011 - 07:45
#8
Posté 29 janvier 2011 - 10:19
#9
Posté 29 janvier 2011 - 01:51
@Mad.Hatter -- We may try the DM client later. Right now, I'm being a little selfish cause I'm kinda enjoying learning how to do this, and its fun creating a one player adventure that he can play at his convienance. Thanks for the advise, I had considered going that route and still may do it. After we get going I'll see if he has a couple of friends that may be interested, seems like it'd be more fun with 3 or 4 and a DM.
OK, that takes care of question #1, anybody got a cure for problem #2?
2nd problem- I made 5 Companions that are standing by the mine but I only want the PC to be able to take 4 of them in. How do I do that? Right now he can take all 5. I may even add more to give more choices but I only want 4 in the party no matter what.
2a- Also, what if he changes his mind and comes out of the mine and wants the rogue to join so he can open doors? How do you script that? I don't have it where he can switch out companions
(I dont know how).
#10
Posté 29 janvier 2011 - 04:47
First is to use the ga_* add roster meber to party. This script will ignore the party limit set. to make it work you will need to add a conditional check to the conversation
PC: Join my party
NPC: Too many (gc_num_comps(>= limit) )
NPC: OK (ga_roster_party_add)
or you can call up the party roster. This will enforce the party limit and allow you to remove the extra player.
PC: Join my party - ga_roster_gui_screen
2a. The roster option will solve that. If you want to do it via conversation only (no roster gui) you will need to have a "leave the party" option in their dialog and have them despawn from the party and respawn at a waypoint outside the mine or where you want them to wait.
scripts you may need:
ga_roster_add_object -This will add the object to the roster
ga_roster_selectable -When set true this will allow you select companions in the party roster gui
ga_roster_party_add -Adds companion to party
ga_roster_gui_screen -Open roster gui from conversation
ga_roster_despawn -Remove companion from party and save them
ga_roster_spawn -Move or create companion at a givenwaypoint
gc_num_comps -Check the number of companion members
#11
Posté 29 janvier 2011 - 05:03
You know what they say about assumptions!
In addition to Shaughn's post, you might want to check this thread out:
http://social.biowar...-3181671-1.html
@Morbane: The DM Client is the best solution for multiplayer games. You can avoid spending tons of time scripting because on the fly you can do things like giving items, spawning encounters, talking through NPCs (including "conditional" nodes
#12
Posté 29 janvier 2011 - 08:15
I have an older campaign on the vault called the Silverwand Sample Campaign which I designed specifically to help people like yourself who were just starting to create a campaign. It is short, easy to understand, and does many of the things I thought a typical basic campaign would require. However, it was written before MotB and SoZ were released and so it lacks some of the functionality that was provided with those expansions like player created party members.
Regards
#13
Posté 31 janvier 2011 - 01:51
#14
Posté 03 février 2011 - 01:23
I have (as most modules do) a boss creature to fight at the end. The Heros walk into a room and there he is. They talk for a bit and then he attacks them (thank you Kaldor) I have now decided he needs a few bodyguards to fight along side him.
The boss goes hostile after the conversation from a conversation action but I'm having a little trouble figuring out how to link him and 4 minor minons so they don't attack until he does.
All help on this puzzle will be greatly appreciated.
#15
Posté 03 février 2011 - 04:07
If you want the minions to be a surprise, then make them hostile but script-hidden, place them in various shadowy corners, and un-hide them in the same conversation node that the boss turns hostile in.
I'm working on a module at the moment where many of the NPCs have a neutral faction, so you can attack them and make them hostile at any time. With a couple of local variables on each NPC, I've been able to define 'minion' and 'boss' tags so that when you attack or injure one, all of his friends turn hostile as well. Attacking a boss turns him and all of his minions hostile, while attacking a minion will turn all other generic minions with the same tag (and their boss, if they have a 'boss' variable set) hostile.
Once I get home I can look up the details of the script I'm using at the moment. The advantage of 'OnAttacked' or 'On Damaged' scripts is that no conversation is required.
Modifié par DannJ, 03 février 2011 - 04:11 .
#16
Posté 03 février 2011 - 05:22
// ga_bb_set_faction
// by Brendan Bellina
// Dec, 2007
// This script set all members of the specified creature's faction to a different standard
// faction. If being set to HOSTILE then they will attack the nearest PC.
#include "ginc_param_const"
#include "nw_i0_generic"
#include "ginc_actions"
void main(string sCreatureTag, string sTargetFaction)
{
// Get the PC Speaker - if used from command line, then use OBJECT_SELF
// In a conversation, OBJECT_SELF refers to the NPC.
// From the command line, OBJECT_SELF refers to the currently possessed character.
object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());
// If debug text is on, this will let you know the script fired.
PrettyDebug("Script Fired on target: " + GetName(oPC) + "!");
int nFaction = GetStandardFaction(sTargetFaction);
object oCreature = GetObjectByTag(sCreatureTag);
if (nFaction != -1 && oCreature != OBJECT_INVALID)
{
int done = 0;
while (!done)
{
int count = 0;
object oFactionMember = GetFirstFactionMember(oCreature, FALSE);
while(GetIsObjectValid(oFactionMember) == TRUE)
{
if (oCreature != oFactionMember)
{
count++;
ChangeToStandardFaction(oFactionMember, nFaction);
if (nFaction == STANDARD_FACTION_HOSTILE)
StandardAttack(oFactionMember, GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR,PLAYER_CHAR_IS_PC, oFactionMember));
else
AssignCommand(oFactionMember, DetermineCombatRound());
}
oFactionMember = GetNextFactionMember(oCreature, FALSE);
}
// Keep looping through until no faction member except the initial creature remain.
// Shouldn't really have to loop like this, but sometimes some creatures are missed.
done = (count == 0);
} // end while (!done)
ChangeToStandardFaction(oCreature, nFaction);
if (nFaction == STANDARD_FACTION_HOSTILE)
StandardAttack(oCreature, GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR,PLAYER_CHAR_IS_PC, oCreature));
else
AssignCommand(oCreature, DetermineCombatRound());
}
}
Modifié par Kaldor Silverwand, 03 février 2011 - 05:22 .
#17
Posté 03 février 2011 - 09:14
// OnDamaged script to make neutral
// creature and allies hostile
//
// variable Boss = tag of creature's boss
// variable Minions = tag of creature's minions
// no variables set makes all of same tag hostile
void MakeHostile(object oTarget)
{
SetPlotFlag(oTarget,0);
SetImmortal(oTarget,0);
SetScriptHidden(oTarget,0);
ChangeToStandardFaction(oTarget, STANDARD_FACTION_HOSTILE);
SetLocalInt(oTarget,"MadeHostile", 1);
}
void main()
{
string sMinion = GetLocalString(OBJECT_SELF,"Minions");
string sBoss = GetLocalString(OBJECT_SELF,"Boss");
int iOnce = GetLocalInt(OBJECT_SELF, "MadeHostile");
if (iOnce == 1)
{
ExecuteScript("nw_c2_default6", OBJECT_SELF);// run default OnDamaged script
return;
}
MakeHostile(OBJECT_SELF); // make caller hostile
if (sBoss != "")
{
object oBoss = GetObjectByTag(sBoss); // make their boss hostile
MakeHostile(oBoss);
}
if (sMinion == "")
sMinion = GetTag(OBJECT_SELF); // If has no minions (isn't a boss), make those with same tag hostile
object oTarg = GetObjectByTag(sMinion);
int i = 0;
while ( GetIsObjectValid(oTarg) )
{
i++;
iOnce = GetLocalInt(oTarg, "MadeHostile");
if (iOnce != 1)
{
MakeHostile(oTarg);
}
oTarg = GetObjectByTag(sMinion, i);
}
ExecuteScript("nw_c2_default6", OBJECT_SELF);// run default OnDamaged script
}
Modifié par DannJ, 03 février 2011 - 09:14 .
#18
Posté 04 février 2011 - 02:13
@Kaldor- I have a Boss named Nagash and I'm giving him 3 Goblin bodyguards so I created a new faction called nagashfac and they are set at 50 across the board. I then copied your script above and made a script called ga_fachostile. I added ga_fachostile to my nagash1 conversation and in the action script area I put Nagash's tag (nagash1) for the sCreature Tag (string) and I put HOSTILE for the sTargetFaction (string) and made sure to refresh and save. I then tested and after the conversation no one attacked. Any idea what I did wrong?
@DannJ- I made a script out of yours and put Nagash's tag in the line if (sBoss != "") so it ended up reading if (sBoss != "nagash1") and I put the tag of his minons in the line if (sMinion == "") so it read if (sMinion == "c_goblin_n") compiled and saved. I renamed it ga_bossminon_hostile and put it at the end of the conversation. I then tested. Nagash attacked but the 3 bodyguards did not. Any ideas on why?
Thanks for the help folks. I am learning a lot by being able to "reverse engineer" your scripts and seeing how it's done through examples. I really appreciate it.
#19
Posté 04 février 2011 - 04:15
#include "nw_i0_generic"
void main()
{
object oPC = GetPCSpeaker();
object oBodyGuard1 = GetNearestObjectByTag("BodyGuard1", oPC, 1);
object oBodyGuard2 = GetNearestObjectByTag("BodyGuard2", oPC, 1);
object oBodyGuard3 = GetNearestObjectByTag("BodyGuard3", oPC, 1);
DetermineCombatRound(oPC);
AssignCommand(oBodyGuard1, DetermineCombatRound(oPC));
AssignCommand(oBodyGuard2, DetermineCombatRound(oPC));
AssignCommand(oBodyGuard3, DetermineCombatRound(oPC));
}
Hope it helps. Good luck.
#20
Posté 04 février 2011 - 05:39
Sgt KillEmAll wrote...
@Kaldor- I have a Boss named Nagash and I'm giving him 3 Goblin bodyguards so I created a new faction called nagashfac and they are set at 50 across the board. I then copied your script above and made a script called ga_fachostile. I added ga_fachostile to my nagash1 conversation and in the action script area I put Nagash's tag (nagash1) for the sCreature Tag (string) and I put HOSTILE for the sTargetFaction (string) and made sure to refresh and save. I then tested and after the conversation no one attacked. Any idea what I did wrong?
Did you compile your ga_fachostile script?
The boss and minions must all be in the same faction. Check this by clicking on each creature in the area (not the blueprints unless you are spawning them in via script) and looking at its properties.
Did you put the action on the correct conversation node? It needs to be on a node that is actually used.
Those are the ideas that come to mind.
#21
Posté 04 février 2011 - 12:49
#22
Posté 04 février 2011 - 04:11
// ga_bb_set_faction
// by Brendan Bellina
// Dec, 2007
// rev. June, 2008
// This script sets all members of the specified creature's faction to a different standard
// faction. If being set to $HOSTILE then they will attack the nearest PC.
// Defaults to conversation owner tag and $HOSTILE.
// Parameters:
// sCreatureTag - Tag of a creature who is in the faction to change, defaults to conversation owner
// sTargetFaction - One of the 4 standard factions $COMMONER, $DEFENDER, $HOSTILE, $MERCHANT.
// Defaults to $HOSTILE.
#include "ginc_param_const"
#include "nw_i0_generic"
#include "ginc_actions"
void main(string sCreatureTag, string sTargetFaction)
{
// Get the PC Speaker - if used from command line, then use OBJECT_SELF
// In a conversation, OBJECT_SELF refers to the NPC.
// From the command line, OBJECT_SELF refers to the currently possessed character.
object oPC = (GetPCSpeaker()==OBJECT_INVALID?OBJECT_SELF:GetPCSpeaker());
// If debug text is on, this will let you know the script fired.
PrettyDebug("Script Fired on target: " + GetName(oPC) + "!");
if (sTargetFaction == "")
sTargetFaction = "$HOSTILE"; // default to $HOSTILE
int nFaction = GetStandardFaction(sTargetFaction);
object oCreature;
if (sCreatureTag == "")
oCreature = GetTarget("", TARGET_OWNER);
else
oCreature = GetObjectByTag(sCreatureTag);
if (nFaction != -1 && oCreature != OBJECT_INVALID)
{
int done = 0;
while (!done)
{
int count = 0;
object oFactionMember = GetFirstFactionMember(oCreature, FALSE);
while(GetIsObjectValid(oFactionMember) == TRUE)
{
if (oCreature != oFactionMember)
{
count++;
ChangeToStandardFaction(oFactionMember, nFaction);
if (nFaction == STANDARD_FACTION_HOSTILE)
StandardAttack(oFactionMember, GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR,PLAYER_CHAR_IS_PC, oFactionMember));
else
AssignCommand(oFactionMember, DetermineCombatRound());
}
oFactionMember = GetNextFactionMember(oCreature, FALSE);
}
// Keep looping through until no faction member except the initial creature remain.
// Shouldn't really have to loop like this, but sometimes some creatures are missed.
done = (count == 0);
} // end while (!done)
ChangeToStandardFaction(oCreature, nFaction);
if (nFaction == STANDARD_FACTION_HOSTILE)
StandardAttack(oCreature, GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR,PLAYER_CHAR_IS_PC, oCreature));
else
AssignCommand(oCreature, DetermineCombatRound());
}
}
For a small number of creatures you can also use the standard script ga_faction_join, but you need to do it for each creature individually.
Regards
Modifié par Kaldor Silverwand, 04 février 2011 - 04:12 .
#23
Posté 04 février 2011 - 10:57
Thanks to everyone that helped and had patients with my questions (espescially you Kaldor)
#24
Posté 04 février 2011 - 11:06
Regards
#25
Posté 10 février 2011 - 01:26





Retour en haut






