Jump to content

Quick Script


Adras

Recommended Posts

Anyone know how to do a simple script that will make a wall move to the side when it is clicked on? I'm working on a mod and just need this quick script. If you could even put it right here on the forums, it would be much appreciated!
Link to comment
Share on other sites

I'm new to morrowind, and am just now learning scripting, I haven't even played that much of the game, i probably have no business tinkering with it but,

 

I think that the move command will do that.

 

the move command moves it on the objects axis, (positive y moves it forward, z up, )

 

format being: Move axis x/y/z , units

 

example: WallObjectID -> Move x, 10

 

should move it to the side by 10

 

the MOVEWORLD command moves along the world's axis, north, east, up, x,y,z's (regardless of what way it's facing.)

 

 

and i think you'll need some kind of a, if activate

you might have to make a new object in activators, and use the wall's model (NIF file)

 

Do you need the wall to move back? if so, like a door when clicked on, or automatically go back after a short time?

 

Anyway I'm probably just wasting space as I'm still just theorizing

 

I was just researching something similar, i'm trying to make a 'trap door' that opens up underneath you making you fall down to a lower level, using GetStandingPC == 1 or something.

 

Someone who knows what they're taklking about want to help Adras out?

Link to comment
Share on other sites

I just found what the game units are

 

1 game unit = 0.56 inches = 1.42 cm

50 = 28 inches

500 = 23.3 feet

5000 = 233.3 feet

8192 = 385 feet = 116.33 meters = 1 game cell

 

From- Morrowind Scripting for Dummies 8th edition by GhanBuriGhan

 

it also had a script example using a timer to make objects slowly move, I'm still overwhemed at this point, I haven't programmed since i was a kid, but it's not too different from what i can remember,

 

i was also thinking if you want the wall to slide back on activation, you could use a global variable so the script knows which way to move it. as an example,if it's the left position set your variable to 1, if it's in the right position set it to 0.

 

something LIKE,

 

if ( on activation == 1 )

if ( yourglobalvariable == 1 )

wallobjectid -> move x, -50

set yourglobalvariable to 0

endif

endif

 

if ( on activation == 1 )

if ( yourglobalvariable == 0 )

wallobjectid -> move x, 50

set yourglobalvariable to 1

endif

endif

 

i might have the positive and negatives reversed.

 

-and you need at the beginning-

 

Begin YourScriptName

 

-and at the end -

 

End

End YourScriptName

 

this might not work as-is but it should be a step in the right direction, or left, x-axis, or variable, i'm confusing myself.

Link to comment
Share on other sites

  • 4 weeks later...

Ok, I know this is an old topic, but I'm right here again. Using Kevin's example script:

 

if ( on activation == 1 )

if ( yourglobalvariable == 1 )

wallobjectid -> move x, -50

set yourglobalvariable to 0

endif

endif

 

I need this from a very good scripter. Will that work? What I want to do is to have the PC click on, say a torch or something, and the wall will slide to the side, revealing a passage or something. I remember a house mod that I had long ago and you go into the armory and you can click on a shield or candle stick, then a trap door is revealed. I need something like that. And it will have to be able to move two objects, actually. I really need this soon. Before Sunday if at all possible!

Link to comment
Share on other sites

Actually you don't need a global variable, a short local variable will do.

 

I Copy Pasted a real script from a working mod below that uses a switch to open the secret door(wall static). In this case the wall moved down and up, but that can be changed with x y or z. It also uses a timer so you can see the wall moving, instead of just instantly moving, and uses a sound file. Just cahnge the script name and make a new static and use it's ID in the script, and apply it to your new activater. I'm not sure if the sound file is a morrowind file or an addon in this script.

 

I hope this helps.

 

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

begin marcSwitch01

 

; A switch that lowers the secret wall '_vl_atg_scrtwall'

; to reveal a room.

; Created by Viking_Lord for 'Anastasio The Greats Hideout'

 

short Moving

float Timer

short ToggleSound

 

if ( MenuMode == 1 )

return

endif

 

if ( OnActivate == 1 )

if ( Moving == 0 )

set Moving to 1

set ToggleSound to 0

elseif ( Moving == 2 )

set Moving to 3

set ToggleSound to 0

endif

endif

 

; Moving States:

; 0 at close position

; 1 moving from closed to open position

; 2 at open position

; 3 moving from open to closed position

 

if ( Moving == 0 )

return

elseif ( Moving == 2 )

return

elseif ( Moving == 1 )

if ( ToggleSound == 0 )

PlaySound "endrumble"

set ToggleSound to 1

endif

"marcSecretWall"->MoveWorld Z, -100

elseif ( Moving == 3 )

if ( ToggleSound == 0 )

PlaySound "endrumble"

set ToggleSound to 1

endif

"marcSecretWall"->MoveWorld Z, 100

endif

 

if ( Timer > 4 )

set Timer to 0

if ( Moving == 1 )

set Moving to 2

else

set Moving to 0

endif

endif

 

set Timer to ( Timer + GetSecondsPassed )

 

end

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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