Jump to content

Making NPC's more reactive to murder


Rippy

Recommended Posts

To begin, I'll just say that I have no scripting or modding experience in Fallout 3, though I've got a few years of programming experience. I've got a pretty simple idea that I don't think anyone's come up with yet, so I'm thinking maybe it's something I can figure out how to do myself. I've got several weeks before school starts and I need something to do, why not learn a little modding :P

 

So basically, I was wondering how difficult it would be to do a few of these things, and if someone could maybe point me in the direction of commands or tutorials that would be relevant. I'm looking for tutorials myself, but there aren't really a lot of scripting tutorials around I find...

 

So anyway, here's what I'm wanting to do:

 

1. Make NPCs go on alert when they see another NPC's corpse

2. Make death-alerted NPCs target the player under certain circumstances (hadn't figured out what... maybe if the player is close to the corpse when they became alerted)

3. Make NPCs dislike suspicious actions in "safe" areas (i.e. indoors, in houses), such as sneaking, having your weapon drawn, and particularly aiming a drawn weapon at them.

 

I'm thinking if anything is out of my reach, it'd be #1, because I don't believe there's any built-in mechanism for detecting when a person sees a body, is there? (Wait, the Wasteland Travelers mod makes enemies loot nearby corpses, maybe it is less trouble than I think?) #2, provided I could accomplish #1, would probably be fairly straightforward, and I'm thinking #3 would be too provided I could dig up the relevant commands.

 

Anyone have any tips or suggestions? I'm sure someone else could probably whip this up in an evening, but I'd like to try my hand at it myself, but it seems like the G.E.C.K. is kinda new and low on documentation. Would I have better luck looking up all this under Elder Scrolls tutorials?

 

Anyway, any help is appreciated, hopefully I'm not being too much of a bother. Thanks!

 

Rippy

Link to comment
Share on other sites

i believe corpses are not seperate entities but just regular player actors that have less than 0hp either total or on one of their limbs (dismembered).

 

So you might have to write a script that does a check for any NPC actors with less than 0hp, (considered dead)... then some scripts of appropriate reaction (freakout/flee/alarm/etc)

 

As far as 'what NPC's can see.. im not exactly sure but i know that NPCs use radii for some things, Aggression, Awareness etc. You can probably tie it directly to that.

 

 

Check out the FOSE (fallout script extender) for some info on some of the extended GECK commands that it can unlock for your scripts.

http://fose.silverlock.org/fose_command_doc.html

(get fose here:http://fose.silverlock.org/)

 

Also reccomended is to grab the GECK code language extension for Notepad++. Im no programmer, but whenever i have to do scripting, that plugin really helps. Color codes and style-codes all the text to make it easier to read! (That download is located in the nexus downloads area too look up Notepad)

Link to comment
Share on other sites

To answer your question... no. Is it possible? Of course. You might need to come up with some identical voice actors though, because all I know is the "You killed him!" and "You're a murderer!" dialogue which wouldn't make much sense unless they were calling the dead body a murderer. You say you have been programming which could be a plus, but just start screwing around with the GECK Functions page and vanilla scripts. It will eventually make sense. :biggrin:
Link to comment
Share on other sites

Thanks for all the help, guys.

 

Another quick question: I've been looking through function lists like crazy trying to find a way to test whether a player's weapon is drawn. Anyone know what I can use? It's a pain to try to look up these things, hah... (though I assure you I have been looking all over)

 

(I'm starting by just trying to alter NPCs' behavior towards the player when the player's weapon is drawn near them, or pointed at them. I figure that's easier to start)

Link to comment
Share on other sites

Crap, I should've found that... >_> sorry

 

Well I have another problem that is probably condescendingly easy. I figured out how to write a script to do what I want it to, had to figure out how to use FOSE functions and everything, but I can't... get it to run. It's supposed to affect the player at all times. I got as far as creating a Base Effect with the script attached to it, and an Actor Effect which uses that Base Effect, but I must be doing something wrong. I've checked off "Script Effect Always Applies" and "PC Start Effect" because they both sounded necessary, but I still can't get the script to be run (I have a debug message in there so I'll know when it runs).

 

I've found all kinds of info on how to apply Quest effects and such, but it seems there are no tutorials (that I've found) which show how to apply an effect that is not attached to a quest or object. You'd think it'd be easier o_O

 

Anyway thanks for the patience and such, I hope it's okay that I use this thread to post a question once in a while, considering there's no misc. questions thread?

Link to comment
Share on other sites

Crap, I should've found that... >_> sorry

 

Well I have another problem that is probably condescendingly easy. I figured out how to write a script to do what I want it to, had to figure out how to use FOSE functions and everything, but I can't... get it to run. It's supposed to affect the player at all times. I got as far as creating a Base Effect with the script attached to it, and an Actor Effect which uses that Base Effect, but I must be doing something wrong. I've checked off "Script Effect Always Applies" and "PC Start Effect" because they both sounded necessary, but I still can't get the script to be run (I have a debug message in there so I'll know when it runs).

 

I've found all kinds of info on how to apply Quest effects and such, but it seems there are no tutorials (that I've found) which show how to apply an effect that is not attached to a quest or object. You'd think it'd be easier o_O

 

Anyway thanks for the patience and such, I hope it's okay that I use this thread to post a question once in a while, considering there's no misc. questions thread?

 

In oblivion, I believe the proper way to do this would be to make the script a quest script. Just make it non visible to the player. I think.

Link to comment
Share on other sites

Yes that did it. It does mean I have to specify a delay for the script (which is why I shied away from quest scripts), but it works.

 

I'm trying to modify the spread of the player's currently equipped weapon now, and am having some difficulties. This is the script I have so far:

 

scn RapidFireInaccuracy

ref curwep
float wepspread
int TimeSinceFired

begin GameMode

if player.IsWeaponOut == 0
	RETURN
else
	set curwep to player.geteqobj 5
	set wepspread to getspread curwep

	if TimeSinceFired < 100
		set TimeSinceFired to TimeSinceFired + 1
	elseif TimeSinceFired == 100
		set TimeSinceFired to TimeSinceFired + 1
		set wepspread to wepspread - 3
	else
	;if the player is firing their weapon
		if IsPlayerActionActive 3
			set TimeSinceFired to 0
			ShowMessage WepSpreadMsg wepspread
			set wepspread to wepspread + 3
		endif
	endif

	setspread wepspread curwep
endif
end

It's a bit poorly commented since it's a WIP. But basically it's supposed to modify the weapon's spread by 3 for 1 second after the player has fired, and then bring it back to normal. The issue is that I can't find the reference for the player's weapon. The problem is on line 12, with geteqobj. When my debug message pops up, it gives a value of 0 for the weapon spread, so it's clearly not getting the weapon correctly. FOSE docs say 5 is the weapon value; I tried 4 (right arm) too and got no difference.

 

I must be doing something wrong.

Link to comment
Share on other sites

Index 5 is the weapon, and you can verify that it does work by typing it in console mode while playing the game.

 

The problem you're having is in your use of IsPlayerActionActive, where you seem to assume that this will return 0 the moment you stop firing a weapon. However, if you read the Notes, you will see that this is not the case. Firing has some weird persistence associated with it that you need to code around. Maybe what you should do instead is the FOSE "IsControlPressed 4".

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...