determine a brushes dimensions
is there a way to copy the dimensions of a clipped brush with
gameype script? i mean, when i have a not boxshaped trigger brush,
i can find it by its classname and create a new entity, which i
want to have the same shape as the original trigger. i couldnt find
a function to use for this. are entities spawned from gametype
script bound have a cuboid collision box to trigger the touch
funtion?
I'm not sure to understand the question.
This is how you set a brush model:
// set up the trigger
void trigger_capture_area( cEntity @ent )
{
ent.setupModel( ent.getModelString() ); // set up the brush model
ent.solid = SOLID_TRIGGER;
ent.linkEntity();
ent.wait = 0;
// add a check to free the trigger if it isn't targeting a capture area
ent.nextThink = levelTime + 1;
}
This is how you set a brush model:
// set up the trigger
void trigger_capture_area( cEntity @ent )
{
ent.setupModel( ent.getModelString() ); // set up the brush model
ent.solid = SOLID_TRIGGER;
ent.linkEntity();
ent.wait = 0;
// add a check to free the trigger if it isn't targeting a capture area
ent.nextThink = levelTime + 1;
}
right, basically that was it.
still the other part of the question remains unsolved. and for the fun of it lets make it a whole new problem
i try to get an entity by name like this
taken another approach i find what i want.
u see where i am going ;)
the factory funtion of Pk_Jumppad (or w/e it is called) is never reached, neither is the think function :(
how do i spawn it correctly? i should just ditch it and introduce a new map entity, i know.
still the other part of the question remains unsolved. and for the fun of it lets make it a whole new problem
i try to get an entity by name like this
void WswJpsToPkJp()but it crashed, with an error in G_Render, said, couldnt create any more edict_t and deletet my cfg.
{
cEntity @ent=G_GetEntity( 0 );
while((G_FindEntityWithClassname( ent, "trigger_push" )) != null)
WswJpToPkJp(ent);
}
taken another approach i find what i want.
void Pk_Jumppad_think( cEntity @ent )
{
ent.nextThink = levelTime + 1;
G_Print("PkPad think");
}
void Pk_Jumppad( cEntity @ent )
{
G_Print("PkPad spawned");
cPkJumppad thisPkJumppad( ent ); // spawn a local holder
}
void WswJpToPkJp(cEntity @ent)
{
cEntity @ePkJp;
cVec3 a, b;
@ePkJp = @G_SpawnEntity( "Pk_Jumppad" );
ent.freeEntity();
ePkJp.linkEntity();
}
//call this from GT_SpawnGametype() to turn normal jumppads into painkiller jumppads
void WswJpsToPkJp()
{
int maxEs;
cEntity @ent;
cString name;
for ( maxEs = 1; maxEs < numEntities; maxEs++)
G_Print(G_GetEntity(maxEs).getClassName( ) + "");
for ( maxEs = 1; maxEs < numEntities; maxEs++)
{
name = G_GetEntity(maxEs).getClassName( );
if( name == "trigger_push" )
{
@ent = G_GetEntity(maxEs);
printit(ent);
WswJpToPkJp(ent);
}
}
}
u see where i am going ;)
the factory funtion of Pk_Jumppad (or w/e it is called) is never reached, neither is the think function :(
how do i spawn it correctly? i should just ditch it and introduce a new map entity, i know.
cEntity @ent;
while(true) {
@ent = @G_FindEntityWithClassname(@ent, "fdsa");
if(@ent == null) {
break;
}
// stuff
}
and I guess
cEntity @ent;
while((@ent = @G_FindEntityWithClassname(@ent, "fdsa")) != null) {
// stuff
}
would work too
edit: missed a brace
The second one doesn't work in angelscript. Or it didn't work,
don't remember if it was fixed afterwards.

