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 → FireProjectile Vector
FireProjectile Vector
2001-04-22, 1:17 PM #1
I asked this question before but the answer I got didn't work. The projectile still just fires in one direction:
playerv=GetThingPos(player);
thingv=GetThingPos(athing);
firevector = VectorSub(thingv,playerv);
FireProjectile(athing,projectile,sound,-1,'0.0 0.0 0.0',firevector,1,0x60,360,1000);

Does anybody see any problems? athing is the thing that's firing the projectile.


[This message has been edited by nerdboy_2000 (edited April 22, 2001).]
"Jedi Masters don't wear togas."
2001-04-22, 1:22 PM #2
u do define what the player is right?
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-04-22, 1:40 PM #3
If you're trying to shoot the player from "athing", then you probably don't need auto aiming.

And also, subtract player vec from thing vec, so it goes from the thing to the player, and not otherwise.

firevector = VectorSub(GetThingPos(athing), GetThingPos(player));

FireProjectile(athing, projectile, sound, -1, '0 0 0', firevector, 1, 0, 0, 0);

------------------
http://millennium.massassi.net/ - Millennium
2001-04-22, 1:43 PM #4
i think he is trying to shoot a prjectile from athing at the player not shoot the player from athing unless i looked at this wrong
and hideki my endurance cog still isn't working
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-04-22, 2:15 PM #5
Yes, athing is shooting at player. and player is defined. Turning off autofire still makes it shoot in one direction.

[This message has been edited by nerdboy_2000 (edited April 22, 2001).]
"Jedi Masters don't wear togas."
2001-04-22, 4:24 PM #6
Did you set "firevector" as a vector in the symbols?

You might want to put

PrintVector(firevector);

in there to see if it's changing dynamically or else.

------------------
http://millennium.massassi.net/ - Millennium
2001-04-23, 11:02 AM #7
The vector is dynamically changing. I'll just post the cog and see you can find any problem.
Code:
symbols
sector    firesector=0			linkid=1

thing     ghost=1
thing     player				local

template  projectile=+concbullet                    

sound     soundfile=00alarmloop01.wav

vector    whereghost   local
vector    whereplayer  local
vector    firevector   local

message     pulse
message	    entered

end

code
startup:
	SetPulse(1.0);
	return;

pulse:
	player=FirstThingInSector(firesector);
	while(player!=-1)
	{
		if(GetThingType(player)==10)
		{
			whereplayer=GetThingPos(player);
			whereghost=GetThingPos(ghost);
			firevector = VectorSub(whereplayer,whereghost);
			FireProjectile(ghost,projectile,sound,-1,'0.0 0.0 0.0',firevector,1,0,0,0);

		}
		player=NextThingInSector(firesector);
	}
   return;

end


[EDIT: Added Code Tags]

[This message has been edited by nerdboy_2000 (edited April 23, 2001).]
"Jedi Masters don't wear togas."
2001-04-23, 11:32 AM #8
one thing u have
Code:
message pulse
message entered

but then in your actual code u only have the pulse and a startup which isn't even in your symbols, so that message is never being used since it is not in the symbols thus player never gets defined, i think
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-04-23, 12:25 PM #9
When I copied and pasted I meant to remove the entered message, it was left from a eariler idea. Startup is there in the actual thing.
"Jedi Masters don't wear togas."
2001-04-23, 1:01 PM #10
Hideki u can handle this i am once again stumped. Sorry i can't ehlp i will tinker with your cog but that never gets much done.

------------------
Join the army,
Visit new places,
Meet new people,
Then drop bombs on them
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-04-25, 11:13 AM #11
Thanks for tweeking with it. I'm glad to see that it's not a simple mistake I made. Reply if you find a mistake.
"Jedi Masters don't wear togas."
2001-04-25, 2:13 PM #12
i don't know what is wrong yet but u have tried using entered right? that would be your best bet i think

------------------
Join the army,
Visit new places,
Meet new people,
Then drop bombs on them
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-04-25, 2:45 PM #13
I did try using entered once. I'll try it that way and see how it works.
"Jedi Masters don't wear togas."
2001-05-02, 12:07 PM #14
Here's where you can download a box with the cog implanted and see how it works. If you're in a textured area it won't fire at you:
http://members.nbci.com/kayjrpgs/SectorFire.zip
Can you tell me what's wrong?
"Jedi Masters don't wear togas."
2001-05-03, 2:56 PM #15
i'll look at it as soon as possible but i can't for a few days sorry

------------------
Join the army,
Visit new places,
Meet new people,
Then drop bombs on them
roses are red, violets are blue, I am schizophrenic, and I am too!
2001-05-04, 11:35 AM #16
Thanks for your help.
"Jedi Masters don't wear togas."
2001-05-14, 11:37 AM #17
Sorry to bug people about this again but if nobody can find an error, can someone point me to an existing cog that starts firing something from a ghost position and aims at the player in the room? Thanks in advance.
"Jedi Masters don't wear togas."
2001-05-14, 11:41 AM #18
Um... YOu could do GetThingIn Sight
and GetThingPos than do SetThingLookPos, all in a 'pulse'
Hey, I'm here! But who cares?
2001-05-14, 12:01 PM #19
try subtracting the player position from the ghost position
2001-05-14, 1:50 PM #20
I've tried Jipe's idea, I'll try scott's in a little bit. I move the ghost in jed and found that the cog is fire the projectile in whatever the inital direction of the ghost object is. Anyway, the code again if it helps:
Code:
symbols

sector    firesector=0			linkid=1

thing     ghost=1
thing     player				local

template  projectile=+concbullet                    

sound     soundfile=00alarmloop01.wav

vector    whereghost   local
vector    whereplayer  local
vector    firevector   local

message     startup
message     pulse
message	    entered

end

# ========================================================================================
code
startup:
	SetPulse(1.0);
	return;
# ........................................................................................
pulse:
	player=FirstThingInSector(firesector);
	while(player!=-1)
	{
		if(GetThingType(player)==10)
		{
			//where=GetThingSector(GetSourceRef());
			Print("Fire!");
			whereplayer=GetThingPos(player);
			whereghost=GetThingPos(ghost);
			firevector = VectorSub(whereghost,whereplayer);
			FireProjectile(ghost,projectile,sound,-1,'0.0 0.0 0.0',firevector,1,0,0,0);
PrintVector(firevector);
		}
		player=NextThingInSector(firesector);
	}
   return;
# ........................................................................................

end


[This message has been edited by nerdboy_2000 (edited May 14, 2001).]
"Jedi Masters don't wear togas."

↑ Up to the top!