Aller au contenu

Photo

I cant get NPCs to turn hostile?


15 réponses à ce sujet

#1
bigrickman

bigrickman
  • Members
  • 31 messages
sorry this is sort of a double post, realised this would be the better forum.
http://social.biowar.../index/431093/1

but anyway i'm trying to get a neutral npc to go hostile from conversation. On paper i'm sure everything is right but its just not working.

i'm using the plot action to trigger GEN_OWNER_TURNS_HOSTILE.

what am i doing wrong?
my whole mod is finished i just need to get this working. :(

#2
Halchek

Halchek
  • Members
  • 36 messages
Have a look at http://social.biowar...Creature_group.



I believe you need to use something like the following in as your script:-



#include "wrappers_h"

#include "sys_rewards_h"



void main()

{

object oNPC = GetObjectByTag("martha");

UT_CombatStart(oNPC, GetHero());

}

#3
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages
Hm, there are a few possibilities I can think of.

1. The creature isn't the owner of the conversation. If you're firing the conversation in an unusual way and manually assigning the speaker tag line by line, the owner in the script may not be the creature.

2. Group hostility isn't being set up properly. The PC group and the hostile group are made hostile to each other in scripting. I don't know exactly where, but it's properly either in module_core, or the custom module script used in the main campaign. If it's the former, make sure you aren't overriding any events and not passing them through to module_core. If it's the later, you're going to need a script somewhere, be it a module script or trigger or whatever, that calls SetGroupHostility(GROUP_HOSTILE, GROUP_PC*, TRUE);

*GROUP_PC might actually be GROUP_PLAYER or GROUP_PARTY or something similar. I'm going from memory.

3. The player isn't in the correct group. Related to the above, if you've got any kind of custom module or player script, it's possible the player isn't being put into the correct group. To verify, you could creature some kind of debug script which checks if (GetGroupId(GetHero()) == GROUP_PC) and outputs the result.

Update: looking at your original post, it seems you are adding-in to the main campaign. That makes possibility 2 and 3 unlikely, unless you aren't testing it within the main campaign.

Modifié par DavidSims, 12 décembre 2009 - 07:52 .


#4
bigrickman

bigrickman
  • Members
  • 31 messages
yeah hence my confusion. It's a single player extension and i'm using no custom scripts.



I've tried creating my own script incase that was the problem and got the same result. (ie. nothing) but as it is i've simply used gen00pt_generic_actions -> SET -> GEN_OWNER_TURNS_HOSTILE under actions with no condition.



Its triggered by conversation with the owner and PC so the object should be set up correctly.

#5
bigrickman

bigrickman
  • Members
  • 31 messages
what am i missing guys?



I compiled the demo mod and its reference to generic actions works and yet my mod doesnt.



how can it be wrong when i'm using unmodified core scripts that work in one mod and then not in mine under the same conditions? =(

#6
Magic

Magic
  • Members
  • 187 messages
Were you already successful? If not, only some debugging will help I fear. Can you get the group IDs of your PC and NPC? Something like

DisplayFloatyMessage(oAttacker, IntToString(GetGroupId(oAttacker)==GROUP_PC));

DisplayFloatyMessage(oTarget, IntToString(GetGroupId(oTarget)==GROUP_PC));

in UT_CombatStart().



If you're willing to do this, you need to make a copy of utility_h.nss, save it, then compile gen00pt_generic_actions.nss. Let's not forget to remove the these modified scripts once the problem is found.

#7
Hammer Fang

Hammer Fang
  • Members
  • 78 messages
I've noticed the same problem in the Demo_Tut for the tool set. Some Npc are suppose to go hostile after you hit a trigger. They don't ....


Something to do with the latest patch maybe? (yes, I'm guessing)



I'm sure the demo_tut has worked as intended at some time in the past .....

#8
Magic

Magic
  • Members
  • 187 messages
Just checked the demo, still working for me. Custom scripts in override maybe?

#9
Hammer Fang

Hammer Fang
  • Members
  • 78 messages
no ... I've religiously empty the override folders, and I haven't played with any scripts, or tried to add/change anything to the single player game.



I have the steam version of DO:A, if that makes a difference. (another problem with long path names?)

#10
Balumpus

Balumpus
  • Members
  • 5 messages
I hope I'm understanding you correctly, but I could never get that to work myself, so I changed my plot script to this:

-------------------------------------------

#include "log_h"
#include "utility_h"
#include "wrappers_h"
#include "plot_h"
#include "plt_yourplot"


int StartingConditional()

{

event eParms = GetCurrentEvent(); // Contains all input parameters

int nType = GetEventType(eParms); // GET or SET call

string strPlot = GetEventString(eParms, 0); // Plot GUID

int nFlag = GetEventInteger(eParms, 1); // The bit flag # being affected

object oParty = GetEventCreator(eParms); // The owner of the plot table for this script

object oConversationOwner = GetEventObject(eParms, 0); // Owner on the conversation, if any

int nResult = FALSE; // used to return value for DEFINED GET events

object oPC = GetHero();

plot_GlobalPlotHandler(eParms); // any global plot operations, including debug info

if(nType == EVENT_TYPE_SET_PLOT) // actions -> normal flags only

{

int nValue = GetEventInteger(eParms, 2); // On SET call, the value about to be written (on a normal SET that should be '1', and on a 'clear' it should be '0')

int nOldValue = GetEventInteger(eParms, 3); // On SET call, the current flag value (can be either 1 or 0 regardless if it's a set or clear event)

// IMPORTANT: The flag value on a SET event is set only AFTER this script finishes running!

switch(nFlag)

{

case MAKE_TEAM_HOSTILE:

{

//This causes all members of the bandit's "team" (the bandit and

//the other bar patrons) to turn hostile. Since they're in the presence

//of the player already, they'll immediately percieve him and initiate

//combat.

UT_TeamGoesHostile(101);

break;

}
}
}
else // EVENT_TYPE_GET_PLOT -> defined conditions only
{
}
plot_OutputDefinedFlag(eParms, nResult);
return nResult;
}

Modifié par Balumpus, 14 décembre 2009 - 01:05 .


#11
Hammer Fang

Hammer Fang
  • Members
  • 78 messages
code snippets ;) always like those ....



but, problem resolved, demo works fine .....



I had d/l a mod from here to see how to give yourself items. some how it's event handler got mixed up with the demo.



I never would have discovered it, but I started going threw every resource directory and found one call 'myspeacialitems'.



gg

#12
bigrickman

bigrickman
  • Members
  • 31 messages
Aha!



I finally got it to work, i didnt realise you had to use the object inspector to assign a script to the plot.



That still doesnt explain why the generic scripts dont work but hey, at least i can just duplicated them now and use my own.



Thanks for the help everyone!

#13
Sonmeister

Sonmeister
  • Members
  • 167 messages
As with the original post on this thread GEN_OWNER_TURNS_HOSTILE wasn't working for me but when I plugged in GEN_TEAM_TURNS_HOSTILE it worked. FYI, for anyone reading this and wanting to try it out.

It wasn't working either because my creature was already set to _hostile.  When I set it to _neutral it worked fine.

Modifié par Sonmeister, 18 avril 2010 - 03:27 .


#14
MOTpoetryION

MOTpoetryION
  • Members
  • 1 214 messages
punch them in the nose its always worked for me :)


#15
ravenlok

ravenlok
  • Members
  • 10 messages
Had the same problem. Generic script worked fine as soon as I manually set the conversation owner to explicitly reference the creature I wanted to go hostile.

#16
ravenlok

ravenlok
  • Members
  • 10 messages
And then two days later that stopped working for no discernible reason. (Manually setting conversation owner to speaker tag, that is.) Switching the flag to GEN_TEAM_TURNS_HOSTILE worked no better than GEN_OWNER_TURNS_HOSTILE.

So if manually setting conversation owner doesn't change NPC to hostile or dead or disappeared (i.e., whatever generic flag you want from gen00pt_generic_actions), try this:

Go into whatever script you are using for your module's base script (the one you set in module properties (in single player it's called module_core)) and add the following include statement:

#include "plt_gen00pt_generic_actions"

Once I added that statement, all of the flags started working when I set them in the conversation tab for "Plots and Scripting".

Hope this helps.

-r

Modifié par ravenlok, 15 juin 2010 - 09:10 .