Aller au contenu

Photo

[SOLVED AT LAST] Trying to get the baclground stuff to work, errors.


  • Veuillez vous connecter pour répondre
24 réponses à ce sujet

#1
0x30A88

0x30A88
  • Members
  • 1 081 messages
I have managed to fx the most erros, but 2 till remains.

For the line:
WR_SetPlotFlag(background_check, HERO_IS_ELVEN,FALSE);
I get the error
E: 13:55:43 - bdm_sys_chargen_h.nss - bdm_sys_chargen_h.nss(45): Variable defined without type (while compiling plt_gen00pt_backgrounds.nss)
I have no plt_gen00pt_background.nss and have replaced it with background_check where I could find it. What can  cause this error? I have made the plot file.

And secondly, for another script, I get.
E: 13:56:42 - mymod_sys_chargen.nss - mymod_sys_chargen.nss: Duplicate function implementation (main)

I can post the whole script if you find it necessary.

Modifié par Gisle Aune, 08 septembre 2010 - 07:24 .


#2
FergusM

FergusM
  • Members
  • 460 messages
1)
To clarify, you should have a plot file called background_check, with a flag called HERO_IS_ELVEN. The script should have a line that says

#include "plt_background_check"

at the top. This lets your script see what these identifiers actually refer to. The message the compiler is giving you says "You're using a variable but I don't know what it is."

2) The message is "You have two functions called main." This may or may not be totally accurate. However, do you in fact have two mains? Are you #include ing a script that also has a main function?

Modifié par FergusM, 05 septembre 2010 - 12:07 .


#3
0x30A88

0x30A88
  • Members
  • 1 081 messages
1), I have an #include "plt_background_check" at the top of the script

2) I added a main in the other script because if I left it out, it would give an error like

E: 14:22:43 - bdm_sys_chargen_h.nss - bdm_sys_chargen_h.nss(?): Script must contain either a main or StartingConditional


#4
BloodsongVengeance

BloodsongVengeance
  • Members
  • 590 messages
heyas;



fergus can probably confirm... but as i recall from NWNscript, the include scripts *should* have an error stating they don't have a main. because... they're not supposed to. and the compiler isn't smart enough to know they are includes, not standalone scripts.




#5
0x30A88

0x30A88
  • Members
  • 1 081 messages
I still have this error

E: 18:12:44 - bdm_sys_chargen_h.nss - bdm_sys_chargen_h.nss(43): Variable defined without type (while compiling plt_gen00pt_backgrounds.nss)

I really wonder where it gets "plt_gen00pt_backgrounds.nss" from really, when the line the error is said to be located in is:
    WR_SetPlotFlag(background_check, HERO_IS_ELVEN,FALSE);

Modifié par Gisle Aune, 05 septembre 2010 - 04:15 .


#6
Jonathan Seagull

Jonathan Seagull
  • Members
  • 418 messages
I'm not sure why exactly it's referring to the other script, but:



WR_SetPlotFlag(background_check, HERO_IS_ELVEN,FALSE);

The bold part should be prefixed with plt_. E.G. PLT_BACKGROUND_CHECK (I'm not sure if the all-caps matters, but I always use it here).

Modifié par Jonathan Seagull, 05 septembre 2010 - 06:59 .


#7
0x30A88

0x30A88
  • Members
  • 1 081 messages
I wrote the prefixes and saved the script, then compiled the scritp using it and still it gives the exact same error.

#8
FergusM

FergusM
  • Members
  • 460 messages

the include scripts *should* have an error stating they don't have a main. because... they're not supposed to. and the compiler isn't smart enough to know they are includes, not standalone scripts.


This is correct. Basically, when you include a script it just takes the whole script and pastes it at the top, like you've written one long script. One script should only ever have one main function. When you try to compile a header script (a script to be included elsewhere), it will indeed give you an error. But this is okay, because these header scripts are compiled when you compile the script that includes them. They don't need to be compiled on their own.

Jonathon is also correct, forgot to mention that.

The error is a bit odd to reference that script. When you created your plot, did you duplicate it from an existing plot?

It might be helpful for you to post the whole script.

Modifié par FergusM, 05 septembre 2010 - 10:18 .


#9
TimelordDC

TimelordDC
  • Members
  • 923 messages
If you duplicated your plot from an existing one, you will have a big problem. Read this

#10
0x30A88

0x30A88
  • Members
  • 1 081 messages
I did not duplicate it, I just made a plot called background_check with four flags. HERO_IS_ELVEN, HERO_IS_DWARVEN, HERO_IS_MAGE, HERO_IS_FEMALE for conversations and things among those lines.

The scripts are as follows, the forum has some wierd stuff going on.

mymod_sys_chargen:

#include "bdm_sys_chargen_h"
#include "log_h"

const int CHARGEN_QUICKSTART_QUICK = 0;
const int CHARGEN_QUICKSTART_NORMAL = 1;
const int CHARGEN_QUICKSTART_ADVANCED = 2;

void _RunChargen(int nRace, int nclass, object oChar, int nBackground)
{

Chargen_InitializeCharacter(oChar);
Chargen_SelectGender(oChar,GENDER_MALE);
Chargen_SelectRace(oChar,nRace);
Chargen_SelectCoreclass(oChar,nclass);
Chargen_SelectBackground(oChar, nBackground,FALSE);

int nEquipIdx = Chargen_GetEquipIndex(nRace, nclass, nBackground);
Chargen_InitInventory(oChar,0,nEquipIdx);
Chargen_SpendAttributePoints(oChar,PROPERTY_ATTRIBUTE_STRENGTH, 3,FALSE);
Chargen_SpendAttributePoints(oChar,PROPERTY_ATTRIBUTE_DEXTERITY, 2,FALSE);

}

void main(){
event ev = GetCurrentEvent();
int nEventType = GetEventType(ev);
object oChar = GetEventObject(ev,0);

int nMode;
int nInt0 = GetEventInteger(ev,0);
int nInt1 = GetEventInteger(ev,1);
// -------------------------------------------------------------------------
// Debug Data.
// -------------------------------------------------------------------------
Log_Trace(LOG_CHANNEL_EVENTS_CHARGEN,"bdm_sys_chargen","Chargen Event:" + Log_GetEventNameById (nEventType)
+ " " + ToString(nInt0) + "," + ToString(nInt1), oChar);

int nEventHandled = FALSE;

switch (nEventType)
{
// ----------------------------------------------------------------------
// This fires when the player selects the icon corresponding to any of
// the available backgrounds
//
// nInt0 - Constant BACKGROUND_* integer
// ----------------------------------------------------------------------
case EVENT_TYPE_CHARGEN_SELECT_BACKGROUND: {
int nBackground = nInt0;
// -----------------------------------------------------------------
// Set the background on the player and reinitialize plot flags
// for the background
// -----------------------------------------------------------------
Chargen_InitializeCharacter(oChar,TRUE);
Chargen_SelectGender(oChar,GetCreatureGender(oChar));
Chargen_SelectRace(oChar,GetCreatureRacialType(oChar));
Chargen_SelectCoreclass(oChar,GetCreatureCoreclass(oChar));

bdm_Chargen_SelectBackground(oChar, nBackground, FALSE);
bdm_Chargen_SetupPlotFlags(oChar);

// -----------------------------------------------------------------
// Generate the index into the equipment template 2da and
// then load the starting equipment based on the data returned.
// -----------------------------------------------------------------
int nclass = GetCreatureCoreclass(oChar);
int nRace = GetCreatureRacialType(oChar);
int nEquipIdx = Chargen_GetEquipIndex(nRace, nclass, nBackground);
Chargen_InitInventory(oChar,0,nEquipIdx);
nEventHandled = TRUE;
break;
}
case EVENT_TYPE_CHARGEN_END: {
nMode = nInt0;
int nQuickStart = nInt1;
// 0 - quickstart
// 1 - normal \\\\
// 2 - advanced / treat as the same
Log_Trace(LOG_CHANNEL_CHARACTER,"bdm_sys_chargen","MODE: " + IntToString(nMode)
+ ", Quick Start: " + IntToString(nQuickStart));
if (nMode == CHARGEN_MODE_CREATE && nQuickStart == CHARGEN_QUICKSTART_QUICK){
Log_Trace(LOG_CHANNEL_CHARACTER,"bdm_sys_chargen","Setting default values for player character");

int nRandclass = abs((GetLowResTimer()%3)+1);

if(nRandclass == class_ROGUE || nRandclass == class_WARRIOR)
{
_RunChargen(RACE_HUMAN, nRandclass, oChar, BACKGROUND_GRAYWARDEN);
WR_SetPlotFlag(background_check, HERO_IS_MAGE, FALSE);
}
else // mage
{
_RunChargen(RACE_HUMAN, nRandclass, oChar, BACKGROUND_GRAYWARDEN );
WR_SetPlotFlag(background_check, HERO_IS_MAGE, TRUE);;
}
Chargen_SetNumTactics(oChar);
SetCanLevelUp(oChar,Chargen_HasPointsToSpend(oChar));
SendEventModuleChargenDone("", "");
nEventHandled = TRUE;
}
break;
}
} //end switch

if (!nEventHandled){
HandleEvent(ev, R"sys_chargen.ncs");
}
}









bdm_sys_chargen_h

#include "sys_chargen_h"
#include "wrappers_h"
#include "plt_background_check"

void bdm_Chargen_SelectBackground(object oChar, int nBackground, int bUnApply, int nRace, int nGender = FALSE)
{
Log_Chargen("bdm_Chargen_SelectBackground","-- " + (bUnApply?"Un":"") +"Selecting BG: " + ToString(nBackground),oChar);
// -------------------------------------------------------------------------
// 1. Set the background variable
// - Create creature property (or check what we used so far
// - We don't set backgrounds on non player generated chars.
// -------------------------------------------------------------------------
if (bUnApply)
{
SetCreatureProperty(oChar, PROPERTY_SIMPLE_BACKGROUND, 0.0, PROPERTY_VALUE_BASE);
}
else
{
SetCreatureProperty(oChar, PROPERTY_SIMPLE_BACKGROUND, IntToFloat(nBackground), PROPERTY_VALUE_BASE);
}
// -------------------------------------------------------------------------
// 2. Give one skill
// - retrieve the skill that is granted by the background from backgrounds.xls
// - give it to the player.
// -------------------------------------------------------------------------
int nAbility = ChargenGetBackgroundSkill(GetCreatureRacialType(oChar), nBackground);
if (nAbility)
{
_AddAbility (oChar, nAbility, bUnApply);
}
}

void bdm_Chargen_SetupPlotFlags(object oChar)
{
int nRace = GetCreatureRacialType(oChar);
int nBackground = GetPlayerBackground(oChar);
int nGender = GetCreatureGender(oChar);

Log_Trace(LOG_CHANNEL_CHARACTER,"bdm_sys_chargen_h","Setting plot flags, race: "
+ IntToString(nRace) + ", background: " + IntToString(nBackground));

// First, init all flags (debug setup)
WR_SetPlotFlag(plt_background_check, HERO_IS_ELVEN,FALSE);
WR_SetPlotFlag(plt_background_check, HERO_IS_DWARVEN,FALSE);
WR_SetPlotFlag(plt_background_check, HERO_IS_FEMALE,FALSE);

switch (nBackground)
{
case 1:
{
switch(nRace)
{
case RACE_DWARF: WR_SetPlotFlag(plt_background_check,HERO_IS_DWARVEN ,TRUE); break;
case RACE_ELF: WR_SetPlotFlag(plt_background_check, HERO_IS_ELVEN,TRUE); break;
}
break;
switch(nGender)
{
case GENDER_FEMALE: WR_SetPlotFlag(plt_background_check, HERO_IS_FEMALE,TRUE); break;
}
break;
}
}
}

Modifié par Gisle Aune, 06 septembre 2010 - 06:33 .


#11
Proleric

Proleric
  • Members
  • 2 343 messages
WR_SetPlotFlag(PLT_BACKGROUND_CHECK, HERO_IS_MAGE, FALSE);


#12
0x30A88

0x30A88
  • Members
  • 1 081 messages
^Thank you, capitalizing the plt_background_check actually fixed the error, it revealed another error however.

EDIT:  The caracter generator shows only the warrior template, but unchanged for class, gender and race, but dissappears when selecting background.
EDIT2: Fixed, but it still shows all the six backgrounds with their respective names and icons, eventhough I removed all but one in the 2DA files.

Modifié par Gisle Aune, 06 septembre 2010 - 03:25 .


#13
Proleric

Proleric
  • Members
  • 2 343 messages
In this case, you need to override the 2DA, rather than extend it with an M2DA. Also, the 2DA tables have to be very consistent about which race-class-background combinations are allowed. If you can't see an error, perhaps you could post your tables here.

#14
0x30A88

0x30A88
  • Members
  • 1 081 messages
Here's the 2DA.
http://dl.dropbox.co...backgrounds.xls

What's the difference in making a 2DA to making a M2DA? I newer saw that option anywhere.

Modifié par Gisle Aune, 06 septembre 2010 - 05:57 .


#15
ladydesire

ladydesire
  • Members
  • 1 928 messages
If you have the Awakening Expansion, you could extract the required 2da files from that, since it does exactly what you're wanting to do. It's also a good example of an M2DA in action.

#16
Proleric

Proleric
  • Members
  • 2 343 messages
I can't immediately see anything wrong with your 2DA. Can you see your custom Gray Warden description for origin #1, or do all 6 origins have their original names? If the latter, the problem is that you haven't generated the GDA file in your module override folder.

You seem to be using a 2DA rather than an M2DA, which is fine.

#17
0x30A88

0x30A88
  • Members
  • 1 081 messages
It's in.

\\module\\override\\



It loads my templates correctly and that .GDA file is in the same folder.

#18
Proleric

Proleric
  • Members
  • 2 343 messages
You should have six GDA files in module override, corresponding to the six active sheets in the spreadsheet. Maybe worth generating the GDA files in that folder again, in case one of them is out of date.

#19
0x30A88

0x30A88
  • Members
  • 1 081 messages

Proleric1 wrote...

You should have six GDA files in module override, corresponding to the six active sheets in the spreadsheet. Maybe worth
generating the GDA files in that folder again, in case one of them is out of date.


I tried that, they are all in the right folder... might there be something wrong in the scripts?

.

Modifié par Gisle Aune, 07 septembre 2010 - 02:45 .


#20
ladydesire

ladydesire
  • Members
  • 1 928 messages
It's not the scripts; try putting the gda files in core/override instead of module/override. I believe I remember one of the developers saying that files intended to replace core game functions had to be in the core/override folder.

#21
0x30A88

0x30A88
  • Members
  • 1 081 messages
^I doesn't change anything, let alone the tutorial says I never should put anything like that in the core\\override\\, for it will affect the SP campaign and other modules.

#22
Proleric

Proleric
  • Members
  • 2 343 messages
I have this working in the module override folder. Are all six backgrounds exactly like the OC? Or do you see your custom background plus five you don't want?

#23
0x30A88

0x30A88
  • Members
  • 1 081 messages
All the six backgrounds from the original campaign. Noone of mine.

Maybe you can find the sinner within those scripts.
mymod_core: dl.dropbox.com/u/4076848/mymod_core.txt
mymod_sys_chargen: dl.dropbox.com/u/4076848/mymod_sys_chargen.txt
bdm_sys_chargen_h: dl.dropbox.com/u/4076848/bdm_sys_chargen_h.txt

Modifié par Gisle Aune, 07 septembre 2010 - 06:08 .


#24
Proleric

Proleric
  • Members
  • 2 343 messages
Since none of your backgrounds are showing up, the most likely issue is that your GDA files are not overriding the defaults.

Although you've already checked the basics, it's worth double-checking that your GDA files are in the correct module override folder and have the same names as the sheets in the Excel file.

You can check the contents of your GDA files using File > Open File in the toolset. The data is in the fields under G2DA_ROW_LIST. Ensure that they all contain your custom content.

If you like, you can verify what DAO can actually see in game, using the GetM2DA family of functions.

Next thing to check is that there are no other overrides for these GDA files in a higher-priority folder. Some other mod may have put something in your packages override folders (there's one in Documents and another in Program Files) or in its core override folder.

If all else fails, try commenting out the "default" section of your module script. That will force DAO to use the standard character generation scripts, which certainly work with this approach.

#25
0x30A88

0x30A88
  • Members
  • 1 081 messages
EDIT: Turns out it was the Tevinter Warden mod that overrode my backgrounds settings.

Modifié par Gisle Aune, 08 septembre 2010 - 12:47 .