Jump to content

Modding - Using the "PlaceAtMe" command


goldredblue0798

Recommended Posts

The Summoned Creatures tutorial is exactly what I had in mind as an example. Obviously you would need to tailor it for your own needs but as already mentioned, you could place several Xmarkers to move these NPCs.

 

Creating the NPCs, the references, the "creature cage" and such should be fairly easy but the the complicated part will be the handling of the variables...keeping track of which / how many NPCs are alive as well as where to move them to (so you don't spawn 5 NPCs in the exact same spot at the same time).

 

If you can create a function that accepts a parameter, that would be the cleanest way to do something like this. But you could just go through each of the NPCs one at a time and count how many are disabled. Once you have the grand total, do some math to find out how many need to be moved and enabled. Then it is a matter of randomizing which ones are moved. If there is a randomize number function, maybe you could use that to have it pick a number between 1 and 50...then take that number and see if the corresponding NPC is disabled...and then move him and decrement the variable that says how many you need to re-activate. This assumes you name your NPC references something like mynpc1, mynpc2, mynpc3, etc. and that you can pull a reference with a partial name + a variable. Otherwise you would have to make a long If Then, Else that checks the variable and issues the correct command.

 

I'm sorry I don't have any code to show you. I don't have FO3 installed anymore and I never really used the GECK...but from what I saw, it was very similar to the TES CS...at least in functions.

 

I also hope I'm not over-complicating this...I tend to program based on pseudocode first and after I get a working model, I then cut away to make it more efficient based on the language used and functions/features available.

 

LHammonds

 

Nope sorry cant use the "MoveTo" command its more bugged in the GECK than game bloating in the actual game...

 

And with the amount of NPC's that would have to be moved you would lagg so much that it would look as if the game froze.

 

The only command that will work is "PlaceAtMe" and the only issue I need to fix is the fact that an unlimited amount of NPC's keep spawning...

 

Their are mods that use the command and they work perfectly fine...

 

-KC

Link to comment
Share on other sites

Man! I swear I answered this fairly recently.... must have been on another forum...

 

Here is a script that spawns bugs. The bugs have a script that updates the variable than store the number of spawned bugs. When one is killed, that number is decremented, when one is spawned, its incremented.

 

scn UCBugDoorScript

Short DoOnce
Short NumBugs
Short MaxBugs
Short Stage
Float Delay
Float Timer


Begin OnLoad
If DoOnce == 0
	Set NumBugs to 25		;Current number of bugs in the cell
	Set MaxBugs to 15		;Max amount of bugs to spawn
	Set Delay to 15				;Delay time between spawns
	Set DoOnce to 1
EndIf
End

Begin GameMode
If UCBase2RTRef.IsOn == 0			;Is the spawning active? 0=default, yes
	If Timer > 0
		Set Timer to Timer - GetSecondspassed
	ElseIf Stage == 1
		UCBugSpot1.PlaceAtMe UCBase2Roach2 1 0 0	;Spawn a bug
		Set NumBugs to NumBugs + 1							;Increase the number of bugs in the cell by 1
		Set Timer to 1												;wait 1 second before opening the cage door
		Set Stage to 2	
	ElseIf Stage == 2
		UCBugDoor.SetOpenState 1							;open the cage door
		Set Timer to 5												;wait 5 seconds before closing the cae door
		Set Stage to 3
	ElseIf Stage == 3
		UCBugDoor.SetOpenState 0							;close cage door
		Set Stage to 0
		Set Timer to Delay										;set the delay time to the value defined on the terminal
	ElseIf Stage == 0 && NumBugs < MaxBugs 			;Determine if a bug needs to be spawned
		Set Stage to 1												;Set the stage to the bug spawning stage
	Endif
EndIf
End

Link to comment
Share on other sites

  • Recently Browsing   0 members

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