Forum

how come this code doesnt get called?

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

how come this code doesnt get called?

Postby ThePlasticBling » Tue May 10, 2011 7:42 pm

Code: Select all
void() Portal1Touch = {
   // Handles touch with Blue portal
   local float vel;
   local vector org;
   local vector oldvel;
   local string temp2;
   
   if (portal2_exist==0) return;
   if (self.frags>time) return;

   vel=vlen(other.velocity) + PORTAL_KICK;
   oldvel = other.velocity;
         
   org=portal_clip_player(portal2_entity);

   other.origin = org;
   other.nextthink1 = other.nextthink;
   other.nextthink = time + 0.1;
   other.think1 = other.think;
   other.think = SUB_teleport;

   PortalTeleportEffect(self);
   PortalTeleportEffect(portal2_entity);

   self.frags = time + PORTAL_REFIRE;
   portal2_entity.frags = time + PORTAL_REFIRE;

   other.fixangle = 1;
   other.velocity = vel * portal2_entity.punchangle * PORTAL_BUFFER;
   if ((other.velocity_x == 0) && (other.velocity_y == 0)) {
      other.velocity_x = oldvel_x / 2;
      other.velocity_y = oldvel_y / 2;
   }
   other.angles_x = 0;
   other.angles_y = vectoyaw(other.velocity);
   other.angles_z = 0;
   other.v_angle_z = 0;
   other.flags = other.flags - other.flags & FL_ONGROUND;
   
   if (other.classname == "invalidwall")
   {
      PortalErase(portal1_entity);
   }
      
};

void() notwall =
{
   self.solid = SOLID_BSP;
   self.movetype = MOVETYPE_PUSH;
   setorigin (self, self.origin);   
   setmodel (self, self.model);
   self.classname = "invalidwall";
}:


OK, so i tie a wall in worldcraft to notwall (the second function) and then when the portal touches it, PortalErase (portal1_entity); does not execute? why?
ThePlasticBling
 
Posts: 51
Joined: Fri Jun 04, 2010 10:18 pm

Re: how come this code doesnt get called?

Postby frag.machine » Tue May 10, 2011 8:55 pm

ThePlasticBling wrote:
Code: Select all
void() Portal1Touch = {
   // Handles touch with Blue portal
   local float vel;
   local vector org;
   local vector oldvel;
   local string temp2;
   
   if (portal2_exist==0) return;
   if (self.frags>time) return;

   vel=vlen(other.velocity) + PORTAL_KICK;
   oldvel = other.velocity;
         
   org=portal_clip_player(portal2_entity);

   other.origin = org;
   other.nextthink1 = other.nextthink;
   other.nextthink = time + 0.1;
   other.think1 = other.think;
   other.think = SUB_teleport;

   PortalTeleportEffect(self);
   PortalTeleportEffect(portal2_entity);

   self.frags = time + PORTAL_REFIRE;
   portal2_entity.frags = time + PORTAL_REFIRE;

   other.fixangle = 1;
   other.velocity = vel * portal2_entity.punchangle * PORTAL_BUFFER;
   if ((other.velocity_x == 0) && (other.velocity_y == 0)) {
      other.velocity_x = oldvel_x / 2;
      other.velocity_y = oldvel_y / 2;
   }
   other.angles_x = 0;
   other.angles_y = vectoyaw(other.velocity);
   other.angles_z = 0;
   other.v_angle_z = 0;
   other.flags = other.flags - other.flags & FL_ONGROUND;
   
   if (other.classname == "invalidwall")
   {
      PortalErase(portal1_entity);
   }
      
};

void() notwall =
{
   self.solid = SOLID_BSP;
   self.movetype = MOVETYPE_PUSH;
   setorigin (self, self.origin);   
   setmodel (self, self.model);
   self.classname = "invalidwall";
}:


OK, so i tie a wall in worldcraft to notwall (the second function) and then when the portal touches it, PortalErase (portal1_entity); does not execute? why?


try replacing

Code: Select all
   if (other.classname == "invalidwall")
   {
      PortalErase(portal1_entity);
   }


with:
Code: Select all
  bprint ("notwall @ ");
  bprint (vtos (self.origin));
  bprint (" touched by ");
  bprint (other.classname);
  bprint ("\n");


And see what is printed when they touch each other.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2090
Joined: Sat Nov 25, 2006 1:49 pm

Postby ThePlasticBling » Wed May 11, 2011 12:28 am

nothing is printed
ThePlasticBling
 
Posts: 51
Joined: Fri Jun 04, 2010 10:18 pm

Postby frag.machine » Wed May 11, 2011 12:55 am

ThePlasticBling wrote:nothing is printed


Are you sure that Portal1Touch() is ever being called ? Is this supposed to be the touch handler for the nowall entity or to the portal entity ?
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2090
Joined: Sat Nov 25, 2006 1:49 pm

Postby ceriux » Wed May 11, 2011 2:04 am

basically if the wall is marked as an invalid wall, the portal doesnt stick. it just disappears.
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest