Modme Forums
Menu:

scripting with structs and lights

Game Modding | Call of Duty: Black Ops 3 | Scripting


ModmeBot:

Thread By: hahaDuNOOB

hello modme useres

someone know how to get structs in my script and how to move entety's to it

and how to get model/lights/.. to get invisible and let it apier again

thanks.


ModmeBot:

Reply By: Abnormal202

to get a struct in script use:

name = struct::get(name, "targetname");



and you can use a move command such as MoveTo, and make it go to the origin of the struct:

dummy MoveTo( name.origin, 2,)


ModmeBot:

Reply By: mathfag

hahaDuNOOB
Abnormal202

to get a struct in script use:

name = struct::get(name, "targetname");



and you can use a move command such as MoveTo, and make it go to the origin of the struct:

dummy MoveTo( name.origin, 2,)

^1 brush MoveTo(test_struct.origin, 2,)
^1------------------------------------^
^1ERR(0) scripts/zm/zm_waeponsonly.gsc (97,37) in "test()" : syntax error, unexpected TOKEN_RIGHT_PAREN : 	brush MoveTo(test_struct.origin, 2,) 




function test()
{
	trigger = GetEnt("test_trigger", "targetname");
	brush = GetEnt("test_brush", "targetname");
	struct = struct::get(test_struct, "targetname");

	trigger waittill("trigger", player);
	brush MoveTo(test_struct.origin, 2,);

}

remove the comma "," in the last line after the "2" so it would be

brush MoveTo(test_struct.origin, 2);


ModmeBot:

Reply By: hahaDuNOOB

Abnormal202

to get a struct in script use:

name = struct::get(name, "targetname");



and you can use a move command such as MoveTo, and make it go to the origin of the struct:

dummy MoveTo( name.origin, 2,)

^1
^1^
^1ERR(6E) scripts/zm/zm_waeponsonly.gsc (94,0)  : Compiler Internal Error :  Uninitialized local variable 'test_struct'


function test()
{
	trigger = GetEnt("test_trigger", "targetname");
	brush = GetEnt("test_brush", "targetname");
	struct = struct::get( test_struct ,"targetname" );

	trigger waittill("trigger", player);
	brush MoveTo(test_struct.origin, 2);

}


ModmeBot:

Reply By: hahaDuNOOB

mathfag
hahaDuNOOB
Abnormal202

to get a struct in script use:

name = struct::get(name, "targetname");



and you can use a move command such as MoveTo, and make it go to the origin of the struct:

dummy MoveTo( name.origin, 2,)

^1 brush MoveTo(test_struct.origin, 2,)
^1------------------------------------^
^1ERR(0) scripts/zm/zm_waeponsonly.gsc (97,37) in "test()" : syntax error, unexpected TOKEN_RIGHT_PAREN : 	brush MoveTo(test_struct.origin, 2,) 




function test()
{
	trigger = GetEnt("test_trigger", "targetname");
	brush = GetEnt("test_brush", "targetname");
	struct = struct::get(test_struct, "targetname");

	trigger waittill("trigger", player);
	brush MoveTo(test_struct.origin, 2,);

}

remove the comma "," in the last line after the "2" so it would be

brush MoveTo(test_struct.origin, 2);



thanks but in game it still dont work


ModmeBot:

Reply By: mathfag

hahaDuNOOB
mathfag
hahaDuNOOB
Abnormal202

to get a struct in script use:

name = struct::get(name, "targetname");



and you can use a move command such as MoveTo, and make it go to the origin of the struct:

dummy MoveTo( name.origin, 2,)

^1 brush MoveTo(test_struct.origin, 2,)
^1------------------------------------^
^1ERR(0) scripts/zm/zm_waeponsonly.gsc (97,37) in "test()" : syntax error, unexpected TOKEN_RIGHT_PAREN : 	brush MoveTo(test_struct.origin, 2,) 




function test()
{
	trigger = GetEnt("test_trigger", "targetname");
	brush = GetEnt("test_brush", "targetname");
	struct = struct::get(test_struct, "targetname");

	trigger waittill("trigger", player);
	brush MoveTo(test_struct.origin, 2,);

}

remove the comma "," in the last line after the "2" so it would be

brush MoveTo(test_struct.origin, 2);



thanks but in game it still dont work

did you make sure that you're using a script model or brushmodel?


ModmeBot:

Reply By: hahaDuNOOB

mathfag
hahaDuNOOB
mathfag
hahaDuNOOB
Abnormal202

to get a struct in script use:

name = struct::get(name, "targetname");



and you can use a move command such as MoveTo, and make it go to the origin of the struct:

dummy MoveTo( name.origin, 2,)

^1 brush MoveTo(test_struct.origin, 2,)
^1------------------------------------^
^1ERR(0) scripts/zm/zm_waeponsonly.gsc (97,37) in "test()" : syntax error, unexpected TOKEN_RIGHT_PAREN : 	brush MoveTo(test_struct.origin, 2,) 




function test()
{
	trigger = GetEnt("test_trigger", "targetname");
	brush = GetEnt("test_brush", "targetname");
	struct = struct::get(test_struct, "targetname");

	trigger waittill("trigger", player);
	brush MoveTo(test_struct.origin, 2,);

}

remove the comma "," in the last line after the "2" so it would be

brush MoveTo(test_struct.origin, 2);



thanks but in game it still dont work

did you make sure that you're using a script model or brushmodel?

the model is a model the brush is a brush and struct a script struct with no model selected


ModmeBot:

Reply By: Abnormal202

hahaDuNOOB
Abnormal202

to get a struct in script use:

name = struct::get(name, "targetname");



and you can use a move command such as MoveTo, and make it go to the origin of the struct:

dummy MoveTo( name.origin, 2,)

^1
^1^
^1ERR(6E) scripts/zm/zm_waeponsonly.gsc (94,0)  : Compiler Internal Error :  Uninitialized local variable 'test_struct'


function test()
{
	trigger = GetEnt("test_trigger", "targetname");
	brush = GetEnt("test_brush", "targetname");
	struct = struct::get( test_struct ,"targetname" );

	trigger waittill("trigger", player);
	brush MoveTo(test_struct.origin, 2);

}

In Radiant you should have defined the struct as targetname = test_struct . However in script, you define that struct as just "struct". you should change the MoveTo function to:

brush MoveTo(struct.origin, 2);


ModmeBot:

Reply By: hahaDuNOOB

Abnormal202

to get a struct in script use:

name = struct::get(name, "targetname");



and you can use a move command such as MoveTo, and make it go to the origin of the struct:

dummy MoveTo( name.origin, 2,)

my script dont finde my struct


ModmeBot:

Reply By: Abnormal202

hahaDuNOOB
Abnormal202

to get a struct in script use:

name = struct::get(name, "targetname");



and you can use a move command such as MoveTo, and make it go to the origin of the struct:

dummy MoveTo( name.origin, 2,)

my script dont finde my struct

Did you give your struct the same targetname as you define in script?


ModmeBot:

Reply By: hahaDuNOOB

Abnormal202
hahaDuNOOB
Abnormal202

to get a struct in script use:

name = struct::get(name, "targetname");



and you can use a move command such as MoveTo, and make it go to the origin of the struct:

dummy MoveTo( name.origin, 2,)

my script dont finde my struct

Did you give your struct the same targetname as you define in script?

yea nsz says something with a variable


ModmeBot:

Reply By: mathfag

hahaDuNOOB
Abnormal202

to get a struct in script use:

name = struct::get(name, "targetname");



and you can use a move command such as MoveTo, and make it go to the origin of the struct:

dummy MoveTo( name.origin, 2,)

^1
^1^
^1ERR(6E) scripts/zm/zm_waeponsonly.gsc (94,0)  : Compiler Internal Error :  Uninitialized local variable 'test_struct'


function test()
{
	trigger = GetEnt("test_trigger", "targetname");
	brush = GetEnt("test_brush", "targetname");
	struct = struct::get( test_struct ,"targetname" );

	trigger waittill("trigger", player);
	brush MoveTo(test_struct.origin, 2);

}

The compiler doesn't see the struct because you didn't name it. You need to put the name in parenthesis and put the comma right after it (no space)

struct = struct::get( "test_struct","targetname" );


ModmeBot:

Reply By: Abnormal202

To be blunt, what's circled in red is the problem:

in radiant you give the struct the targetname "test_struct" but then in script you define that struct as just "struct". That means anything you do in script with it you must reference it as "struct", not "test_struct" because that is just the targetname of it, and it has no real meaning in script. It should be:

function test()
{
	trigger = GetEnt("test_trigger", "targetname");
	brush = GetEnt("test_brush", "targetname");
	struct = struct::get( test_struct ,"targetname" );

	trigger waittill("trigger", player);
	brush MoveTo(struct.origin, 2);

}


ModmeBot:

Reply By: hahaDuNOOB

thanks now its works :D