News | Forum | People | FAQ | Links | Search | Register | Log in
Coding Help
This is a counterpart to the "Mapping Help" thread. If you need help with QuakeC coding, or questions about how to do some engine modification, this is the place for you! We've got a few coders here on the forum and hopefully someone knows the answer.
First | Previous | Next | Last
You'll Want To... 
First remove the local variable org from within BFGBlast(), then add an argument so: BFGBlast(vector org) = {...

Then in your code where you do your head finding and t_damage, you can add just after that t_damage() a call BFGBlast(head.origin); to pass the location on to that spawn function for the explosion. In BFGBlast() you'll want to change it from self to be a newent so:

local entity newent;
newent = spawn(); //create new entity to become the blast
newent.origin = org; //set location to the ending of the lightning
newent.movetype = MOVETYPE_NONE;
newent.velocity = '0 0 0';
newent.touch = SUB_Null;
setmodel (newent, "progs/bfgblast.spr");
newent.solid = SOLID_NOT;
bfgexpl1 ();
sound (newent, CHAN_WEAPON, "weapons/bfgblast.wav", 1, ATTN_NORM); 
BFGBlast(vector Org) = {... 
I don't get this part. This sure is not the start of a declaration (and isn't supposed to replace "void() BFG_Blast ="), as FTEQCC pointed out, but you said it's an argument... where should I put it? What should I put inside? 
The Argument... 
The argument goes inside the parenthesis so:
void () BFGBlast becomes:
void (vector org) BFGBlast

OR

void BFGBlast (vector org)

either way you like at the start of your function.

The newent stuff is so you create a new entity for each lightning endpoint effect rather than keep moving only one otherwise if the main blast shot out at multiple targets you would only see the sprite effect on one of them. 
... 
Inside your BFG_Expl function is where you would call your BFGBlast function, rigt after T_damage. Whenyou put head.origin inthe parentheses: BFGBlast(head.origin); you are telling it to use the end position of your lightning as the value of "org" inside your BFGBlast function. 
DP Crash With The BFG 
Thanks for your help QMaster. Now I'm testing it on Darkplaces, I get the gun, I fire it, the charging animation goes on, as just 0.1 second after the orb is fired, it crashes:
http://image.noelshack.com/fichiers/2016/04/1453973467-razenkrauft20160128102949-00.jpg

I also noticed it fired from off-center, somehow.

Here are the codes related to the BFG9500:
http://pastebin.com/5FdLg59C 
Another Thing, Related To Item Slots 
The BFG's item slot is stored at the value of 16777216 (Infantry Gun is 128, Gatling Gun is 8388608), but when I pick it up, both shotguns disappear from my inventory and the original nailgun pops in it. Which value shouyld I put it? 16777216 is nowhere else to be found in defs.qc btw. 
 
Sounds like a integer overflow. 
Ok, So How Do I Fix It? 
 
ALLCAPS - Quake Maps In Unity?! 
Dude I can test shit for you! 
Hmm 
Try changing the line in BFGBlast() from this:

bfgblast1();

To this:

newent.think = bfgblast1;
newent.nextthink = time + 0.100;

and also change effects from self to newent: newent.effects = newent.effects | EF_DIMLIGHT; //gives light to the end point

That might fix it, but I doubt it. 
It Didn't Change Anything, Sorry 
One thing I noticed about the BFG firing off-center is that it seems to be arbitrarely firing at a fixed point, as seen here just before crashing:
http://image.noelshack.com/fichiers/2016/04/1453996496-razenkrauft20160128165312-00.jpg
And it's not the collision that crashes it: it seems like 0.05/0.1 second after firing the orb DP just crashes (I just tested firing against a wall: I could see the explosion sprite appearing just before crashing).
Maybe it has something to do with the lightning bolt continuous strikes checking for enemies?

Anyway, I won't be able to reply in here from now until Sunday, but feel freee to help on my case. 
Found It! 
//head = head.chain; // cycle to next head (entity)

You commented out this line in bfgball think. What this does is cycle through the list of returned entities from findradius until the list is empty at which point head becomes null. Since you don't actually cycle the list, head never becomes null and the code is stuck in the while(head) loop forever...until the engine notices it and crashes to console. 
Whats The Most Complex Monster? 
More a question of how far you can take standard quake that is. But what is / was the most complex monster behavior that has been done or attempted using standard quake? I do know that Arcane added some handy hint nodes if I remember correctly but has there been anything else that is of note when it comes to monster behaviors? 
Skiffy 
I think necros did some pretty badass shit in ne_ruins.

A-star pathfinding, some rather complex boss stuff... 
 
Surely bots have the most complex AI 
 
ne_ruins was amazing indeed. Thanks for reminding me. I do wonder why nobody ever followed up using that as a base to make even more content. But indeed individual monster behaviors and reactions to the players and each other. How far was that taken in quake over the years is what I wonder. 
Bots 
Are the most complex, but players complain when enemies have similar behaviours.

Bosses are complex, and the enemies of Nehara had a lot behind how they thought and moved.

Ultimately, ITS is probably the most complex, although that was a pure navigation system to some extent. 
 
I tried a couple of times to write a tutorial to let people integrate the ne_ruins navigation system, but it always ended up being really complicated and needing hooks into a few other places :( 
Ne_ruins 
I only played ne_ruins once, back when it was first released, but I remember those zombies and I still think they are one of best Quake custom monsters ever. 
Necros Must Try Again! :) 
 
QMaster 
I did what you said, and while the BFG orb doesn't crash, this is what happens:

*Picking up the BFG removes from the inventory all shotguns, puts in the nailgun, and all others inventory fuckery.
*The orb still fires at an arbitrary point in the map, probably a monster's waypoint beyond a wall.
*After firing, the upcoming weapon animation don't come up.
*When the orb collides with the world, only the particle explosion happen. No sound, no explosion sprite.
*When the orb collides with a monster, it changes direction.
*The proximity lightning which happens when the orb's active and an enemy is near it, it only happens when both the orb and the player are close to each other, and the lightning comes from the player.
*If the orb collides with an enemy and i'm too close to it, I die.

With all of this stuff happening, I'm just gonna post all of the qc files that mentions the BFG9500, since I just have absolutely no idea what's really going on, nor a single hint on how to fix it.
weapons.qc: http://pastebin.com/gW3P42yr
items.qc: http://pastebin.com/3u1ddwZM
defs.qc: http://pastebin.com/nV7xYWxH
player.qc: http://pastebin.com/DdyRggCm 
Item Erasure 
As someone has already mentioned in the post above, your IT_BFG9500 value is too large, and that's what's removing the other items. Because you've got other weapons you're running out of space. One way out would be to use the slot from IT_SUPERHEALTH instead, it doesn't appear on the HUD when you set that, so you can safely remove it from the megahealth code.

You might also want to look at the mission pack 2 code, which uses an extra field called items2 to store more of the player inventory. There is extra support in the HUD for items2 if you use the mission pack command line switches as well. 
Wrong Direction Of Attack 
The BFG shot goes in the wrong direction because of this line:

BFGShot(org, self.enemy.origin - self.origin);


It's important to know at this point which entity is self. It is the player. The problem is that the player does not have an enemy, because that's for the AI entities. So what's the default value if you don't have AI? The world!

This means that self.enemy.origin - self.origin is calculating the direction to the centre of the world. Instead you want to fire in the direction that the player is facing. When you do makevectors (self.v_angle); the direction the player faces is stored in a global called v_forward. So the fixes are:

1) Replace
makevectors (self.angles);
with
makevectors (self.v_angle);

2) Replace
BFGShot(org, self.enemy.origin - self.origin);
with
BFGShot(org, v_forward); 
One Thought At A Time 
Now we come to

bfgsphere.nextthink = time + 0.1;
bfgsphere.think = bfgshot1;

self.nextthink = time + 0.1;
self.think = bfg_ball_think;

bfgsphere.nextthink = time + 5;
bfgsphere.think = SUB_Remove;

This segment of code is well intentioned but quite confused. The first thing to ask again is which entity is self? It is still the player! So the first step towards getting this working would be to change those from self to bfgsphere:

bfgsphere.nextthink = time + 0.1;
bfgsphere.think = bfgshot1;

bfgsphere.nextthink = time + 0.1;
bfgsphere.think = bfg_ball_think;

bfgsphere.nextthink = time + 5;
bfgsphere.think = SUB_Remove;

Now I ask what is stored in bfgsphere.think at the end of these 6 lines? It is SUB_Remove, because that last line overwrites the previous code which set it to bfg_ball_think, which itself overwrote bfgshot1.

I'm not going to post the solution yet, because this has tripped you up before Daya, and I wanna make sure the problem makes sense before we look at solving it. I fear in the past I've gone too fast over this issue which is why it's recurred... 
The Thinks Must Be In Decreasing Order, Correct? 
This is what I did (and the other stuff too) while changing bfg_ball_think's think back to 0.3.

After all that, the projectile almost works: the orb animates properly, it fires at the direction I want it to fire, it produces the so-called blast after impact.

However the continuous lightning strikes from the orb still doesn't happen, colliding with the world without hitting an enemy don't spawn particles and says this: http://image.noelshack.com/fichiers/2016/05/1454319929-razenkrauft20160201104422-00.jpg , colliding with an enemy that gets gibbed still sends the orb to another direction, none of the explosion sprites (both orb impact and blast) show-up, when the blast happens the particle effect that should appear on the enemy appears instead at the origin point of the blast, and when I'm too close to the impact I get targeted by the blast, even though the code should avoid that.

Here's the code in weapons.qc once again, as I've added some more stuff in addition to yours: http://pastebin.com/EAV4PayU 
First | Previous | Next | Last
You must be logged in to post in this thread.
Website copyright © 2002-2024 John Fitzgibbons. All posts are copyright their respective authors.