Rolling objects
Moderator: Moderators
-
chrisjbooth2001
- Colour Sergeant
- Posts: 77
- Joined: Thu Dec 18, 2003 12:57 am
Rolling objects
Does anyone know a way where you can make a spherical roll when a solid object touches it? The object would include, walls, boxes, and players...
Any help would be appreciated
Any help would be appreciated
-
omniscient
- Major General
- Posts: 694
- Joined: Tue Sep 16, 2003 12:02 am
ofcourse my good man. make the soild object to touch it a script object and targetname it "toucher" w/o the quotes. then select all the thing that will rool and make that a scriptobject called "roller". make an invisible brush on the floor, (weapon clip maybe???) and make it a script object targetnamed "destination1" then in the script type
that shud work, i hope, otehrwise a typed a lot for nothing 
Code: Select all
if ($toucher istouching $roller){
$roller moveto $destination1.origin
$roller time 5 (how ever long u want)
$roller move
$roller rotatex -45
$roller rotatex -45
$roller rotatex -45
$roller rotatex -45
$roller rotatex -45
$roller rotatex -45
$roller rotatex -45
$roller rotatex -45 (check that this syntax is right)
end
}
]
rotatex
Using "rotateX -45" it will just keep rotating forever at a speed of -45 degrees per second--if there was a move or waitmove command after the line, that is. "rotateX 0 would stop it.
The speed it rotates will determin how many times it rolls over before it reaches the destination. As an example, 360 degrees divided by 5 seconds = 72 degrees per second--one complete roll. By the way, I don't think you can roll the players, only push them. And, if rotateX doesn't work try rotateZ.
The speed it rotates will determin how many times it rolls over before it reaches the destination. As an example, 360 degrees divided by 5 seconds = 72 degrees per second--one complete roll. By the way, I don't think you can roll the players, only push them. And, if rotateX doesn't work try rotateZ.
-
omniscient
- Major General
- Posts: 694
- Joined: Tue Sep 16, 2003 12:02 am
read
You're not reading it right.
$roller rotateX -45
$roller move
wait 5
$roller rotateX 0
"rotateX" makes it rotate like a fan at -45 degress per second. It does not stop at 45 degrees!!!
$roller rotateX -45
$roller move
wait 5
$roller rotateX 0
"rotateX" makes it rotate like a fan at -45 degress per second. It does not stop at 45 degrees!!!
-
omniscient
- Major General
- Posts: 694
- Joined: Tue Sep 16, 2003 12:02 am
soccer
I think he wants to play soccer in mohaa. Might be possible, but I wouldn't know how. There is a trigger_pushobject, but it is beyond me.
-
chrisjbooth2001
- Colour Sergeant
- Posts: 77
- Joined: Thu Dec 18, 2003 12:57 am
roll
What he wants is for the rolling ball to bounce off walls, boxes, and players. Wonder if that func_fallingrock thing would work?
I tried "bouncetouch" with a script_object ball, but it said I can't do that for a class script slave. I got the ball to roll, but can't get it to "moveto" a spawned script_origin target--just moves up and off the map. There is a trigger_multiple bound the ball with a setthread. Here is my current (non working) thread.
[/code]
The ball is 16X16X16 (12 sided) and the trigger is a slightly larger ball.
I tried "bouncetouch" with a script_object ball, but it said I can't do that for a class script slave. I got the ball to roll, but can't get it to "moveto" a spawned script_origin target--just moves up and off the map. There is a trigger_multiple bound the ball with a setthread. Here is my current (non working) thread.
Code: Select all
level waittill prespawn
$ball_trigger bind $ball
end
ball_think:
//$ball bouncetouch
$ball playsound click
local.angles = (vector_toangles ($player.origin - $ball.origin))
$ball.angles = (0 (local.angles[1]+90) 0)
$ball time 5
local.b_target = spawn script_origin targetname "ball_target"
$ball_target.angles = $ball.angles
$ball_target.origin = $ball.origin + (1024 0 -8 )
$ball rotateZ -64
$ball moveto $ball_target
$ball waitmove
$ball rotateZ 0
$ball_target remove
end
[/code]
The ball is 16X16X16 (12 sided) and the trigger is a slightly larger ball.
-
nuggets
- General
- Posts: 1006
- Joined: Fri Feb 28, 2003 2:57 am
- Location: U-england-K (england in the UK) :P
- Contact:
i created a thread to push chairs away from the player a while ago, but the problem was you could push them through walls
anyway here's the guts of it
/*what you will need to make the pushable object
create a chair,
key: targetname
value: chair //this can be changed but you will need to amend the script at point **1**
------------
create a small square brush the same size as the chair (height may be flat)
key: targetname
value: chair_spot //this can be changed but you will need to amend the script at point **2**
------------
create the trigger, same size as the chair (trigger->use)
key: targetname
value: chair_trigger //this can be changed but you will need to amend the script at point **3**
key: setthread
value: mover //this can be changed but you will need to amend the script at point **4**
------------
copy all this script!!!
*/
main:
//edit these bits -v-v-v-
level.object = $chair //**1**<---but only the end bit!
level.object_spot = $chair_spot //**2**<---but only the end bit!
level.object_trigger = $chair_trigger //**3**<---but only the end bit!
//edit these bits -^-^-^-
level.object_trigger bind level.object
level.object_spot notsolid
//level.object_spot hide
end
object_move_spot:
local.angles = (vector_toangles ($player.origin - self.origin))
self.angles = (0 (local.angles[1]+180) 0)
self speed 1000
self moveforward 16
self waitmove
end
object_move:
self speed 48
self moveto ((level.object_spot.origin[0]) (level.object_spot.origin[1]) (self.origin[2]))
self waitmove
end
//-^-^-^-^-^-^-^-^-^-^-^-this bit will only be needed once-^-^-^-^-^-^-^-^-^-^-^-
//-v-v-v-this bit will be the only script you use for each pushable entity-v-v-v-
mover: //**4**
level.object_spot thread object_move_spot //these bits you will need to edit if giving it new names
wait 0.01
level.object thread object_move
// level.object playsound //this will have to be defined by the scripter depending on what you want to push
end
/*what you will need to make the pushable object
create a chair,
key: targetname
value: chair //this can be changed but you will need to amend the script at point **1**
------------
create a small square brush the same size as the chair (height may be flat)
key: targetname
value: chair_spot //this can be changed but you will need to amend the script at point **2**
------------
create the trigger, same size as the chair (trigger->use)
key: targetname
value: chair_trigger //this can be changed but you will need to amend the script at point **3**
key: setthread
value: mover //this can be changed but you will need to amend the script at point **4**
------------
copy all this script!!!
*/
main:
//edit these bits -v-v-v-
level.object = $chair //**1**<---but only the end bit!
level.object_spot = $chair_spot //**2**<---but only the end bit!
level.object_trigger = $chair_trigger //**3**<---but only the end bit!
//edit these bits -^-^-^-
level.object_trigger bind level.object
level.object_spot notsolid
//level.object_spot hide
end
object_move_spot:
local.angles = (vector_toangles ($player.origin - self.origin))
self.angles = (0 (local.angles[1]+180) 0)
self speed 1000
self moveforward 16
self waitmove
end
object_move:
self speed 48
self moveto ((level.object_spot.origin[0]) (level.object_spot.origin[1]) (self.origin[2]))
self waitmove
end
//-^-^-^-^-^-^-^-^-^-^-^-this bit will only be needed once-^-^-^-^-^-^-^-^-^-^-^-
//-v-v-v-this bit will be the only script you use for each pushable entity-v-v-v-
mover: //**4**
level.object_spot thread object_move_spot //these bits you will need to edit if giving it new names
wait 0.01
level.object thread object_move
// level.object playsound //this will have to be defined by the scripter depending on what you want to push
end
hope this helps, prob not cos it's all foreign 2 me :-/
cool
Thanks nuggets, it works now! Still doesn't bounce off stuff, but it will kick an AI guy up a few units while it rolls under him, ha ha. Mohaa bowling anyone?
Code: Select all
main:
level waittill prespawn
$ball_trigger bind $ball
level waittill spawn
end
ball_think:
$ball playsound click
$ball time 5
local.b_target = spawn script_origin "targetname" "ball_target"
$ball_target.origin = $ball.origin + (0 0 0)
local.angles = ( vector_toangles ( $player.origin - $ball.origin ))
$ball_target.angles = (0 (local.angles[1]+180) 0)
$ball_target time .001
$ball_target moveforward 512
$ball_target waitmove
$ball.angles = (0 (local.angles[1]+90) 0)
$ball rotateZ -135
$ball moveto ( ($ball_target.origin[0]) ( $ball_target.origin[1]) ($ball.origin[2]) )
$ball waitmove
$ball rotateZ 0
$ball_target remove
end
-
chrisjbooth2001
- Colour Sergeant
- Posts: 77
- Joined: Thu Dec 18, 2003 12:57 am
-
chrisjbooth2001
- Colour Sergeant
- Posts: 77
- Joined: Thu Dec 18, 2003 12:57 am


