GhostOfGod wrote...
Not really an objection here Kaldor...but I'm a bit confused. Does GetFirstPC work the same in NWN2 as it does in NWN1?
If I go kill "Goblinoid" the goblin king, why would the first player on the server(and his faction members) get my xp and get credit for killing him?
It is also important to note that GetFirstPC can also return a DM(at least in NWN1). And in the OPs script he is excluding those who are not players.
Kaldor wrote...
unless you are allowing each player to have their own journal, which is normally not the case.
Difference of opinion on this one I guess.
For campaigns/modules that are designed for single-player play, GetFirstPC (which just selects the first PC in the party) will be the same as the main PC in the campaign, and for single-player campaigns/modules the journal is shared. This is not the case for MP play or playing on a PW. If this campaign/module is intended for MP/PW play then using GetFirstPC would not be appropriate.
Seems like there a lot of use cases to test for. At least:
1. Killed by PC still alive
2. Killed by PC now dead
3. Killed by companion still alive and PC owner still alive
4. Killed by companion now dead and PC owner still alive
5. Killed by companion still alive and PC owner now dead
6. Killed by companion now dead and PC owner now dead
7. Repeat 3-6 for henchman
8. Repeat 3-6 for summoned creatures but also include tests if summoned creature is no longer present
Using GetMaster and GetIsPC to remove some of the use cases seems reasonable, especially since only PC's have journals, so in the end you have to select a PC, either living or dead.
In any event though it is a lot of conditions to test for and not easy to simulate. My guess is that most modders do not do this kind of testing and just assume their code will work. And in most cases it probably does.
My campaigns are specifically written by one person (me) and tested by one person (also me). I know that that testing is not going to be sufficient to say for certain that all of my scripts will function correctly in a MP or PW environment. And so I simply state that they are designed for and tested for single-player. If you want to play them MP or PW or with a DM then that can be done, but there may be some issues. Lacking very clear guidance (any really) on scripting practices for MP and PW play, that is all I can do because that is really all I can test. My preference is to code for something that I can test and works in most cases. I think that is better than trying to code something for all cases but cannot really be tested.
If someone well versed in MP/PW scripting would look at my script and say definitively what should be used rather than GetFirstPC so that the script works reliably for both SP and MP/PW usage then I would welcome that advice.
Regards
Modifié par Kaldor Silverwand, 10 mai 2011 - 02:25 .