Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Railgun...another try
Railgun...another try
2002-02-22, 7:49 AM #1
I thought of another way than Hideki was going when he created his railgun cog. We could attach a cog to a projectile, in which we would handle the removed message and get the position of the projectile, then straighten the LVec of the projectile and add it to the position. This new vector would point to a position behind the object, which was still in the line of fire. There we could create a ghost, which we would use to fire a new projectile from.

Now my problem is that I never managed to fire the new projectile. I tried FireProjectile and CreateThing, then change the projectiles speed, but none of those worked persistently. The bullet was most of the times suddenly removed after creation. Any idea why?
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2002-02-22, 4:18 PM #2
As I actually tested the cog (not the one in the tutorial, I regenerated that code from top of my head after I cancelled EPME), it worked without a problem.

The only thing that I didn't manage to get right is the distance the projectile has to be fired from the removed position of the previous bullet. Since I never tested that distance for the tutorial cog, I think that is the problem.

Fires the projectile - projectile hits an object(removed) - if hit on an actor(check the source type) reproduce a little further from where it hit to avoid multiple hits -> continues.

That's the logic I used and worked once.

------------------
http://millennium.massassi.net - Millennium
Sniper Arena! - Enhancement Pack!
2002-02-23, 1:09 AM #3
So the Source in removed is a wall or thing that blocks the way?
And how did you reproduce it? FireProjectile?
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2002-02-23, 2:25 AM #4
It's easy to determine whether the blocked source is a wall or a thing, use GetThingType on the source and if it returns as an actor or a player, then reproduce with FireProjectile(that's what it says on the tutorial, I didn't change that from the original cog)

------------------
http://millennium.massassi.net - Millennium
Sniper Arena! - Enhancement Pack!
2002-02-23, 9:14 AM #5
yeah, but you did not use the removed message, but the touched message. I never managed to get a wall in the touched message...
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2002-02-23, 2:17 PM #6
well, my cog works now. I get the position behind an object as a vector. I can also create things and move them to this position. But I cant fire a projectile from there. Why?
I use this (firething is the ghost, newposition the valid vector pointing to the new spot):

dummy = CreateThing(firething, 0);
SetThingPos(dummy, newposition);
FireProjectile(dummy, projectile, etc.);

If I change the ghost into a crossbow, there is a crossbow showing up at the spot, but no projectile is fired...

[This message has been edited by zagibu (edited February 23, 2002).]
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2002-02-23, 3:28 PM #7
Not sure but,

I wouldn't recommend using SetThingPos(); its an evil verb. [http://forums.massassi.net/html/wink.gif] I think things retain their original sector information even after they are 'set' to the new postion.

Why not just use CreateThingAtPos(); ? If you can get the projectiles finally Postion, I can't see why you couldn't get its final sector.
- Wisdom is 99% experience, 1% knowledge. -
2002-02-23, 3:38 PM #8
hmmm...yeah
but that's not the problem. Everything works fine, except the FireProjectile.
And actually...how do I get a sector with a vector (position)?

[This message has been edited by zagibu (edited February 23, 2002).]
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2002-02-23, 7:30 PM #9
Quote:
<font face="Verdana, Arial" size="2">Originally posted by zagibu:
how do I get a sector with a vector (position)?</font>


I think it's a pretty tough math problem, and I don't know how you can do that. There was a topic on it a while ago but that was not a perfect solution anyway.

As said above, don't use SetThingPos, add the position vector inside the FireProjectile verb in the one of the middle parenthesis.

Code:
touched:

   if(GetSourceType() != actorType || GetSourceType() != playerType) return;

   bullet = getsenderref();
   pos = VectorAdd(GetThingPos(bullet), '0 10 0');

   FireProjectile(bullet, getthingtemplate(bullet), -1, -1, pos, '0 0 0', 0, 0, 0, 0);

Is it something like this? Not sure about the "10" as I said above.

------------------
http://millennium.massassi.net - Millennium
Sniper Arena! - Enhancement Pack!

[This message has been edited by Hideki (edited February 23, 2002).]
2002-02-23, 11:11 PM #10
thats a good idea, but instead of using '0 10 0' i'd recommend using the LVec of the bullet (scale it down, cause its 1 JKU long)...thank you
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2002-02-24, 12:13 AM #11
it doesn't work. I used that:
Code:
removed:
projectile = GetSenderRef();

direction = GetThingLVec(projectile);
scaled = VectorScale(direction, 0.3);
FireProjectile(projectile, boltfinal, -1, -1, scaled, '0 0 0', 0, 0x0, -1, -1);
return;


Nothing is fired...
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2002-02-24, 3:19 AM #12
I don't know why a projectile just don't get fired but that '0 10 0' vector is the vector that will get added to the current position toward the looking vector of the firing thing, so if you add a looking vector on TOP of the current looking vector, it goes a little wrong.

Attach a cog to the newly created thing(if it's the same proj, then in the same cog) and make a print in the created message to debug.

------------------
http://millennium.massassi.net - Millennium
Sniper Arena! - Enhancement Pack!
2002-02-25, 5:45 AM #13
I'm not sure why your projectile does not appear, but I noticed two things...

1) The removed message has no sourceref.

2)
Code:
scaled = VectorScale(direction, 0.3);
FireProjectile(projectile, boltfinal, -1, -1, scaled, '0 0 0', 0, 0x0, -1, -1);


You should use:

Code:
FireProjectile(projectile, boltfinal, -1, -1, '0 0.3 0', '0 0 0', 0, 0x0, -1, -1);


I think you're going to have problems the other way.


If you could compile a small mod to demonstrate your problem, I'll see what I can do to fix the problem.

------------------
Each cog better than the next
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-02-25, 9:28 AM #14
What exactly are you guys trying to do?

a heat seeker or something? if so i have a good cog that works well...
I'm just an old man with a skooma problem.
2002-02-26, 1:20 AM #15
GuNbOy, the topic says what he wants [http://forums.massassi.net/html/smile.gif]
A railgun cog, that goes through victims all the way until hitting a wall or disappears in the sky.

------------------
http://millennium.massassi.net - Millennium
Sniper Arena! - Enhancement Pack!
2002-03-01, 8:00 AM #16
it should also go through walls...and I think it will work with Hidekis hint...
thanks
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2002-03-01, 10:45 AM #17
i give it up. You can't just add a fireoffset in the FireProjectile verb. It won't go through walls. And SetThingPos really seems to be an evil verb...no luck with it. Anyway...let me know when you got the effect working.
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2002-03-01, 10:58 AM #18
It won't go through walls!

The engine has the limitation of not letting anything go beyond the geometry border, if it goes, you know, it will HOM and stay there walling forever.

The best, go through victims' bodies.

------------------
http://millennium.massassi.net - Millennium
Sniper Arena! - Enhancement Pack!

↑ Up to the top!