Hi all,
I'm working on my custom companion mod, and at a certain point (and under certain conditions) I'd like the option of having him become hostile at the end of a conversation and fight the PC. I'm having a little trouble figuring out how to do that. First I tried setting the "GEN_OWNER_TURNS_HOSTILE" flag at the conversation (he is the owner), but nothing happened. I figured maybe it wouldn't work by itself since he's in the PC's party, so then I also ran his "firing" script on the node before that. But he always just disappears when fired. I also tried clearing his "IN_PARTY" flag, but that didn't seem to do anything. I tried looking at the other situations where companions become hostile, but can't seem to figure how exactly it happens.
Another quick question, somewhat related: What is the easiest way to have a companion initiate conversation after a certain event has happened? I'm not looking to create a physical trigger -- I'd like the conversation to start automatically when control is (or would be) returned to the player after, for example, the landsmeet.
Any help would be much appreciated!
Making a Companion Hostile/Initiating Conversation
Débuté par
Jonathan Seagull
, nov. 03 2010 09:14
#1
Posté 03 novembre 2010 - 09:14
#2
Posté 03 novembre 2010 - 10:50
For the first one, I am not sure if the default scripts will help you since those were written with the official campaign in mind.
You could write a custom script to do what you want. Or if you can wait a bit, I can give you an example later.
To start a conversation at the end of a cutscene, you will have to go with one of the routes below:
a) call the cutscene with the speaker parameter in CS_LoadCutscene and the conversation will be automatically started at the end of the cutscene
have your own script as the End Script for the cutscene to fire and that script should have a call to UT_Talk with the appropriate parameters.
You could write a custom script to do what you want. Or if you can wait a bit, I can give you an example later.
To start a conversation at the end of a cutscene, you will have to go with one of the routes below:
a) call the cutscene with the speaker parameter in CS_LoadCutscene and the conversation will be automatically started at the end of the cutscene
#3
Posté 03 novembre 2010 - 11:04
#include "wrappers_h"
#include "utility_h"
void main(){
object npc = GetObjectByTag("yourguy'stag");
WR_SetFollowerState(npc,FOLLOWER_STATE_INVALID);
UT_CombatStart(GetHero(),npc);
}
should work.
#include "utility_h"
void main(){
object npc = GetObjectByTag("yourguy'stag");
WR_SetFollowerState(npc,FOLLOWER_STATE_INVALID);
UT_CombatStart(GetHero(),npc);
}
should work.
Modifié par FergusM, 03 novembre 2010 - 11:04 .
#4
Posté 04 novembre 2010 - 12:57
Thanks guys, I'll try those out! Although just to be clear, Timelord, I'm looking to fire these conversations after existing events in the single player campaign. Is there a way to do that without overwriting the original conversations/cutscenes?
Modifié par Jonathan Seagull, 04 novembre 2010 - 03:39 .
#5
Posté 04 novembre 2010 - 03:39
Fergus, your script worked perfectly...except for one problem: he's unkillable. His health bar goes down to nothing (or almost nothing; sometimes a tiny bit of red comes and goes), but he won't die. Also, for a while he would radiate some kind of blue energy cloud every time he was hit, but then that just stopped. I checked his creature properties to make sure he's not immortal or anything, and he has definitely died plenty during combat with enemies.
Although now that I think about it, I guess I don't actually want him to die, anyway. I need a conversation to fire before that happens, so maybe I'll just go ahead and dig up/remember how to do that.
Although now that I think about it, I guess I don't actually want him to die, anyway. I need a conversation to fire before that happens, so maybe I'll just go ahead and dig up/remember how to do that.
Modifié par Jonathan Seagull, 04 novembre 2010 - 03:39 .
#6
Posté 04 novembre 2010 - 04:46
Using WR_SetFollowerState to change a follower's state to INVALID automatically makes that creature immortal. To work around that, you need to add SetImmortal(oCreature, FALSE) before the CombatStart line.
As for the dialog, you can do it in 2 ways -
a) use the surrender system
or
Handle EVENT_TYPE_DAMAGED and initiate conversation (after ending hostility, etc) once health drops below the level you want.
As for the dialog, you can do it in 2 ways -
a) use the surrender system
or
#7
Posté 04 novembre 2010 - 09:29
Two quick issues, which no doubt have obvious solutions:
1) When I add the SetImmortal line in, I get a "variable defined without type" error on that line.
2) For the surrender function(s), would you possibly be able to show me what complete script for that might look like? I'm admittedly still pretty lousy at knowing what to include besides the function itself.
Thanks for all the help so far!
1) When I add the SetImmortal line in, I get a "variable defined without type" error on that line.
2) For the surrender function(s), would you possibly be able to show me what complete script for that might look like? I'm admittedly still pretty lousy at knowing what to include besides the function itself.
Thanks for all the help so far!
#8
Posté 05 novembre 2010 - 04:09
Jonathan Seagull wrote...
1) When I add the SetImmortal line in, I get a "variable defined without type" error on that line.
I can answer this one :happy: You have to include core_h, so add this line at the beginning of your script:
#include "core_h"
#9
Posté 05 novembre 2010 - 04:16
And make sure the oCreature is defined. If not, substitute whatever object you've used to reference the companion.
Another thing to note: If you are going the surrender route, it's advisable to leave them in the Immortal state so that they don't die from a critical hit or something. I haven't used the surrender system myself but this thread might prove useful.
Another thing to note: If you are going the surrender route, it's advisable to leave them in the Immortal state so that they don't die from a critical hit or something. I haven't used the surrender system myself but this thread might prove useful.
#10
Posté 05 novembre 2010 - 09:07
Thanks guys. I had tried including core_h, but I don't think I defined oCreature.
I've already been reading that thread on surrendering. It looks like there are different ways to do it, so I probably just need to experiment and see what works best. Thanks again!
I've already been reading that thread on surrendering. It looks like there are different ways to do it, so I probably just need to experiment and see what works best. Thanks again!





Retour en haut






