Useful Script Templates and Examples Resource

Post » Sat May 28, 2011 10:22 pm

This topic is meant to catalog useful and, many times commonly used, scripts that all of us use. The point of this Index is fold:

1. If someone uses script templates, it is easy to avoid nasty bugs that will screw up everyone's game.
2. The community would have the chance to discuss the best way to implement a feature, because it would all be in one place.
3. Fewer moders would waste time re-inventing the wheel. They would use their productive time to write awsome mods instead!

I am pretty new to Fallout scripting myself, so I do not have many additions yet. I will keep posting any new things I find though!
Please feel free to correct my scripts if needed, or suggest alternate and/or better ways to do it, since I am certain there will be :)

Also, please do not post other people's scripts unless they want you to :flamethrower:

Ok, now to the point:

Current Script Index:

1. Reference-Walking script template, loops, handling NPC inventory and form Lists
2. Detect Cell Change Script (Found a bug, removed for now)
3. NPC Flee Script Effect



The first one is a classic and not mine of course:

Reference-Walking script template, loops, handling NPC inventory and form Lists:
http://www.cipscis.com/fallout/tutorials/loops.aspx

The second is a script I wrote to detect cell change (Requires FOSE):

Detect Cell Change Script




The third is a script effect I wrote with the extremely helpful advice of SaidenStorm. When applied to an NPC, he flees no matter what.

NPC Flee Script Effect:

scn NPCFleeScriptEffectshort actorConfidence short timerbegin ScriptEffectStartset timer to 0set actorConfidence to getAV ConfidencesetAV Confidence 0EVPendBegin ScriptEffectUpdateif timer < 1	set timer to timer + scriptEffectElapsedSecondselse	if (GetCurrentAIProcedure != 16)		setAV confidence 0		EVP	endif	set timer to 0endifEndBegin ScriptEffectFinishsetAV Confidence actorConfidenceEVPend


Well, that's it for now but remember: If you have any useful and difficult scripts to share with the community, either in the form of links, snippets or whole scripts, this is a good place to do it. If any script is added, I will add it to this post with proper credit :)

Finally, let me know what you think of the idea :celebration:
User avatar
Vera Maslar
 
Posts: 3468
Joined: Wed Sep 27, 2006 2:32 pm

Post » Sat May 28, 2011 4:35 pm

Post Reserved.
User avatar
Melanie Steinberg
 
Posts: 3365
Joined: Fri Apr 20, 2007 11:25 pm

Post » Sat May 28, 2011 2:35 pm

Good idea, otm.

There's a page on the GECK Wiki with a similar purpose to this thread; I think it would be a good idea to include useful scripts brought up in this thread on that page - http://geck.gamesas.com/index.php/Useful_Scripts
At the moment, most of the scripts on that page are fairly specific, but I think including more general scripts or segments of code there would be useful.

Another useful script template which I'd like to suggest, that is currently mentioned both on the wiki at the location I just mentioned and on my website, is hotkey detection code. Here's what I've written about it on http://www.cipscis.com/ - http://www.cipscis.com/fallout/tutorials/detecting_keypresses.aspx

JustinOther's 'http://www.fallout3nexus.com/downloads/file.php?id=10903' resource, for FOSE detection, could also be a good thing to mention.

With regard to the script that you've posted that forces an actor to flee, I'm reminded of the http://geck.gamesas.com/index.php/ForceFlee function. I think I remember it not doing anything, but the GECK Wiki doesn't mention that and I don't have Fallout 3 installed at the moment so I can't test it myself. If this is the case, then it would be good to update the wiki's documentation to reflect this fact, and mention the script that you've posted as a useful alternative.

P.S. It's 'http://www.cipscis.com/', not 'http://www.cipsis.com/'. The url that you're using is correct, though.

Cipscis
User avatar
Greg Swan
 
Posts: 3413
Joined: Tue Jun 05, 2007 12:49 am


Return to Fallout 3