Tutorial - Refwalk Explosions

Post » Mon Aug 16, 2010 7:57 am

One might want to use a "ref walk explosion" because you need to do something to an NPC/creature in a certain area and have no way to know what its REF ID is beforehand. Because you don't know the REF ID you cannot write its name directly into a script. But in this case, you still need to do something to it via script. For example - - maybe you need to do something to all enemies which happen to be in a certain area with the player, or, you want to do something to all followers (not just ones you've got script access to).

And, triggers occasionally completely miss and don't run their "ontriggerenter" code on something which entered the trigger. I've seen that its not a matter of the npc/creature/player passing through it too quickly. They really can totally miss. If your application needs perfect handling of all the nearby npcs/creatures, you won't be using triggers for it.

-

How to make a "ref walk explosion"

Step 1. Decide and create what you want to do to the npc/creature once you've detected it. In this case, I'll assume that you are adding a scripted item to the npc/creature (which I call "mobs" from here on out). The purpose of this item being that it can have script code attached to it which affects the mob in the way you choose.

So, rename an Abraxo Cleaner item (its in category "Misc Item" in the GECK). You do this by single clicking the name as it appears in the "Misc Item" list, and the name will allow you to type in a new one that way. When you hit enter on it, a box will come up asking you about stuff - - tell it to make a new item. For the example I'll call ours MyHappyBoxItem. Then, write yourself an object type script with the script code you want to be run on every REF you've selected with your explosion. Then, CLOSE THE ITEM WINDOW COMPLETELY and reopen it. Your new script should be available to select in the dropdown list.

Basic form of script is below (it is written for clarity not for optimization btw), and the thing I decided to do to each mob is move the NPC to my special Xmarker which is... elsewhere.

Note: always exclude the player from script code like this unless you really mean it to run on him. which in this context, you wouldn't.

scn MyHappyBoxSCRIPTref TheNPCbegin onadd	set TheNPC to GetContainer	if TheNPC == Player		removeme	endif	TheNPC.moveto MyXmarkerSomwhereElseREF	removemeend


Step 2. Create a new script, and set it to type "effect" in the dropdown to the top right of the script window. Make your script have a "scripteffectstart" block which does 2 things. It selects which mobs to do stuff to, and in this case, it is adding our special item. Example is like this - - this happens to detect a typical follower who has not been told to "wait". (Note: always have some condition which excludes the player if you're not trying to add something to him in your explosion. My intended conditions here for a follower happen to do that naturally. If they did not, I would add code similar to what's in the object script earlier).


scn MyExplosionEffectSCRIPTbegin scripteffectstartif getplayerteammate == 1 && getcurrentaipackage != 35 && getcurrentAIpackage != 36	additem MyHappyBoxItem 1endifend



Step 3. Create a new "base effect" in the GECK. Configure it from the top down this way. Pick an ID for it (I'm picking "MyExplosionBaseEffect" as the ID), and for Name just put whatever you want that makes sense, its just for you to see. On the Effect Archetype, you must select "Script" from the list. Then for "Assoc. Item" you pick your effect script's name from the list (in this example it is "MyExplosionEffectSCRIPT"). Then go down to the dropdown boxes and click these boxes only: Self Touch Target No-Duration. Then click okay to finish making it.

Step 4. Create a new "object effect" in the GECK (it is below "Ingestibles" which is right below the other effect types). Configuring it from top down: give it an ID, for this example I'm picking "ENCHMyExplosion". For name, put whatever you want, like before. For the Type dropdown, pick "Weapon". Then, right click the empty list-looking area to the right of that window that says "Effects", and left-click New when it comes up. In that new window called Effect Item, configure from top down: for "Effect" pick "the name of the new "base effect" you made in step 3 (our example one was: "MyExplosionBaseEffect"), for Range pick "Touch", Area is 0, Duration should be greyed out, and magnitude would be 0. (You might notice where its possible to put conditions in here, but I happened to do it in the explosion script itself, either way should work to exclude/include targets I think). When you click "Okay" on that, you should have a line now listed in the formerly-empty "Effects" side of your Object Effect window, and it has your base effect there. Click Okay on that last window to close it out.

Step 5. Go to the "Explosion" item listing in the GECK. Pick yourself an explosion which talks about being "fake", such as "FakeForceBall250", and look at what it has after double-clicking on it. At the top right, be sure it is using "Effects\FXNullExplosionArt.NIF". That "Edit" button next to it is not useful, just use your mouse to scroll the text to the right to see that it's got the right name.

If you found what you want, click cancel, and then, in the main GECK item list, rename it to what you want your explosion to be named, and then select Yes for creating a new object. For this example I'll call mine MyHappyExplosion. Double click on the new explosion that the GECK created for you (wherever it may have landed in the GECK's exploson list), and configure it from top down like this: ID ls already there, for Name pick whatever you care to see, Force is 0, Damage is 0, Radius - - pick how far away you want your refwalk to be able to detect to, 2000 is not a bad choice. IS Radius is 0.0. In the 4 checkboxes, click only Ignore LOS Check and Ignore Imagespace Swap. On the right, select Light as "None", select Enchantment as the object effect you made in step 4 (we had named it "ENCHMyExplosion" for this example). Set everything else below that as None/Silent/Never/ things like that. Then, click okay.

Now, you're done creating your refwalk explosion, but it won't work if you don't use it properly. To make it go off, you are probably going to use a script to do something like this.

player.placeatme MyHappyExplosion


I've been told by Cipscis that using placeatme for explosions does not cause savegame bloat so it's alright to use in this context. Normally you don't go around the wasteland dropping things using placeatme because they don't necessarily clean up well in the savegame,

To use this properly, you should:

- - only blow off your explosion in the vicinity of the player (the "loaded area").

- - once it's blown off, don't move the player immedietely out of the area. Explosions like this seem to take time to get their work done. Use a timer in your script if necessary to force the player to stay where he is for a while, maybe 30 - 60 frames, something like that, I don't know how long is needed for sure.

- - if you are using a scripted item such as the example "MyHappyBoxItem". It may be the case that you are using some "gamemode" code in your item's script instead of just one "onadd" block. Do not move the player out of the loaded area while you're expecting gamemode code on your item to be running. Give all the scripts time to complete their operations (whatever your operations may be). Even if you think you see it work once or twice after moving the player out of the area, don't expect gamemode code to run reliably like that.This is not related to if the mob has "low level processing" enabled. If this doesn't match up well with the process you're making, change the process in a way that causes the mob to be in the loaded area at the critical times.

A note about moveto and refwalk explosions -

don't confuse problems with moveto not doing what you expected with a problem with your refwalk explosion, item scripts, and timing. If you think your refwalk operations are messing up, stop the game at critical times using your console and test for the presence of your item, etc. For example on followers - - some of the caviats regarding moving followers around are seperate from what makes a refwalk explosion work.

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

Hopefully I didn't forget anything or mix up anything in this process. Anyhow, there it is.
User avatar
Laura Hicks
 
Posts: 3395
Joined: Wed Jun 06, 2007 9:21 am

Post » Mon Aug 16, 2010 1:18 am

Thank you for making this Tarrant. :)

Very interesting, I did not know how to do this without FOSE before now (because FOSE made it so easy), its very nice to know how to do it Without FOSE!

One recommendation; enclose yer code in [ code ] tabs will make the distinction between code/description more clear.

Cheers!

Miax
User avatar
Hayley Bristow
 
Posts: 3467
Joined: Tue Oct 31, 2006 12:24 am

Post » Mon Aug 16, 2010 6:29 am


One recommendation; enclose yer code in [ code ] tabs will make the distinction between code/description more clear.


K. Done. It didn't work. :)

Glad you liked the tutorial thingie! Here's to hoping I didn't put something retaarded into it.
User avatar
Matthew Warren
 
Posts: 3463
Joined: Fri Oct 19, 2007 11:37 pm

Post » Mon Aug 16, 2010 4:11 am

One might want to use a "ref walk explosion" because you need to do something to an NPC/creature in a certain area and have no way to know what its REF ID is beforehand. Because you don't know the REF ID you cannot write its name directly into a script. But in this case, you still need to do something to it via script.


Yes! One might want to do this! And, what's even more important to me, I have wanted to do this, but didn't really know how to go about it. You've made me pretty happy. :) I'm not so sure that I'll go back and do what I had once wanted to do with it, but it's lovely to know how to accomplish it and that I can do it if I want to.

Thanks for taking the time to put this up.
User avatar
Chrissie Pillinger
 
Posts: 3464
Joined: Fri Jun 16, 2006 3:26 am

Post » Mon Aug 16, 2010 4:51 pm

K. Done. It didn't work. :)

Glad you liked the tutorial thingie! Here's to hoping I didn't put something retaarded into it.


My bad!

There are two kinds, the [ code ] and [ /code ] tags (without the spaces inside the brackets, I forgot that part. If I take the spaces out here, the text will vanish (hehe)

If you have alot of code, then [ codebox ] and [ /codebox] (again minus all spaces) will show the first 20 or 30 lines and give a horizontal scroll bar.

Cheers!

Miax
User avatar
Tiffany Carter
 
Posts: 3454
Joined: Wed Jul 19, 2006 4:05 am

Post » Mon Aug 16, 2010 8:30 am

There's also a "ref walk" that accomplishes the same thing, but more efficiently, however it requires FOSE. I put together a http://www.fallout3nexus.com/downloads/file.php?id=14342 that will allow you to place a script token into the inventory of all actors, mostly because I new I would want to use it for more than one of my mods, and didn't see the point in performing multiple ref walks when I didn't have to.
User avatar
hannah sillery
 
Posts: 3354
Joined: Sun Nov 26, 2006 3:13 pm

Post » Mon Aug 16, 2010 1:32 am

There's also a "ref walk" that accomplishes the same thing, but more efficiently, however it requires FOSE. I put together a http://www.fallout3nexus.com/downloads/file.php?id=14342 that will allow you to place a script token into the inventory of all actors, mostly because I new I would want to use it for more than one of my mods, and didn't see the point in performing multiple ref walks when I didn't have to.


Oh there is definitely a Much easier way to reference walk with FOSE, and additional filters we can put on the walk by specifying specific form types - I use it all over my mod. I think the point of Tarrant's tutorial was to teach how it can be done Without FOSE, as there are alot of people that don't use FOSE and many modders that don't want their work dependant on FOSE. I also like the rationale he gave in terms of needing to know how the game works at the root, as our outcomes are usually better when we do.

I won't be stripping all of my FOSE-code out to be sure (Nothing can replace Label/Goto), but I learned how to construct explosions and tie them to affects - which I will find lots of uses for in the future. :)

Miax
User avatar
Isabel Ruiz
 
Posts: 3447
Joined: Sat Nov 04, 2006 4:39 am

Post » Mon Aug 16, 2010 10:04 am

With New Vegas coming out, I've been giving thought to porting Powered Power Armor over to it, but at the moment its very heavily reliant upon FOSE. The hotkeys I can maybe do without temporarily, I can fake the "ispowerarmor" function by creating a big conditional statement that checks to see if the target is wearing one of the sets of power armor in the game (there won't be many mods at first so custom armor compatibility won't be as much of an issue), but I also do ref walks to place scripted armor tokens into the inventories of power armor wearing NPCs so that I can control their behavior and inventories a bit. I was just going to leave that last part out, but this thread reminded me that there was another way.
User avatar
Anne marie
 
Posts: 3454
Joined: Tue Jul 11, 2006 1:05 pm

Post » Mon Aug 16, 2010 6:27 am

I can fake the "ispowerarmor" function by creating a big conditional statement that checks to see if the target is wearing one of the sets of power armor in the game (there won't be many mods at first so custom armor compatibility won't be as much of an issue)


Getequipped works on a formlist, so you are kinda set there. For efficiency, you will want to make the list have as few items in it as you can get away with.
User avatar
JeSsy ArEllano
 
Posts: 3369
Joined: Fri Oct 20, 2006 10:51 am

Post » Mon Aug 16, 2010 4:45 am

Well that's good to know. And with addformtoformlist as one of the non-FOSE functions that'll probably still be there, armor mod compatibility won't be that hard.
User avatar
katsomaya Sanchez
 
Posts: 3368
Joined: Tue Jun 13, 2006 5:03 am

Post » Mon Aug 16, 2010 10:43 am

You never know, maybe the new GECK will have some of the FOSE functions :drool:
User avatar
HARDHEAD
 
Posts: 3499
Joined: Sun Aug 19, 2007 5:49 am

Post » Mon Aug 16, 2010 5:02 am

You never know, maybe the new GECK will have some of the FOSE functions :drool:


That is true, but one thing about that, maybe the Fallout NV Geck will not be the version to use with Fallout 3 (or the FO3-specific version won't see the same sorts of update). Will have to see. New script commands would be cool.
User avatar
Jacob Phillips
 
Posts: 3430
Joined: Tue Aug 14, 2007 9:46 am


Return to Fallout 3

cron