Create Items In Designated Area Only

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search

I am working on a mod that will allow you to use one item to place another item on the ground in front of you. Because of the way I am using this, I want to restrict this from happening anywhere but my deisgnated areas. Designated areas will be a slightly normal looking piece of ground. Can anyone offer any insight on how I could script this? If a player is on that ground then allow it, if they are not, give them a message? --Brainspackle 13:15, 8 April 2006 (EDT)

First off, is it indoors or outdoors?

Indoor script:

scn ScriptName

Begin OnActivate

  If player.GetInCell CellName
    player.PlaceAtMe OtherItem, count, distance, direction
  else
    Messagebox "You are not in the right area."
  endif

End

For outdoors, it's a little trickier:

scn ScriptName

float playerx
float playery

Begin OnActivate

set playerx to player.getpos x
set playery to player.getpos y
If (player.GetInWorldspace WorldspaceName) 
  && ((playerx > lowerxboundry) && (playerx < upperxboundry))
    && ((playery > lowerybondry) && (playery < upperyboundry))
  player.PlaceAtMe OtherItem, count, distance, direction
else
  Messagebox "You are not in the right area"
endif
end
       

Use lower/upperxboundry and lower/upperyboundry to set restrictions on where in the worldspace the player needs to stand. --Symbiode 08:36, 9 April 2006 (EDT)

Very nice, thanks alot Symbiode. I will make sure to credit you in my mod, that I think is going to be very well recieved. Moving to Solutions.

Note: You can use getInCell to test for a named exterior cell, but you need to create a "dummy" interior cell with a name with the same prefix as your exterior cell you want to check for. GetInCell matches for anything containing that prefix. For example "Anvil" is an interior cell that is empty, but if you check for "getInCell Anvil" checks for ANY cell, interior or exterior that has the form "Anvilxxx." So you could create a dummy interior "myModLocation" and name an exterior "myModLocationExterior" then check for "Player.GetInCell myModLocation == 1" which would be true if the player is in that named exterior cell (and any other cell named "myModLocationxxx") -- Jduvall 12:05, 18 May 2006 (EDT)