Posted By: Trooper119
You Pointer still working in Lite-C? - 09/05/08 04:40
I'm using free Light-C and have come across either a really easy or really odd problem depending on what I'm doing wrong. I have the following code called when a projectile hits the character. I get an "Error E1515: Invalid arguments in modelHit" when the program first runs. When I remove the 'you' instructions (and replace them with 'my's) the error goes away. I can plenty of code and examples to show you guys if you want, but I'm hoping this is the source of the problem.
Code above works just fine now, previously had a wait(1); then a remove(you); statement, removed and handled elsewhere in the code did the trick.
Code:
function modelHit() { switch(event_type) { case EVENT_IMPACT: addLine("Characters are colliding, Oh my!"); double modifierForUp = (3/4); double modifierForDown = (1/4); int launchAngle = 30; if(you.push == 2) //A projectile has hit the character { //Check velocity of projectile, character will impact in the same direction regardless of where you hit the projectile //my.skill1 = damage, my.skill2 = orientation if(you.velX <= 0) { //launch with a force 30 degrees into the air my.velX = -1 + you.damage * my.health * cos(launchAngle) * -1; my.velZ = 1 + you.damage * my.health * sin(launchAngle); } else { //launch with a force 30 degrees into the air my.velX = 1 + you.damage * my.health * cos(launchAngle); my.velZ = 1 + you.damage * my.health * sin(launchAngle); } my.health += you.damage; you.state = dead; //previously had the following code //wait(1); //ent_remove(you); //Now works just fine with //these too remove, commented it out here so others could see return; } } }
Code above works just fine now, previously had a wait(1); then a remove(you); statement, removed and handled elsewhere in the code did the trick.