Page 1 of 1

Moving entities

Posted: Sat Jul 10, 2004 4:27 pm
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.

Posted: Sat Jul 10, 2004 6:22 pm
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-)

Posted: Sun Jul 11, 2004 9:26 pm
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.

bind

Posted: Sun Jul 11, 2004 11:16 pm
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.

Posted: Mon Jul 12, 2004 3:10 am
by Splaetos
thanks tom

Posted: Tue Jul 13, 2004 6:02 pm
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?

K

Posted: Tue Jul 13, 2004 6:11 pm
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.

Posted: Tue Jul 13, 2004 6:17 pm
by Splaetos
ya know, I should have known that...

havent been scripting in 6 months =)

thanks