Jump to content

Photo

Object reciprocation Motion


  • Please log in to reply
4 replies to this topic

#1
taglag

taglag

    Journeyman

  • Members
  • Pip
  • 41 posts

 Could someone help me with a reciprocation Script for and Object.

 

Every thing I have come up with is rather lame.

 

  I can not seem to get a simple piston action to work in the way I wish.

 

I was hoping that some of you might have some sample scripts to get me started in the right direction.

 

This is a very lame script, first attempt, I am sure there must be and easier way, and I actually desire a much smoother action than this allows.

 

It is just to give and Idea of what I was wanting. Very quickly done, and I am sure there is a much better, and easier way. And I hope smoother faster action if needed.

 

However this would always move the Object up and down, reguardless of it's Orientation. and It would be better if I could rotate it, and still have the Object move in the same direction back and forth.

Begin gamemode
    
    set me to getself
    if Me.getdistance player > 800
        return
    else
        if once == 0
            me.enable
            set zstart to me.getpos z
            set znew to zstart
            set once to 1
        endif
    endif
    
;***UP***

if timer >= 10 && timer < 12 && reverse == 0 && step == 0
        set znew to znew + 4
        me.SetPos z znew
        set step to 1
elseif timer >= 20 && timer < 22 && reverse == 0 && step == 1
        set znew to znew + 4
        me.SetPos z znew
        set step to 2
elseif timer >= 30 && timer < 32 && reverse == 0 && step == 2
        set znew to znew + 4
        me.SetPos z znew
        set step to 3
elseif timer >= 40 && timer < 42 && reverse == 0 && step == 3
        set znew to znew + 4
        me.SetPos z znew
        set step to 4
elseif timer >= 50 && timer < 52 && reverse == 0 && step == 4
        set znew to znew + 4
        me.SetPos z znew
        set step to 5
endif

;***Down***

if timer <= 52 && timer > 50 && reverse == 1 && step == 0
        set znew to znew - 4
        me.SetPos z zNew
        set step to 1
elseif timer <= 42 && timer > 40 && reverse == 1 && step == 1
        set znew to znew - 4
        me.SetPos z zNew
        set step to 2
elseif timer <= 32 && timer > 30 && reverse == 1 && step == 2
        set znew to znew - 4
        me.SetPos z zNew
        set step to 3
elseif timer <= 22 && timer > 20 && reverse == 1 && step == 3
        set znew to znew - 4
        me.SetPos z zNew
        set step to 4
elseif timer <= 12 && timer > 10 && reverse == 1 && step == 4
        set znew to znew - 4
        me.SetPos z zNew
        set step to 5
endif
    
if reverse == 0    
    
    if timer < 60
        set timer to timer + GetSecondsPassed
    else
            PrintToConsole"timer got 60"
            set reverse to 1

        if step == 5
            set step to 0
        endif
    endif
endif
    
if reverse == 1
    if timer > 0
        set timer to timer - GetSecondsPassed
    else
            PrintToConsole"timer got to 0"
            set reverse to 0
        if step == 5
            set step to 0
        endif
    endif
endif
    
END

Oblivion is I know not top line for anyone any more, but I was hoping someone could help me with this.


Edited by taglag, 16 October 2013 - 11:45 PM.


#2
QQuix

QQuix

    Old hand

  • Members
  • PipPipPip
  • 586 posts

This is a sample script to keep an object going up and down. Hope it can give you some ideas. Use at will.
 Note that using GetSecondsPassed as a multiplier for the speed gives you a smoother movement at any FPS
 

Spoiler



#3
taglag

taglag

    Journeyman

  • Members
  • Pip
  • 41 posts

This is a sample script to keep an object going up and down. Hope it can give you some ideas. Use at will.
 Note that using GetSecondsPassed as a multiplier for the speed gives you a smoother movement at any FPS
 

Spoiler

Thx U so much, It was just one of those thing's i had never tried, or thought about untill recently when I was picking at something.

 

   I knew about using activator's but was trying to avoid that, as it become to cumbersome moving the activator's and the Object if used in many places.

 

   I will surely give this a try.. Thx U again

 

I was assuming the locals were like this ?

 

REF xObject
short xStdSpeed
short xSpeed
short xMaxDisplacement
float xPosMax
float xPosMin
float xPosZ ;

Edited by taglag, 17 October 2013 - 03:50 AM.


#4
taglag

taglag

    Journeyman

  • Members
  • Pip
  • 41 posts

Thank you very much, I could not quite get what you had working, I am not a great scripter, but I managed to take what you taught me, and make this, which is not as clean as your's, but works pretty well for my needs.

 

  Thank you again

 

Spoiler

I may stream line it a little more latter, but for now it seems okay.


Edited by taglag, 17 October 2013 - 05:43 AM.


#5
QQuix

QQuix

    Old hand

  • Members
  • PipPipPip
  • 586 posts

Glad I could help.

Have fun. . .






Page loaded in: 2.426 seconds