Help with the back door on Battery


(Nothus) #1

Inspired by the work of ETPro, I was hoping to make the back door dynamite-able on battery for my own little server mod that just me and my friend use.

I’ve gotten it started, but am having some problems getting it to work.

Inside “G_SpawnEntitiesFromString” in g_spawn.c I call a little func that runs this bit of code:


		gentity_t *backDoor, *backDoor_TOI;
		int cix;


		backDoor = G_Spawn();

		backDoor->scriptName = "backdoor";
		backDoor->classname = "func_explosive";
		backDoor->targetname = "backdoor";
		backDoor->spawnflags = 1; // AXIS_OBJECTIVE(1)
		backDoor->s.eFlags = 65536;  // EF_FAKEBMODEL 
		backDoor->r.svFlags = 1; //SVF_NOCLIENT
		backDoor->s.dmgFlags = HINT_DYNAMITE;

		backDoor->model = "*39";

		VectorCopy("-63 -10 0", backDoor->r.mins);
		VectorCopy("63 10 128", backDoor->r.maxs);

		VectorCopy( "4608 -4594 1024", backDoor->s.origin);	
		VectorCopy( backDoor->s.origin, backDoor->s.pos.trBase );
		VectorCopy( backDoor->s.origin, backDoor->r.currentOrigin );

		backDoor->targetnamehash = BG_StringHashValue( backDoor->targetname );

		G_CallSpawn(backDoor);

		backDoor_TOI = G_Spawn();

		backDoor_TOI->scriptName = "backdoor_obj";
		backDoor_TOI->classname = "trigger_objective_info";
		backDoor_TOI->targetname = "backdoor_obj";
		backDoor_TOI->target = "backDoor";
		backDoor_TOI->spawnflags = 17; // AXIS_OBJECTIVE(1) | CUSTOMIMAGE 
		backDoor_TOI->s.eFlags = 65536;  // EF_FAKEBMODEL 
		backDoor_TOI->r.svFlags = 1; //SVF_NOCLIENT
		backDoor_TOI->track = "the Back Door";
		backDoor_TOI->message = "Back Door";
		
		cix = G_ShaderIndex("gfx/limbo/cm_radar_maindoor");

		backDoor_TOI->s.modelindex2 = cix;

		backDoor_TOI->model = "*39";
	
		VectorCopy("-95 -85 0", backDoor_TOI->r.mins);
		VectorCopy("95 85 128", backDoor_TOI->r.maxs);

		VectorCopy( "4608 -4601 1024", backDoor_TOI->s.origin);	
		VectorCopy( backDoor_TOI->s.origin, backDoor_TOI->s.pos.trBase );
		VectorCopy( backDoor_TOI->s.origin, backDoor_TOI->r.currentOrigin );

		backDoor_TOI->targetnamehash = BG_StringHashValue( backDoor_TOI->targetname );
	
		G_CallSpawn(backDoor_TOI);

Major props to ETPro for the basic entity info, which I used from their map script.

I get a dynamite icon to show up in the cmd map, but its way over on the beach, by the allied spawn, and the door doesn’t show any hints when you walk near it. I tried using the etpro map script, just to have everything in place to test, and it still didn’t work.

Any help or ideas are welcome!


(Nothus) #2

Also, the icon for the axis team doesn’t work - it should be the main door from Radar, but its a orange square instead.


(kamikazee) #3

I believe the ET 2.60 code supports ETPro mapscripting natively. Why wouldn’t you use the ETPro mapscript then, instead of writing this code?


(jaybird) #4

The SDK does not support the ‘create’ script or the fake brush model stuff. These are really the only 2 missing pieces.


(Nothus) #5

Your right - “create” and the fakebrush isn’t supported, but I can bascially hard code these things into the mod for battery’s sake (which is what I did to accomplish what ETPro did with the create cmd in their battery script file).

So, I can do anything they can, at least as a hard coded hack - I just don’t know what all they did behind the scenes to make it work, and hope someone here does, or can point me in the right direction.


(SCDS_reyalP) #6

TOIs have special stuff that needs to be done to set them up. See src/game/g_trigger.c:SP_trigger_objective_info
Notice that some stuff is ready directly from spawnstrings at that point. (maybe you changed that and just didn’t paste it here ?)

Didn’t ETPub implement etpro compatible map scripting ? In that case, you might just want to borrow the create and fakebrush code from them.


(Nothus) #7

I added everything that was available in the ETPro map script, but they may have other things setup behind the scenes to make it all work that I’m missing and can’t see without access to their code, or help from the coder.

Thanks for the tip about ETPub - I’ll check it out, and give credit where its due if it works out.

Thanks!