A question

Post » Mon Dec 21, 2009 9:52 am

http://www.uesp.net/morrow/editor/mw_cscommands.shtml#move

I dont know how to script so advice would be nice so i can slowly learn :P

The 'MoveWorld' command does it work how i think it would?
move the world, like an interior so that water could look like it raises and lowers? move the world in the Z axis.

what i would like to try and do if it works how i think it would,
use a crank,
moveworld up 300.000 lock door 1, unlock door 2
and make it so when used again,
moveworld down 300.000 lock door 2, unlock door 1

to give the feel that the place you are in fills and unfills with water.

is that how it could work or would i have to think of another way to get that affect?
User avatar
ezra
 
Posts: 3510
Joined: Sun Aug 12, 2007 6:40 pm

Post » Mon Dec 21, 2009 10:05 am

I'm not personally familiar with MoveWorld, but according to that description it moves the object in relation to the world. What you need to use is SetWaterLevel.
User avatar
Marta Wolko
 
Posts: 3383
Joined: Mon Aug 28, 2006 6:51 am

Post » Mon Dec 21, 2009 1:55 pm

SetWaterLevel seems like it would set it like it would stats, instantly lol not quite the affects i would want,

So i would have to apply the move affect to a specific set of objects? would activating the crank be able to activate a group of objects to move at the same time? hall, 2 doors, 2 doorjams the crank,
and would i be able to get the crank to do the opposit of what it just done, like a switch,

The place im making is underwater and i would like it to look like the first little bit you're in drains with water before letting you in the complex.
User avatar
Albert Wesker
 
Posts: 3499
Joined: Fri May 11, 2007 11:17 pm

Post » Mon Dec 21, 2009 8:51 pm

begin drainSwitchshort stateif ( OnActivate == 1 )     if ( state == 0 )          Hall_ID-> Move, z, -300          Door1_ID-> Move, z, -300          Door2_ID-> Move, z, -300          Doorjam1_ID-> Move, z, -300          Doorjam2_ID-> Move, z, -300          Crank_ID-> Move, z, -300          set state to 1     else          Hall_ID-> Move, z, 300          Door1_ID-> Move, z, 300          Door2_ID-> Move, z, 300          Doorjam1_ID-> Move, z, 300          Doorjam2_ID-> Move, z, 300          Crank_ID-> Move, z, 300          set state to 0     endifendifend

User avatar
ezra
 
Posts: 3510
Joined: Sun Aug 12, 2007 6:40 pm

Post » Mon Dec 21, 2009 10:01 pm

Thank you for the script :)
User avatar
Breautiful
 
Posts: 3539
Joined: Tue Jan 16, 2007 6:51 am

Post » Mon Dec 21, 2009 4:54 pm

I cant get the script to work it doesnt seem to activate,

tryed using the crank its on and startscript, and it didnt do anything, did i do something wrong? o.o

begin drainSwitch

short State

if ( onactivate == 1 )
if ( State == 0 )

in_dwrv_corr1_02-> Move, z, 300
A_door_dwrv_load00-> Move, z, 300
A_door_dwrv_load01-> Move, z, 300
A_dwrv_doorjam00-> Move, z, 300
A_dwrv_doorjam01-> Move, z, 300
A_dwrv_crank_00-> Move, z, 300
A_door_dwrv_load00-> Lock 100
A_door_dwrv_load01-> Unlock
A_light_dwrv_neon01-> Move, z, 300
DoorMarker-> Move, z, 300

set State to 1
else
in_dwrv_corr1_02-> Move, z, -300
A_door_dwrv_load00-> Move, z, -300
A_door_dwrv_load01-> Move, z, -300
A_dwrv_doorjam00-> Move, z, -300
A_dwrv_doorjam01-> Move, z, -300
A_dwrv_crank_00-> Move, z, -300
A_door_dwrv_load01-> Lock 100
A_door_dwrv_load00-> Unlock
A_light_dwrv_neon01-> Move, z, -300
DoorMarker-> Move, z, -300

set State to 0
endif

endif

end drainSwitch

User avatar
Jacob Phillips
 
Posts: 3430
Joined: Tue Aug 14, 2007 9:46 am

Post » Mon Dec 21, 2009 1:20 pm

I assume you attached the script to the crank.

It may be working, but it is moving the objects for one frame only. First of all OnActivate runs for one frame only, so the code executes in the frame that the player activates the crank. You need to toggle a flag when OnActivate is true to allow movement to occur in successive frames. I am a little surprised you do not detect a little movement. The rate of 300 units per second would be produce noticeable movement in one frame unless you have an extremely high frame rate.

There is also a problem with trigger for setting state to 1. This should not be set until the objects have been moved to their new location. Unless that is accomplished in one frame (and I doubt that is what you intend), in the next frame (if the script could process past the OnActivate check) the objects will be moved back to their starting position, and the process would repeat itself. Usually a timer is used to have the script run long enough to move the objects to their intended position, or their position is checked until the target position is attained. Even then, you probably do not what to have the objects moved back without delay. If there is a trigger for that (such as a second activation of the crank), we need to know that in order to supply the appropriate code.

I am a little surprised that you did not receive any error messages. In order to move an object with a script that is not attached to it that object has to be unique and it must have references persist checked. NorthMarker is not unique nor is it persistent. Happily it does not need to be moved by your script.

Before proposing specific changes to your script I urge you to reconsider the use of the function SetWaterLevel. It can be manipulated so it is not a single abrupt change (like your current script ;) ). For an interior cell, it is the move efficient approach to the problem as I understand it. You might look at the official script torch_lever that is used to alter the water level in Old Mournhold.
User avatar
Glu Glu
 
Posts: 3352
Joined: Sun Apr 01, 2007 5:39 am

Post » Mon Dec 21, 2009 10:45 am

Yes i put the script on the crank lol

no i didnt notice any difference but maybe since there is no timer it stops before it moves or something i dont know lol,

the objects are all unique in and references persisted did most with A_ at the biggining and told it to make it a new object, didnt put A_ with the coradoor and its more awkward to find though, but i did get those errors and sorted them so i get no errors just it wont do what i want :P.

basically i have it on its own a corrador and 2 doors, when i activate the crank i want it to gradually move out of the water, or the water to move down. This im hoping would make it look like its emptying of the water, this would lock the door leading into the sea and open the door leading to the complex. When the crank is activated again i want it to reverse it so it looks like its filling with water and the door to the complex is locked and the door to the sea is open. The place is underwater and it makes it so it doesnt flood. :P

though if the setwaterlevel can be used to give that affect its fine lol im slowly trying to learn to script so i dont know much. I was assuming since it was set it would have to be set alot to give it a smoth movement, making it seem less efficiant then telling a group of objects to move, though if im wrong and its better im fine with that :P

and i shall look at the torch_lever script, thank you for your help :D
User avatar
Alyce Argabright
 
Posts: 3403
Joined: Mon Aug 20, 2007 8:11 pm

Post » Mon Dec 21, 2009 5:00 pm

Here is an untested script that adjusts the water level. I should have mentioned before that using water level manipulation introduces Tribunal (or Bloodmoon) dependency for your mod.

For the purpose of this example I use a starting water level of 0 and a final water level of 1000. You need to edit those numbers for the actual water level in your cell and the target high water mark. The script is attached to the Dwemer crank (valve) in the cell and for two seconds it rotates the crank slowly to simulate opening the valve and closing the drain - then the water level will begin to rise. You can alter the duration that the crank turns as well as the rate at which it spins to suit your taste. In this example it is rather slow. The water level rises at a (slow) rate that you can adjust to your needs. Once the target water level is attained, the doors are locked or unlocked as appropriate (taken from your original script). Not knowing your situation I wonder if the lock level of the doors should be changed at the beginning of the water filling the room (temporarily trapping the player). Only after the room has filled with water can the player re-activate the valve and begin the process of draining the water in a similar fashion. This creates an issue if the player leaves before the water level has reached its target level, but you can decide if this is a concern. Having both doors locked while it fills will solve that problem, excepting the use of teleportation.

Begin A_DwemerCrankScript; Attached to A_DwemerCrank; When activated it simulates the filling (and draining) of the room with water; and changes the lock level of doors.short statefloat timershort flowDirectionfloat flowRateif ( menumode )	returnendifif ( OnActivate == 1 )    if ( state == 0 ) ; valve closed, drain open        set state to 1        set flowDirection to 1        PlaySound "Dwemer Door Open"    elseif ( state == 3 ) ; valve open, drain closed        set state to 4        set flowDirection to -1        PlaySound "Dwemer Door Open"    endif    returnendifif ( state == 0 )    returnendifif ( state == 1 ) ; closed valve activated    set timer to ( timer + GetSecondsPassed )    if ( timer < 2 ) ; you may adjust the duration (2)        Rotate x 10 ; this turns crank - you may adjust rate (10)        return    endif    set timer to 0 ; reset for next time    set state to 2elseif ( state == 2 ) ; valve open, drain closed - water rising    if ( GetWaterLevel < 1000 ) ; 1000 is high water mark - adjust for your interior        set flowRate to 100 * GetSecondsPassed ; you may adjust rate (100)        set flowRate to ( flowRate * flowDirection )        ModWaterLevel flowRate        return    endif    set state to 3    "A_door_dwrv_load01"->Unlock    "A_door_dwrv_load00"->Lock 100endifif ( state == 4 ) ; open valve activated    set timer to ( timer + GetSecondsPassed )    if ( timer < 2 ) ; you may adjust the duration (2)        Rotate x -10 ; this turns crank - you may adjust rate (10)        return    endif    set timer to 0 ; reset for next time    set state to 5elseif ( state == 5 ) ; valve closed, drain open - water draining    if ( GetWaterLevel > 0 ) ; 0 is low water mark - adjust for your interior        set flowRate to 100 * GetSecondsPassed ; you may adjust rate (100)        set flowRate to ( flowRate * flowDirection )        ModWaterLevel flowRate        return    endif    set state to 0    "A_door_dwrv_load01"->Lock 100    "A_door_dwrv_load00"->UnlockendifEnd A_DwemerCrankScript

This code has not been tested.
User avatar
Kit Marsden
 
Posts: 3467
Joined: Thu Jul 19, 2007 2:19 pm

Post » Mon Dec 21, 2009 2:53 pm

Thank you :) the code worked great its how i wanted the effect to look, both doors locking while it fills/unfills would be a good idea :D
User avatar
remi lasisi
 
Posts: 3307
Joined: Sun Jul 02, 2006 2:26 pm


Return to III - Morrowind