An item that spawns a critter.

Post » Thu Sep 23, 2010 4:00 pm

Could I get some help in regards to this? I had a look at the NCR Emergency Radio and it was a nightmare of spaghetti code, I had no idea they had to make such a hack job of it. Poor Obsidian. I'd want something much simpler though, so perhaps all that might not be necessary.

What I'm looking for is being able to create an item that, when used, will spawn a particular critter and then go dormant for X amount of hours before doing it again. As an example, I'm trying to make a Nightstalker Whistle as part of a mod I'm working on. It just needs to spawn a normal Nightstalker, how it responds to the player will depend on whether they have Animal Friend (or my mod's variation thereof) or not.

So there won't need to be any special script, no need to set it friendly, no need to make it follow or attack, it basically would just essentially be a spawn command. You use it, the critter spawns, and the item goes dormant. The only problem is is that I have absolutely no idea of how to even begin doing this, my GECK experience is limited. I know how to work with items, quests, and scripts, but not to this degree.

If anyone could point me at a tutorial, or give me a bit of help, I'd really appreciate it. And I'll credit you for your aid on my mod's page, of course!
User avatar
El Khatiri
 
Posts: 3568
Joined: Sat Sep 01, 2007 2:43 am

Post » Thu Sep 23, 2010 4:22 pm

Well it's listed as unsupported/unused in FO:NV (and FO3 for that matter).

But summoning creatures is a legacy base effect from Oblivion. I haven't had a chance to play with it too much, but it should theoretically let you summon any creature, even ones with equipment on them, though in oblivion they only ever used that for Dremora with bound gear so I'm not sure how that works.
User avatar
Rudy Paint fingers
 
Posts: 3416
Joined: Sun Nov 11, 2007 1:52 am

Post » Thu Sep 23, 2010 9:21 pm

I think that the most simple way to achieve the effect you desire is using the PlaceAtMe function in your script. Here is the http://geck.gamesas.com/index.php/PlaceAtMe to the CS Wiki explaining how it works, its very easy.

I'll give you a very short example, since you have poked around the NCR radio thing you should know what a scripteffect is:
ScriptName NightStalkerScriptshort WhistleTime ; This is a variable used to determine if an specific amount of time has passed since the last time you blew the whistle, 0 means you can 1 means you cannot.Begin ScriptEffectStart  ;This part of the script will run when the whistle is blown	if WhistleTime == 0 ;Checks if the amount of time required has passed		Player.PlaceAtMe YouPutTheNameHere 0		set WhistleTime to 1   ; This sets the variable to 1, now the NightStalker will not appear when you blow the whistle	endifEndBegin ScriptEffectFinish ;This part of the code runs when the effect expires, that means the Duration of the effect has passed. we will use this to determine if the whistle can be blown.	set WhistleTime to 0  ; Now a NightStalker will appear when you blow the whistle.	Player.AddItem WhistleName 1 ;Places a New Whistle on the Player, remember that Aid items are consumed when usedEnd


Remember, for an aid object you'll have to create a script effect and then add it to the aid object.

PlaceAtMe:
What does it mean???
The "player" part means that the NightStalker will appear close to you.
The ".PlaceAtMe" makes the NightStalker Appear.
The "YouPutTheNameHere" Refers to the Base ID of the object (that includes NPC's such as the NightStalker) to be placed.
The "0" tells the script were to put the NightStalker in relation to the player; with 0 it will appear in front of you.

The WhistleTime Variable:
The trick here is that effects have a duration, so if you set the effects duration to say 3 hours blowing the whistle before the 3 hours have passed (before the effect has expired) will do nothing. The other important thing here is the "Begin ScriptEffectStart" and Begin "ScriptEffectFinish" Blocks, the first will run when you blow the whistle and the second will occur after the effect of having blown the whistle has passed.

I do not have access to the CS right now and i wont have until monday, so i cannot guarantee that this will work. Everything was done from memory. This script will of course not take care of everything, but it should at least point you in the right direction.

Well i hope this works. There are details that need working out in this script, for example: I am not entirely sure that if the player has two or more whistles he wont be able to call as many Nightstalkers as whistles he has, without regards to the time limit. The trick here is that aid items are removed when used and then you add it back when the effect expires, meaning that if the player can only get one whistle you should be fine.
User avatar
gary lee
 
Posts: 3436
Joined: Tue Jul 03, 2007 7:49 pm

Post » Thu Sep 23, 2010 1:48 pm

That's... actually incredibly handy. Very much so. In fact, you just pieced together a few pieces of a puzzle I've been staring at, in a very baffled way. I'm going to poke my mod tonight to see if I can't get this working all kosher, and with your help, I feel that I will be able to do just that.

Thank you. C:

Edit #1: Yeah, this is even more helpful than I realised. Especially with the structuring of ScriptEffect code and the effect duration, this has all come together in my head, now.

You're really awesome for taking the time out to help me, thanks Elestat! Yours is a name I'll remember. And I'll mention you once I have this feature in my mod. It's the least I can do, after all.
User avatar
Emmanuel Morales
 
Posts: 3433
Joined: Sat Oct 06, 2007 2:03 pm

Post » Thu Sep 23, 2010 6:13 pm

Just a note, there's one or two unnecessary/slightly wrong things here- if you 'recast'/re-use an ingredient or it gets dispelled somehow the SEFinish block will run, then it'll start a new SEStart- so the WhistleTime variable essentially does nothing.
More useful would be to make a quest variable or a global like NightStalkerDelay and use Set NightStalkerDelay to GameDaysPassed +1 when you place a nightstalker, then check in the SEstart block if GameDaysPassed > NightStalkerDelay before you place a second. In addition, by waiting until 3 hours later to readd the whistle item you'll lose any hotkey assignment- you only keep them if you readd the same frame the item's used.

There's one other thing, you'll want the Nightstalker you place to be flagged as a Quest Item to ensure they have proper AI- by default creatures run limited AI and don't process when you're out of the cell (they have no low level processing). Normally you can only make them Persistent in the GECK, but Quest Items are Persistent by default,
User avatar
jennie xhx
 
Posts: 3429
Joined: Wed Jun 21, 2006 10:28 am

Post » Thu Sep 23, 2010 5:24 pm

Okay, so what I've done is I've created it similar to the radio. The ScriptEffect lasts 0 seconds, but the time is checked by the script. I've tried to make it usable only once a day, which would be perfect. But for some reason, in practise, I can spam it. I'm not sure what I'm doing horribly wrong here, but here's the script:

scn PAACCallNightStalkerSCRIPT; This is where we store how many days have passed.float daysPassedbegin scriptEffectStart    ; We give them the caller back, since they just 'consumed' it.    player.addItem PAACCallNightStalkerITEM 1 1    ; is this their first time using the device?    if daysPassed == 0        ; It is, so let's account for that...        ; This way they'll be able to get past the check.        set daysPassed to GameDaysPassed    endif    ; Now let's check if we can let them call.    ; (The check is: either they haven't called yet, or enough time has passed for them to be able to.)    if daysPassed <= GameDaysPassed        ; They can. Now we need to determine what happens.        ; First we check to see if they have the Wasteland Whisperer perk        if player.hasPerk PAACWastelandWhispererPERK == 0            ; They don't. So we show them a message saying they can't figure the device out.            showMessage PAACBafflingDeviceMESG            ; Since the player hasn't technically used the item, let's reset our time-restriction.            set daysPassed to GameDaysPassed        else            ; They can! So let's tell them that they can.            showMessage PAACAnimalCallActivatedMESG            ; And let's give them a pack of NightStalkers!            player.placeAtMe VCrTier4NightStalkerMed            player.placeAtMe VCrTier4NightStalkerMed            player.placeAtMe VCrTier4NightStalkerMed            player.placeAtMe VCrTier4NightStalkerMed            ; So that hte player can't spam it...            ; We'll store the amount of days passed plus one, to compare later.            set daysPassed to GameDaysPassed + 1.0        endif    ; The player has already used the device once, they can't use it again yet.    else        ; Let's tell them that.        showMessage PAACNothingHappensMESG    endifend

User avatar
Tanya
 
Posts: 3358
Joined: Fri Feb 16, 2007 6:01 am


Return to Fallout: New Vegas