Rolling objects

Post your scripting questions / solutions here

Moderator: Moderators

chrisjbooth2001
Colour Sergeant
Posts: 77
Joined: Thu Dec 18, 2003 12:57 am

Rolling objects

Post by chrisjbooth2001 »

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
omniscient
Major General
Posts: 694
Joined: Tue Sep 16, 2003 12:02 am

Post by omniscient »

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

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
}
]
that shud work, i hope, otehrwise a typed a lot for nothing :P
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

rotatex

Post by tltrude »

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.
Tom Trude,

Image
omniscient
Major General
Posts: 694
Joined: Tue Sep 16, 2003 12:02 am

Post by omniscient »

i believe u are right, player can not rotate upside down. are u saying though that u could use rotatex 260 instead of all those 45s? i wonder if u pusta a box fit around a player ant said for it to flip upsidedown if it would..... i gotta try that.
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

read

Post by tltrude »

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!!!
Tom Trude,

Image
omniscient
Major General
Posts: 694
Joined: Tue Sep 16, 2003 12:02 am

Post by omniscient »

o i get it. and also, itf u out a rotating box around a player he just gets hurt if it goes upside down.
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

soccer

Post by tltrude »

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.
Tom Trude,

Image
chrisjbooth2001
Colour Sergeant
Posts: 77
Joined: Thu Dec 18, 2003 12:57 am

Post by chrisjbooth2001 »

I dont want a set roll each time, want it to be able to be walked into and the ball goes opposite way!
M&M
General
Posts: 1427
Joined: Sun Sep 14, 2003 1:03 am
Location: egypt
Contact:

Post by M&M »

itf u out a rotating box around a player he just gets hurt if it goes upside down.
cant u glue the player 2 the box?

yay,my 200th post,i just had 2 make it b4 i went 2 sleep :wink: .sry if i annoyed any1 :oops:
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

roll

Post by tltrude »

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: 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.
Tom Trude,

Image
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

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
hope this helps, prob not cos it's all foreign 2 me :-/
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

cool

Post by tltrude »

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
Tom Trude,

Image
chrisjbooth2001
Colour Sergeant
Posts: 77
Joined: Thu Dec 18, 2003 12:57 am

Post by chrisjbooth2001 »

Thanks guys.. Ill see if it works! :)
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Did you have any (more) luck with the method I showed you Monday?
Image
chrisjbooth2001
Colour Sergeant
Posts: 77
Joined: Thu Dec 18, 2003 12:57 am

Post by chrisjbooth2001 »

Well mate, the physics line when added made ball disapear. As soon as i removed that line from the scr, it re-appeared... But with the none stop flying and clipping..

Either the line is wrong or its in the wrong place...

When you see this could ya check if im on msn?
Post Reply