Aller au contenu

Photo

Spawning Companions - INVALID DECLARATION TYPE


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

#1
Nasher_AOB

Nasher_AOB
  • Members
  • 35 messages
 Hey guys,

I'm trying to spawn a companion in my campaign but I've having a hard time trying to figure out what's wrong with these scripts. I'm new to this and I'm following the guide about companions wrote by ColorsFade, without sucess.

These are my scripts (Thanks Kamal)

http://pastebin.com/Zct7P8qk

ERROR: Invalid Declaration Type.

http://pastebin.com/DwpyNUBA

This one compiles.

http://pastebin.com/BiD5dU0Z

ERROR: Invalid Declaration Type.

Can anyone point why these scripts are not compiling? Thanks!

Modifié par Nasher_AOB, 20 janvier 2014 - 01:10 .


#2
kamal_

kamal_
  • Members
  • 5 254 messages
http://pastebin.com/ It will allow you to provide a link that has the script in proper script format instead of the mess that these forums do.

#3
Nasher_AOB

Nasher_AOB
  • Members
  • 35 messages
Thanks Kamal. Just for quick reference about the first script, I just add these following lines under SetGlobalInt(VAR_CAMPAIGN_SETUP_FLAG, TRUE );


// Setup all Companions
InitializeCompanions()

Modifié par Nasher_AOB, 20 janvier 2014 - 01:09 .


#4
andysks

andysks
  • Members
  • 1 651 messages
Hi there Nasher. You don't include your library to the scripts. Example, if your script that is initializing juntado is called initialize_me, then your k_mod_load, which should be named somehow else, should have #include "initialize_me" there on the top. Same goes for the spawn script. You need to include the library, so that the script knows what it's searching for.

Andy.

Edit: To clarify about what I said about the script named somehow else, scripts taken from the OC folders, is generally better to be renamed before usage. Maybe my opinion, I don't know how others use them. But the guide you read will tell you the same.

Modifié par andysks, 20 janvier 2014 - 02:18 .


#5
Nasher_AOB

Nasher_AOB
  • Members
  • 35 messages
Hey andy,

Thanks for that. But both scripts still does not compiles.

The script that initialize juntado is called d_ginc_party. I included this in both scripts dk_mod_load and client_enter_area1 (#include "d_ginc_party" on top), but both aren't compiling. They show the same errors before (invalid declaration type).

As a side note, when I try to compile dk_mod_load script it shows "kinc_cohort.nss(1): error invalid declaration type. I'm sure I did not change anything in the script, just added the InitializeCompanions() function. The script also does not compile if I remove the InitializeCompanions() function.

#6
kevL

kevL
  • Members
  • 4 070 messages
Looks like you need to change

// Setup all Companions
InitializeCompanions();

to

// Setup all Companions
InitializeCompanion("roster", "character", "resref");
InitializeCompanion("roster", "character", "resref");
InitializeCompanion("roster", "character", "resref");
// etc.

where "roster" is Roster name,
"character" is Character name, and
"resref" is the companion's blueprint.Utc file

Add more as needed. The function InitializeCompanion() is in 'ginc_companion' but seems to be #included via one of the other already #included scripts.


The third script at pastebin looks like all it needs is

#include "ginc_companion"

at the top.


[edit] not sure if you know this, but that function flags initialized companions as "CampaignNPC", which means they won't show on the player's Roster until at some point in your module when you script them,

SetIsRosterMemberCampaignNPC(sRosterName, FALSE);

Modifié par kevL, 20 janvier 2014 - 03:49 .


#7
andysks

andysks
  • Members
  • 1 651 messages
I think they did the same in the OC KevL. I don't remember if I could choose roster members at any time, or only in the sunken flagon. Maybe the script on the door of the sunken flagon does that exactly. Although I haven't really researched it, since in my work I won't have the roster as option. Only talking to them will add them to the party.

#8
kevL

kevL
  • Members
  • 4 070 messages
iirc, The Oc and the expansions do the Roster an interesting way. *all* companions get loaded up as RosterMembers right at the start, and ofc marked as CampaignNPCs so they don't show up in the roster proper.

It means that things can be done to them, spawn them dismiss them whatever, right from the start. Let them hang out invisibly or whatever, but it takes an understanding of how the Roster and its members are manipulated by any number of roster-functions, before a builder could really benefit from doing it that way,

#9
andysks

andysks
  • Members
  • 1 651 messages
It needs a lot of reading through the ginc_companion to get the idea behind it. I had problems in the beginning, but now is all good. All companions are added in the beginning, but will only be visible when I want them. Then, if I tell them go home, they will spawn to the farm I chose as a hangout. I think the guide I published written by Colors covers all these really accurate. So Nasher, if you follow it to the detail your scripts will succeed. One thing that comes to mind now, an idea, is that you are using a copy of the SoZ mod_load. Perhaps there is something more in there preventing the compilation? I couldn't know, since me and Colors both used the MotB script, and the guide is written based on that. But maybe it is something to get you started. If you use the script compiler plug in, it will tell you which line has a problem. Maybe it is on the include, and not the actual script not compiling that has the problem.

#10
kevL

kevL
  • Members
  • 4 070 messages
coolio

#11
ColorsFade

ColorsFade
  • Members
  • 1 270 messages
Nasher,

If you are still having trouble with these scripts, email me. I can probably get them working.

Also, check your main NWN2 directory for empty scripts. Sometimes when the toolset crashes, it will generate some completely empty scripts in your main NWN2 directory (the one under program files). Those scripts somehow get priority, and can make other scripts fail if they are dependent on them.

I make sure, after toolset crashes, or when I have trouble with scripts compiling that I KNOW should compile, to check that directory for blank scripts. Then I delete them. That has saved me a few headaches from time to time.

#12
Nasher_AOB

Nasher_AOB
  • Members
  • 35 messages
Hey ColorsFade, how are you?

I tried to send you a message, but it's asking for "a valid recipient." even when your name is typed correctly. Go figure...

I really appreciate your disposition to help me out with companions and such. I know you’re involved with your own project (that I’m really looking forward, btw), and must be very busy.

I read your guide about companions, but then I noticed that I'm really newbye with scripts, and since your guide isn't for newcomers like me, I felt like I should try other method to make companions work somewhat like I first intended.

I'm now using ga_roster_add_object, ga_roster_party_add and bb_roster_party_remove (by Dick Loraine). The companion joins the party and when removed, she despawn and spawn at the same place, and keeps her inventory.

I really would like to make she goes to a waypoint (inside a tavern, per example) when removed and wait there for the player, but this method does not allow it (or I didn't figured out yet).

Anyway, it's working, but it could be better. Like I said, I really appreciate your help, and if you could help me, man, that would be awesome and I would be in eternal debt.

Thanks again.

PS: I hope you don’t mind my Grammar. English isn’t my first language!

#13
ColorsFade

ColorsFade
  • Members
  • 1 270 messages
New to scripting or not, I would strongly recommend going through the guide and doing companions that way. The designers created the ginc_companion system for specific reasons, and it will allow you to do everything you want to do, including waypoints and hangouts. There are also some caveats for cross-module travel, which is very important.

I'd hate for you to get deep into development of your module and then find out something about a companion doesn't work. So that is why I strongly recommend using the documentation that I wrote and Andy posted.

If you have any questions about it, I am happy to help. Just ask Andy. I walked him through quite a bit of it. It takes some time to understand it all, but it's definitely worth it because it allows you to do whatever you want with companions.

#14
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 598 messages
Nothing wrong with the old way. I'm the "bb" in bb_roster_party_remove. You should be able to spawn the companion at a location that you want using the script by getting the location of a waypoint you want to spawn them at and then respawning them there instead of at their current location. This method of handling companions works fine in multiple module campaigns. I used it in both King's Festival and the Silverwand Sample Campaign.

Regards

Modifié par Kaldor Silverwand, 21 janvier 2014 - 11:50 .


#15
Nasher_AOB

Nasher_AOB
  • Members
  • 35 messages
Hey Kaldor,

I opened your KF campaign and looked the convos, but it seems that every companion is removed and respawned at the same place?

Can you guide me to make my companions respawn where I want them to? Thanks.

ColorsFade,

As soon as I get Kaldor's method fully working, I'll try again your guide, and maybe then you can help me figure out how to do it right. Thanks.

Modifié par Nasher_AOB, 22 janvier 2014 - 03:46 .


#16
Nasher_AOB

Nasher_AOB
  • Members
  • 35 messages
Ok, if you remove your companions with ga_rm_set_hangout and ga_rm_go_to_hangout, the companions are successfully removed and go to whatever hangout you did set, even if it's not in the same area. However, if your hangout WP is located in another module, the companion will disappear for good.

Any thoughts? I'm sure I just need to change a thing or two in those scripts, but I'm that kinda of noob =/