Aller au contenu

Photo

Confused... ?? Scripts! (Solved)


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

#1
motherxofx2

motherxofx2
  • Members
  • 29 messages
I am trying to add a new NPC into the Circle Origins. When the player first awakes after Harrowing and talks to Jowan, right after that in the next room I want to place the NPC. I have the following files created...
  • Creature
  • Plot for Codex
  • Quest Plot with plot flags: CREATED_XXX, QUEST_ACCEPTED, REWARD RECIEVED
  • Dialog
  • Stage
  • 1 Script
The script is linked to the Quest Plot flag CREATED_XXX along with the PRCSCR.gda file. But the NPC is not showing up. On top of that, I don't know exactly where to begin on writing the script for the Codex Plot. I am trying to learn scripting, but its hard when I'm teaching myself. I have had some help, which has helped a lot. This is the script I have set up for the Quest Plot and as the module script.

#include "events_h"
#include "plt_gen00q_quest_xxx"
#include "wrappers_h"

void main()
{
  
    if (WR_GetPlotFlag(PLT_GEN00Q_MEETISA_MCI, CREATED_XXX) == FALSE)
    {
        object oTown = GetObjectByTag("bhm100ar_tower_level_1");
        vector vJobloLocation = Vector(33.6639f, 15.9487f, -0.0084954f);
       
CreateObject(
            OBJECT_TYPE_CREATURE,
            R"c_isabel_0.utc",
            Location(oTown, vJobloLocation, 124.8f)
        );

        WR_SetPlotFlag(PLT_GEN00Q_QUEST_XXX, CREATED_XXX, TRUE);

    }

}


If anyone can help, it would be greatly appreciated. Thanks!

Modifié par motherxofx2, 04 octobre 2012 - 03:59 .


#2
MerAnne

MerAnne
  • Members
  • 1 157 messages
I'm kind of under the weather (ok, not kind of) so I don't have too many brain cells firing right now. I'll get back to you in a few days if someone else hasn't helped before then.

The first thing I would do is to remove (comment out, I don't delete until I've found a solution) everything that isn't directly related to placing the NPC. For me, Step 1 is to get something functional - Step 2 is to add the pretty stuff like the PRCSCR file and updating flags.

And I always suggest something easy to start with. I started by creating 2 little mods that I haven't shared because something similar is already available. I placed a container in each Origin with equipment in it for the future GW and I added storage to camp (learned to use a PRCSCR.gda file). Neither mod is 'all that', but they taught me a few basics.

and I'll get back to you (if no one else has) once I have 1 or 2 brain cells functioning again.

#3
motherxofx2

motherxofx2
  • Members
  • 29 messages
Alright. Thanks! And I hope you feel better soon. It stinks to be sick!

#4
MerAnne

MerAnne
  • Members
  • 1 157 messages
I'm at work so I can't look at the toolset or DAO for exact terminology, but let's start easy.

Check the list of downloads and standalone campaigns. Which list does your mod name appear in?

#5
motherxofx2

motherxofx2
  • Members
  • 29 messages
It appears in the DOWNLOADS as it should.

#6
MerAnne

MerAnne
  • Members
  • 1 157 messages
hey, I've made that mistake often enough so it is always the first thing that I check now. ;-) Next thing to check, are all of the files/scripts identified as belonging to your mod?

I don't use the syntax that you do for location, but if all else fails, I'll send an example of a script that works on the second level of the Mage's Tower for the Mage Origin.

#7
motherxofx2

motherxofx2
  • Members
  • 29 messages
I changed some things around such as CREATED_XXX was on the plot as flag #2 so I moved them around in the order I need... CREATED_XXX #0, QUEST_ACCEPTED #1, REWARD_RECEIVED #2. I ran the game again, and she is there, with the ending quest thing over her head (shouldn't be that, should be ! over head) and it looks like there is about 10 of her standing there. And you can't click on her to engange the dialog.

Modifié par motherxofx2, 02 octobre 2012 - 04:29 .


#8
motherxofx2

motherxofx2
  • Members
  • 29 messages
Ahh, I see the problem... when I changed the names around, I didn't change the other values in the field. I need to change those too.

#9
MerAnne

MerAnne
  • Members
  • 1 157 messages
To make sure that there is only one of her, you need to check the condition IsObjectValid (that MAY be the name) so that it doesn't continue to create more and more versions of her.

Did you associate a conversation/dialogue with her AND export both the conversation file and the creature/utc file?

If you get her to level up correctly, keep me posted. I'm having a disagreement with leveling and gda files ;-)

#10
motherxofx2

motherxofx2
  • Members
  • 29 messages
And nothing worked. Its still showing up as I said...

#11
motherxofx2

motherxofx2
  • Members
  • 29 messages
This is the script...

// this is the name of a precreated plot file "joblos_quest" prefixed with the special "plt_"
// "plt_" + quest name allows you to reference the flag names as constants.
#include "events_h"
#include "plt_gen00q_meetisa_mci"
#include "wrappers_h"

void main()
{
//Check whether we've added Joblo already.
if (WR_GetPlotFlag(PLT_GEN00Q_MEETISA_MCI, CREATED_ISABEL) == FALSE)
{
object oTown = GetObjectByTag("bhm100ar_tower_level_1"); //An area's tag is the same as its resource name
vector vJobloLocation = Vector(33.6639f, 15.9487f, -0.0084954f); // See below for how to get these coordinates

CreateObject(
OBJECT_TYPE_CREATURE,
R"c_isabel_0.utc",
Location(oTown, vJobloLocation, 124.8f) //See below for how to get the value for orientation
); //this semicolom was missing and caused errors

WR_SetPlotFlag(PLT_GEN00Q_MEETISA_MCI, CREATED_ISABEL, TRUE);

}

}


And yes, everytime I test, I export all files within the folder that belongs to the module... "Export without", Manifest, Module xml, and talk tables. The whole works.

Modifié par motherxofx2, 02 octobre 2012 - 04:51 .


#12
motherxofx2

motherxofx2
  • Members
  • 29 messages
Ok when I try to export the creature, this "!" come ups...

W: 12:58:38 - c_isabel_0.utc - Could not get sound set for the character .


Could that be causing something to missfire?

Modifié par motherxofx2, 02 octobre 2012 - 05:00 .


#13
MerAnne

MerAnne
  • Members
  • 1 157 messages
The script should go something like:

If (!IsObjectValid(c_isabel_0.utc)) CreateObject(blahblahblah);

You don't need to set a plot flag indicating that you created Isabel if you use IsObjectValid.

Leaving for home, but don't know when I'll be home and logged on. Co-workers just agreed I sound and look sick. yippee for me :-(

#14
motherxofx2

motherxofx2
  • Members
  • 29 messages
Aww poor thing. No big deal hun. Thanks for the help. I will try to create the script for the IsObjectValid. If you don't get back on, no worries. My little girl has strep so, I wouldn't expect you to do that. Just get you some rest! :)

#15
MerAnne

MerAnne
  • Members
  • 1 157 messages
object Dwarf1 = UT_GetNearestObjectByTag(oPC, "merd_dwarf1");
If (!IsObjectValid(oDwarf1))
{
location variable = yada yada;
CreateObject(Object_Type_Creature,R"merd_dwarf1.utc", location);
}


I typed this so there could be typos and, of course, there is some additional text around it. But checking IsObjectValid is how I make sure that the creature/NPC is created once and only once in that location.

And this is going to sound very strange, but I've had problems with ==FALSE I have much more luck with != TRUE and the best luck with == TRUE. I have no idea why it matters which order the statement is written although I suspect that there are actually three values for plot flags - TRUE, FALSE, and Not Set.

#16
motherxofx2

motherxofx2
  • Members
  • 29 messages
Thanks! I started over and just created the character and was trying to create a script just to make her appear. And I have had no luck putting together a script without a plot. My mistake was trying to do it all at once instead of one thing at a time. It is better to do one thing at a time to make sure it is working. And, the reason for doing it all at once was since I had done most of the tutorial, I thought I knew it all... Learned the hard way that I was wrong lol. My main problem is scripting. I know how to create everything and how I want things to work, just don't know how to put it in script language. But I am learning, that is my main goal.

#17
motherxofx2

motherxofx2
  • Members
  • 29 messages
Ok, I tried configuring this script using your example and the notes the toolset gives. When I saved it this error comes up:

E: 18:36:02 - c_isabel_0.nss - c_isabel_0.nss(2): Invalid declaration type


and this is the script I wrote:

object c_isabel_0 = UT_GetNearestObjectByTag(oPC, "c_isabel_0");
If (!IsObjectValid("c_isabel_0"))
{
location Location (object oArea(bhm100ar_tower_level_1)
vector vPosition(33.4771,16.1135,-0.0084954)
float fAngle(98.2f)
)
object CreateObject(
int nObjectType (Object_Type_Creature)
R"c_isabel_0.utc",
location lLoc(33.4771,16.1135,-0.0084954)
);
}



#18
Karma

Karma
  • Members
  • 391 messages
The sound set error will not cause any problems in the scripting. If you really felt it necessary, you could temporarily assign Isabel a generic character file with a generic sound set.

The following is a very simple spawning script that you can set up using the PRCSCR method described in the wiki.
___________________________________________________

#include "utility_h"
#include "wrappers_h"
#include "plt_gen00q_meetisa_mci"

void main()
{
   object oArea = GetObjectByTag("bhm100ar_tower_level_1");
   vector vLocation = Vector(33.4771f, 16.1135f, -0.0084954f);
   
if (WR_GetPlotFlag(PLT_GEN00Q_MEETISA_MCI, CREATED_ISABEL) == FALSE)
   {
       CreateObject(OBJECT_TYPE_CREATURE, R"c_isabel_0.utc", Location(oArea, vLocation, 0.0f)); //change 0.0f to the orientation angle you found
       WR_SetPlotFlag(PLT_GEN00Q_MEETISA_MCI, CREATED_ISABEL, TRUE);
   }
}
___________________________________________________


If you like the IsObjectValid() function better than the plot flag method, you could use:
___________________________________________________
#include "utility_h"
#include "wrappers_h"

void main()
{
   object oArea = GetObjectByTag("bhm100ar_tower_level_1");
   vector vLocation = Vector(33.4771f, 16.1135f, -0.0084954f);
   
if (IsObjectValid(GetObjectByTag("c_isabel_0")) == FALSE)
   {
       CreateObject(OBJECT_TYPE_CREATURE, R"c_isabel_0.utc", Location(oArea, vLocation, 0.0f)); //change 0.0f to the orientation angle you found
   }
}
___________________________________________________

Modifié par satans_karma, 03 octobre 2012 - 12:03 .


#19
motherxofx2

motherxofx2
  • Members
  • 29 messages
Oh wow Karma lol. Thanks! That is crazy! I did that way wrong! I forgot the #includes and put extra words in there that didn't need to be. Plus I didn't do the TRUE/FALSE thing. Geez. I will get this eventually guys, I promise lol. The thing is, with the plot script, I kept having her appear (even if it was my first time into the area) looking like 10 of her standing there. It made since what you were telling me about the multiple times of coming into the area and her spawning every time... but it still happened that way the first time. That's what didn't make since.

Modifié par motherxofx2, 03 octobre 2012 - 01:07 .


#20
motherxofx2

motherxofx2
  • Members
  • 29 messages
Ok, I'm getting frustrated. It is, for some reason now showing up with a ! over her head and it still looks like there are 10 of her standing there. I do believe I may give up on this part of my mod for now. I think I can come back and add it in later... Before I get real upset and quit the whole thing lol.

Modifié par motherxofx2, 03 octobre 2012 - 02:02 .


#21
Karma

Karma
  • Members
  • 391 messages
Could it be that you are loading an old save game with the ten of her standing there already?

#22
motherxofx2

motherxofx2
  • Members
  • 29 messages
Nope... brand new game. Brand new character, new name, everything. IDK what's going on or what I'm doing wrong. Maybe its something in the Module properties? I haven't a clue.

#23
MerAnne

MerAnne
  • Members
  • 1 157 messages
I'm only up to make more tea and go back to bed so....

Check the utc file, isn't there something there to identify the creature as a Quest Giver? I truly don't remember.

But my suggestion is really to start with something easier than adding a quest and a new Companion/NPC. My first mod was to add items to the GW's inventory. I then rewrote that logic to create containers/chests for the GWs to find in their specific Origins. My second mod taught me to use PRCSCR files. Probably not WELL, but at least the basic concept. In my second mod, I added storage to the main camp. Nothing fancy, but it taught me a little more about scripting. Since your goal is to add NPCs and Quests, I would suggest that the next step is creating a Quest and not worry about adding a NPC as a Companion.

By the time you've done those easier mods (or something similar), you should know the basics of scripting. There will be a LOT of details left to learn, but at least you'll have a foundation to build on.

Taking my tea and going back to bed/book and then more sleep.

#24
motherxofx2

motherxofx2
  • Members
  • 29 messages
Thank you.

#25
MerAnne

MerAnne
  • Members
  • 1 157 messages
Going to rewrite - POSSIBLY more lucid, but probably not.

I always suggest starting with a small project to learn with, get some knowledge of scripting and get the 'warm and fuzzy' that comes from success. Tutorials (doesn't matter where) always make everything look so easy. Because the person who created the tutorial has already made his/her mistakes and knows how to do it, they just show successful completion of the project. They don't show all of the mistakes that it took for them to learn the process.

From creating an Origin specific container and items, I learned to use plot flags that are a part of the vanilla game, I learned to place a container, I learned how to have that container show up once and only once, and probably a whole bunch of things that I don't even remember now. And in the end, I had equipment for my new GWs that was specific to his/her origin. (This 'mod' originally placed items directly in the backpack, but I consider there to be shortcomings to that process so I decided on placeables/containers.)

By creating camp storage, I learned more about location, how to make a placeble/container re-useable (i.e. after you have removed the original items, it can be re-used for storage), and how to use PRCSCR files. In the end, I had camp storage so my GW could store equipment for future use.

Even with rewrites and not clearly understanding the tutorials, it only took a week or two to complete each project. Oh, and probably another week to polish and make it all pretty because I'm that way. Nothing fancy, but it taught me the bare basics of scripting with the DAO toolset. At this point, you are having problems with the concepts that I learned from the little projects that could be 'quickly' completed and gave me some features that I wanted. And they gave me the warm and fuzzy that I could create/finish a mod in the toolset. How long before you go from being 'confused' to being 'frustrated'? And once you hit 'frustrated' what point is there in continuing to write scripts as a hobby when the only repayment is frustration?

So my suggestion is to go back and start with a small project that is 'easily' achievable. Storage in camp or add items to the Origins (or Ostagar) or something else that is important to you.