UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

Help With Moving/Rotating doors with a script.

broken avatar :(
Created 9 years ago
by GNT123
0 Members and 1 Guest are viewing this topic.
3,639 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 9 October 2014
Last active: 6 years ago
Posts
15
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
GNT123's Groups
GNT123's Contact & Social Links
On my map I have challenges that people do and once they complete them I want doors to open, but I don't know how to tell a script to do that. So any help would be much appreciated. Thanks!
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
×
broken avatar :(
Location: gbPrefer Not To Say
Date Registered: 20 December 2013
Last active: 9 years ago
Posts
8
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
IVIr_Gadd's Groups
This moves the "door"

door1 = GetEnt("door1", "targetname");
door1 MoveTo((-16, 80, 9), 0.5, 0.05, 0.05);

or this rotates the door.

door1 = GetEnt("door1", "targetname");
door1 RotatePitch( -5, 0.26, 0.15, 0.1 );



use a script origin to get coordinates
**MoveTo((coordinate, coordinate, coordinate), 0.5, 0.05, 0.05);
0.5=The time to move the entity in seconds
0.05=The time spent accelerating
0.05=The time spent decelerating

RotatePitch( -5, 0.26, 0.15, 0.1 );
-5=The new pitch angle in degrees
0.26=The time to rotate in seconds
0.15=The time spent accelerating in seconds
0.1=The time spent decelerating in seconds

info from  - http://www.zeroy.com/Script/
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 9 October 2014
Last active: 6 years ago
Posts
15
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
GNT123's Groups
GNT123's Contact & Social Links
This moves the "door"

door1 = GetEnt("door1", "targetname");
door1 MoveTo((-16, 80, 9), 0.5, 0.05, 0.05);

or this rotates the door.

door1 = GetEnt("door1", "targetname");
door1 RotatePitch( -5, 0.26, 0.15, 0.1 );



use a script origin to get coordinates
**MoveTo((coordinate, coordinate, coordinate), 0.5, 0.05, 0.05);
0.5=The time to move the entity in seconds
0.05=The time spent accelerating
0.05=The time spent decelerating

RotatePitch( -5, 0.26, 0.15, 0.1 );
-5=The new pitch angle in degrees
0.26=The time to rotate in seconds
0.15=The time spent accelerating in seconds
0.1=The time spent decelerating in seconds

info from  - http://www.zeroy.com/Script/

idk that didn't seem to work and idk why
Marked as best answer by GNT123 9 years ago
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 7 March 2016
Last active: 9 years ago
Posts
5
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
deathy0909's Groups
deathy0909's Contact & Social Links
idk that didn't seem to work and idk why

In no way is this the best way. Just a way that works for me.

Radiant crap (Put it into a spoiler if you know what your doing in Radiant)

Spoiler: click to open...
Step 1:
Go into Radiant Enity Browser->Script->model add it into your map


Step 2:
Select the script_model you have just placed and set the model via the Entity Info
At this point go ahead and also set the targetname to what you want to refer to the door as in the code in my case "door_example"


At this point you may want to keep track of any information such as the new origin/rotation of the model so that you don't have to guess inside your code.

Script crap

Several functions to move script_model if you are unsure how to:
Spoiler: click to open...
Taken directory from the /docs_modtools/scriptapifunctions.htm

Code Snippet
Plaintext
void <script_model, script_origin or script_brushmodel> MoveTo(<point>,<time>,[acceleration time],[deceleration time])

[MANDATORY] <point> The point to move the entity to
[MANDATORY] <time> The time to move the entity in seconds
[OPTIONAL] [acceleration time] The time spent accelerating
[OPTIONAL] [deceleration time] The time spent decelerating
CATEGORY:
CLIENT/SERVER: Server
SUMMARY: Move this entity to the given point.
EXAMPLE: dummy MoveTo( dest_org, .5, .05, .05 )

Code Snippet
Plaintext
void <script_model, script_origin or script_brushmodel> MoveX(<point>,<time>,[acceleration time],[deceleration time])

[MANDATORY] <point> The x value to move the entity to, as a floating point number
[MANDATORY] <time> The time to move the entity in seconds
[OPTIONAL] [acceleration time] The time spent accelerating in seconds
[OPTIONAL] [deceleration time] The time spent decelerating in seconds
CATEGORY:
CLIENT/SERVER: Server
SUMMARY: Move this entity to the given world x value
EXAMPLE: train MoveX( -4400, 60, 15, 20 )

Code Snippet
Plaintext
void <script_model, script_origin or script_brushmodel> MoveY(<point>,<time>,[acceleration time],[deceleration time])

[MANDATORY] <point> The y value to move the entity to, as a floating point number
[MANDATORY] <time> The time to move the entity in seconds
[OPTIONAL] [acceleration time] The time spent accelerating in seconds
[OPTIONAL] [deceleration time] The time spent decelerating in seconds
CATEGORY:
CLIENT/SERVER: Server
SUMMARY: move this entity to the given world y value
EXAMPLE: hangardoor MoveY( 320, 10 )

Code Snippet
Plaintext
void <script_model, script_origin or script_brushmodel> MoveZ(<point>,<time>,[acceleration time],[deceleration time])

[MANDATORY] <point> The z value to move the entity to, as a floating point number
[MANDATORY] <time> The time to move the entity in seconds
[OPTIONAL] [acceleration time] The time spent accelerating in seconds
[OPTIONAL] [deceleration time] The time spent decelerating in seconds
CATEGORY:
CLIENT/SERVER: Server
SUMMARY: Move this entity to the given world z value

Rotation

Code Snippet
Plaintext
void <script_model, script_origin or script_brushmodel> RotatePitch(<pitch angle>,<time>,[acceleration time],[deceleration time])

[MANDATORY] <pitch angle> The new pitch angle in degrees
[MANDATORY] <time> The time to rotate in seconds
[OPTIONAL] [acceleration time] The time spent accelerating in seconds
[OPTIONAL] [deceleration time] The time spent decelerating in seconds
CATEGORY:
CLIENT/SERVER: Server
SUMMARY: Rotate this entity to the given pitch
EXAMPLE: treeorg RotatePitch( -5, 0.26, 0.15, 0.1 )

Code Snippet
Plaintext
void <script_model, script_origin or script_brushmodel> RotateTo(<angles>,<time>,[acceleration time],[deceleration time])

[MANDATORY] <angles> The new world angle to rotate to
[MANDATORY] <time> The time to rotate in seconds
[OPTIONAL] [acceleration time] The time spent accelerating in seconds
[OPTIONAL] [deceleration time] The time spent decelerating in seconds
CATEGORY:
CLIENT/SERVER: Server
SUMMARY: Rotate this entity to the given world rotation value
EXAMPLE: shutter RotateTo( (shutter.angles[0], newYaw, shutter.angles[2]), newTime )

Code Snippet
Plaintext
void <script_model, script_origin or script_brushmodel> RotateVelocity(<rotate velocity>,<time>,[acceleration time],[deceleration time])

[MANDATORY] <rotate velocity> The rotational velocity to rotate
[MANDATORY] <time> The time to rotate in seconds
[OPTIONAL] [acceleration time] The time spent accelerating in seconds
[OPTIONAL] [deceleration time] The time spent decelerating in seconds
CATEGORY:
CLIENT/SERVER: Server
SUMMARY: Rotate this entity at a particular velocity for a given time
EXAMPLE: self RotateVelocity( (x,y,z), 12 )

Code Snippet
Plaintext
void <script_model, script_origin or script_brushmodel> RotateYaw(<yaw angle>,<time>,[acceleration time],[deceleration time])

[MANDATORY] <yaw angle> The new yaw angle in degrees
[MANDATORY] <time> The time to rotate in seconds
[OPTIONAL] [acceleration time] The time spent accelerating in seconds
[OPTIONAL] [deceleration time] The time spent decelerating in seconds
CATEGORY:
CLIENT/SERVER: Server
SUMMARY: Rotate this entity to the given yaw

There are most definitely more functions but these are just the main ones id look into using for this.

So after deciding which function is right for you go ahead
Now in this example I'm going to be using MoveX as I am only moving it along the X axis.

Code Snippet
Plaintext
function monitorDoorEvent() {
//Grabs the script_model we placed inside out map
door = GetEnt("door_example", "targetname");

//Waits for the notify or you can just remove this and run the script when ready.
level waittill("event_door_move");

//Moves the door along the X axis from initial point to 852.25 it will take it 1 second to do so.
door MoveX(852.25, 1); //MoveX(pointX, time), MoveTo(newOrigin, time)
}

Essentially this is just the exact same as what IVIr_Gadd suggested but just going over the Radiant parts.  :lol:

If you followed it right your door should move like such (Sorry about music I forgot that nvidia shadow play picks up that crap):
Spoiler: click to open...
:(
We're sorry.
The embdedded media couldn't be retrieved.
View reason
The response was empty.
View media in new tab
broken avatar :(
×
broken avatar :(
Location: gbPrefer Not To Say
Date Registered: 20 December 2013
Last active: 9 years ago
Posts
8
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
IVIr_Gadd's Groups
Im assuming you have a script for challenges?

Once the challenges have been done and give a reward in the rewards bit add

door1 = GetEnt("door1", "targetname");
door1 MoveTo((-16, 80, 9), 0.5, 0.05, 0.05);

or change MoveTo((-16, 80, 9), 0.5, 0.05, 0.05); to door1 Delete(); and the door will disappear.

Incase you dont know, click the door, press N and add the kvp targetname door1
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 9 October 2014
Last active: 6 years ago
Posts
15
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
GNT123's Groups
GNT123's Contact & Social Links
Thanks if found my mistake. One last question how do I set up like a scriptflag so when I active the trigger that it enters me into the zone?

 
Loading ...