Jump to content

Hi There

Welcome to Klub Exile. If you happened to make your way to the site either from Lovers Lab or a Search on Google, we are glad you found us.  To unlock the entire site you will need to have a account registered.  Don't worry it is free but in the mean time you can read up on why we made the site and other little tidbits.  Feel free to join or Discord Server also if you have any more questions.  Thanks for stopping by and See You on the other side.

admin admin
  • entries
    43
  • comments
    293
  • views
    3,217

Working with Lua scripts


Sexvision

154 views

 Share

I have been fiddeling with some lua scripts trying to understand. Found the following for movement of a object:

I have used the light position for an example of a dildo moving like this (move forward 0.03 from 0 and move - 0.03 passed 0 to the back.

so move + 0.03 from 0 and move -0.03 back from 0 as a callback. 0.03 is the value used to make the movement. 0.05 will give a longer movement.

local script = {}
--SCRIPT BODY - any functions and calculations
--====================================================================================================
--main function that will be used as frame update callback
--id         - object id allow access to object storage
--delta     - time passed from last frame, i.e frame time
local function update( id, delta ) 

    --here the main script things logic, calculations and so on
    local st = db.storage[id]
    if st then
        
        st.object.position = st.object.position + Vector3( 0, 0, 1) * st.move_speed * delta Vector3 is the same as (x,y,z) the possition where you set your 1 will be the axis used in the code, this one is Z for backward and forward, Y up and down, x left and right)
        if st.object.position.z > (st.base_pos.z + 0.03) or st.object.position.z < (st.base_pos.z - 0.03) then if st.objects.position.z is bigger than st.base_pos.z [so thats 0] or st.object.position.z is smaller than 0
            st.move_speed = st.move_speed * -1  This will give the movement
        end
        
    end
    
end
--================================================================================================
--BIND - this function called when object binded with script and allow register all desired callbacks
--================================================================================================
function script:bind_to_object( st, binder )--object storage and callback binder
    
    --declare per object variables
    st.base_pos = st.object.position this sets the =0.03 and -0.03
    st.move_speed = 0.8 set the speed of the toy here where 1 is max
    
    
    --register callback in array of active callbacks this will make it repeat
    binder:add_callback( CALLBACK_GLOBAL, "on_frame_update", st.object.id, update )
    --callback class
    --callback type
    --object id
    --function that will be used as callback
end
--====================================================================================================
--script registration
db.script_list["sc_simple_light_position_move"] = script  this is where you name the script. needs to be the same as script name

 

i have called it simple_move_position.script

1. so set your axis here by placing the 1 to vector3 st.object.position = st.object.position + Vector3( 0, 0, 1) read as (x,y,z) or (left\right, up\down, forward\backward)

2. set your movement coordinates here         if st.object.position.z > (st.base_pos.z + 0.03) or st.object.position.z < (st.base_pos.z - 0.03) then 

3. set your speed here      st.move_speed = 0.8 where 1 is max 

set the object in your leveldef like this:

[Dildo script]
enable = true
type = static
style = object
file = ![obj] h5 sexvision obj pack\cockpack\youthcockpack1\youthcockalienengineer\meshes0.h5m
position = 0.850370, 1.677861, -0.644488
rotation = 0.000000, 0.000000, 0.000000
scale = 1.000000, 1.000000, 1.000000
color_multiplier = 255, 255, 255, 255
metallness_multiplier = 1.000000
glosiness_multiplier = 1.000000
glow_intensity = 0.000000
cast_shadow = true
alpha_mask = true
alpha_blend = true
cull_mode = 4
rendering_source = 
rendering_source_uvoffset = 0.000000, 0.000000
rendering_source_uvscale = 1.000000, 1.000000
script_name = sc_simple_position_move
parent_name = 
 

you can parent a light to the object that used the script to make the light move

add to

[Light}

parent_name = Dildo script

Simple move script.rar

  • Thumbs Up 2
 Share

2 Comments


Recommended Comments

you could also make a car move with this script.

make the object a h5m car and set this to  if st.object.position.z > (st.base_pos.z + 0.7) or st.object.position.z < (st.base_pos.z - 0.7) then 

now play with speed to make it fit your needs

it will go back and forward

  • Like 1
Link to comment

You can also move the compete scene if you use parant_name =  (this means select an object that will be mama duck and parant all the ducklins to mama so they will move as mama duck will move ) 🙂

  • Like 1
Link to comment
×
×
  • Create New...

Important Information

WARNING! Adult Only Content You must be 18 years of age or older to enter. By accepting you agree to Klub Exile's Terms of Use and Guidelines upon creating an account.