event type team destroyed
#1
Posté 26 mai 2016 - 08:50
#2
Posté 26 mai 2016 - 09:41
I don't know; I don't think so.
but I found a work around that lets me identify when the fight is over. It isn't something that I would use all the time (requires flag checking), but it can work.
And like your other question, I will probably have to respond with details over the weekend. Perhaps someone else will have a solution before then.
#3
Posté 26 mai 2016 - 10:18
#4
Posté 27 mai 2016 - 02:13
Can you save these questions for Friday night? Makes it a LITTLE more likely that I'll have time to write up the solution.
I had the death of a final member of a party trigger a conversation. You could just as easily set a flag rather than initiating the conversation. My method was...
I duplicated creature_core.nss into a file name specific to my mod; we'll say 'my_creature_core' for the purposes of example. I used my_creature_core to replace the creature_core script in the AI script in the .utc files for the attackers that I created. A simple plot file kept track of how many of the attackers had been killed. So types of files created:
- my_creature_core.nss
- my_attacker_status.plo
- my_attacker1.utc
- my_attacker2.utc
- my_attacker3.utc (as many attackers as desired)
In the my_creature_core.nss file, I added the following script in EVENT_TYPE_DEATH
string sTag = GetTag(OBJECT_SELF); if (sTag == "my_attacker1") WR_SetPlotFlag(PLT_ATTACKER_STATUS, MY_ATTACKER1_DEAD, TRUE); else if (sTag == "my_attacker2") WR_SetPlotFlag(PLT_ATTACKER_STATUS, MY_ATTACKER2_DEAD, TRUE); else if (sTag == "my_attacker3") WR_SetPlotFlag(PLT_ATTACKER_STATUS, MY_ATTACKER3_DEAD, TRUE);
This kept track of which NPCs/attackers had been defeated/killed
if ((WR_GetPlotFlag(PLT_ATTACKER_STATUS, MY_ATTACKER1_DEAD)) &&
(WR_GetPlotFlag(PLT_ATTACKER_STATUS, MY_ATTACKER2_DEAD)) &&
(WR_GetPlotFlag(PLT_ATTACKER_STATUS, MY_ATTACKER3_DEAD)))
{
WR_SetPlotFlag(PLT_ATTACKER_STATUS, MY_ATTACKERS_DEAD_ALL, TRUE);
.
. // Code to position the NPC who initiates the conversation
.
UT_Talk(oNPC, oPC);
}
The point was starting the conversation so I didn't include the multiple lines of code whose only purpose was saying "start conversation here". This section identifies that all of the attackers have been defeated/killed, sets a flag, moves the NPC to the position where the conversation should start, and then starts the conversation (UT_Talk)
Was there a different way to do it? Probably. But this is the solution that I found that didn't require me to change any Core/Single Player resources. It is one of those things that I suggest using in moderation. If multiple modders, did the same thing in the same general area, there would be issues when the conversation(s) triggered.
#5
Posté 27 mai 2016 - 02:14
Those colors are ANNOYING, but they were the colors that the 'code' option provided - ick. I suggest highlighting/selecting the sections of code so that the annoying colors go away.
#6
Posté 27 mai 2016 - 02:43
as for the creature core, great idea! I don't actually want the conversation to take place at fight. the fight happens at lake calenhad and I want the conversation to take place when they return to camp. your way helps keep up with all my creatures tho and is way better than just a flag for entering the area.
#7
Posté 27 mai 2016 - 03:46
Those colors are ANNOYING, but they were the colors that the 'code' option provided - ick. I suggest highlighting/selecting the sections of code so that the annoying colors go away.
It's simple enough to fix. You too can go from this:
if (sTag == "my_attacker1") WR_SetPlotFlag(PLT_ATTACKER_STATUS, MY_ATTACKER1_DEAD, TRUE); else if (sTag == "my_attacker2")To this:
if (sTag == "my_attacker1") WR_SetPlotFlag(PLT_ATTACKER_STATUS, MY_ATTACKER1_DEAD, TRUE); else if (sTag == "my_attacker2")In one easy step!
When you create your code tags, change the code=auto:0 to code=xml:0. If you are just typing it all out manually, do a preview first to generate the full tags.
Bonus round! If you change the tag to code=xml:1, you get line numbers, like so:
if (sTag == "my_attacker1") WR_SetPlotFlag(PLT_ATTACKER_STATUS, MY_ATTACKER1_DEAD, TRUE); else if (sTag == "my_attacker2")
- MerAnne aime ceci
#8
Posté 27 mai 2016 - 08:11
#9
Posté 27 mai 2016 - 09:28
When you create your code tags, change the code=auto:0 to code=xml:0. If you are just typing it all out manually, do a preview first to generate the full tags.
Bonus round! If you change the tag to code=xml:1, you get line numbers, like so:
Thanks!
I'll probably forget before the next time I enter code, but at least now I have something to forget! ![]()
- Lady Honor aime ceci
#10
Posté 29 mai 2016 - 01:53
HA! I knew there was a way to leverage another script rather than copy the whole thing....
HandleEvent(ev, RESOURCE_SCRIPT_AREA_CORE);
This example comes from cam000ar_all_camps.nss If I understand it correctly, it basically says "handle any other events using area_core.nss" Yes, I could have and possibly should have used this statement instead of copying the entire creature_core, but I wanted to get something to work before I tried to do anything fancy.
And I couldn't remember the statement when I was working on my_creature_core ![]()
#11
Posté 29 mai 2016 - 04:16
#12
Posté 29 mai 2016 - 05:21
#13
Posté 29 mai 2016 - 11:10
'team destroyed' - I have not used the team concept because it is not entirely clear (to me anyway) that the teams are specific to one area and there is no list of the teams that exist in the vanilla version of the game. It would have definitely been easier for me to use the 'team destroyed' approach in the Companion Nightmares, but I was afraid of duplicating a team id. That's why I checked to see if each creature in the team had been killed. I can't say that it IS a problem, just that I thought it was less risk if I didn't use team_destroyed.
#14
Posté 29 mai 2016 - 11:36





Retour en haut







