Moving entities

If you're looking for mapping help or you reckon you're a mapping guru, post your questions / solutions here

Moderator: Moderators

Post Reply
Splaetos
Major General
Posts: 730
Joined: Tue Jan 20, 2004 2:55 pm
Contact:

Moving entities

Post by Splaetos »

Anyone know offhand if brushes turned into functions(specificaly crates) can be moved via code?

Wondering if it is possible and I just have scripting errors, or if you cant move a function brush at all.
When I am king, you will be first against the wall~
Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

It should be possible...

Try simple things like

$myfunc_crate.origin += (0 0 64)

to move your func_crate up a bit 8-)
Image
Splaetos
Major General
Posts: 730
Joined: Tue Jan 20, 2004 2:55 pm
Contact:

Post by Splaetos »

the brushes do indeed 'move' when I change thier origin, they spawn in a different place... but they dont seem to be able to 'move'

Code: Select all

shutter1:

	$latch1 waitTill trigger
	iprintlnbold_noloc "latch1 triggered"
        if (level.shutter1_open == 1)
	{
		iprintlnbold_noloc "shutters were open"
                //$shutter_1a time 1
		//$shutter_1b time 1
		$shutter_1a moveLeft 24
		$shutter_1b moveRight 24
		$shutter_1a move
		$shutter_1b move
		//$shutter_1a playsound ...
		//$shutter_1b playsound ...
		level.shutter1_open = 0
		wait 2
		thread shutter1
	}
	else
	{
		iprintlnbold_noloc "shutters were closed"
                //$shutter_1a time 1
		//$shutter_1b time 1
		$shutter_1a moveBackward 24
		$shutter_1b moveForward 24
		$shutter_1a move
		$shutter_1b move
		//$shutter_1a playsound ...
		//$shutter_1b playsound ...
		level.shutter1_open = 1
		wait 2
		thread shutter1
	}
end
as yo ucan see, i tried backwards, forwards, left and right... they all produce the same error...

Code: Select all

$shutter_1a moveForward 24 (maps/dm/dm_rail-station_beta.scr, 120)
		$shutter_1a ^

^~^~^ Script Error: Failed execution of command 'moveforward' for class 'CrateObject' Targetname 'shutter_1a'

		$shutter_1b moveBackward 24 (maps/dm/dm_rail-station_beta.scr, 121)
		$shutter_1b ^

^~^~^ Script Error: Failed execution of command 'movebackward' for class 'CrateObject' Targetname 'shutter_1b'

		$shutter_1a move (maps/dm/dm_rail-station_beta.scr, 122)
		$shutter_1a ^

^~^~^ Script Error: Failed execution of command 'move' for class 'CrateObject' Targetname 'shutter_1a'

		$shutter_1b move (maps/dm/dm_rail-station_beta.scr, 123)
		$shutter_1b ^
on the bight side, all my indicator messages were hit... the trigger works, the variable to determine if it is open or closed works, and it can be triggered again after 2 seconds... the shutters simply dont seem to be able to move.

Anyone have any clue if I did something wrong in there? Or, as an alternative, another method to make brushes that both move on trigger, and are destructable.

The only other option I thought might be feasable is using the exploder system(which isnt as desireable I think for shotting out a wooden shutter) and since the exploder system uses sets and specific target names, that I dont see how I could target for momevent.

I guess I could cheat a bit by using shootable triggers that move along with the shutters, that trigger the hiding of the shutters... but thats definately not goign to have the same effect I think, plus its even more scripting and mapping.
When I am king, you will be first against the wall~
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

bind

Post by tltrude »

They (CrateObjects) can't be moved by themselves, but they will move if they are attached to a moving object--like a script_origin. Place a script_origin in the center of each shutter and "bind" the shutters to them. Then move the script_origins in the script.

Btw, you can also bind them to script_objects, script_models, or any other movable object--even func_doors or func_rotatingdoors.
Tom Trude,

Image
Splaetos
Major General
Posts: 730
Joined: Tue Jan 20, 2004 2:55 pm
Contact:

Post by Splaetos »

thanks tom
When I am king, you will be first against the wall~
Image
Splaetos
Major General
Posts: 730
Joined: Tue Jan 20, 2004 2:55 pm
Contact:

Post by Splaetos »

might be a stupid question here...

binding to a script origin i select the origin first, then the crate, then hit ctrl+k?

that produces a red line.

so far it doesnt look like its working with that method...

the target should be the crateobject correct?

does the origing have to be actualy within(touching) the crate?
When I am king, you will be first against the wall~
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

K

Post by tltrude »

You don't need to "target" the object. Binding is done in the script with targetnames.

$shutter1 bind $shutter1_origin

You can place that line under prespawn, or in a "shutter_prep" thread along with other lines that prepare the shutters to move--like travel times.
Last edited by tltrude on Tue Jul 13, 2004 6:18 pm, edited 1 time in total.
Tom Trude,

Image
Splaetos
Major General
Posts: 730
Joined: Tue Jan 20, 2004 2:55 pm
Contact:

Post by Splaetos »

ya know, I should have known that...

havent been scripting in 6 months =)

thanks
When I am king, you will be first against the wall~
Image
Post Reply