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 → Scattergun Problema
Scattergun Problema
2004-03-01, 3:53 PM #1
I have a SP, JK actor with a weapon that I want to act as a scattergun(shotgunish).
I have tweaked this basic code countless times but no success [the fire message]: (the following is its actor cog.)
Code:
# Jedi Knight Cog Script
#
# ENEMY2.COG
#
# ACTOR Script - Enemy with scattergun
#
# Is modified from actor_s3.cog
#
# [F_Body]
#
# This Cog is Not supported by LucasArts Entertainment Co.

symbols

message     damaged
message     skill
message     fire

thing	    guy 		             local

template    projectile=+ebolt	     local

ai          flee_ai=noweapon.ai              local

int         bin                              local
int         senderref=-1                     local
int         dummy                            local 
int         damage                           local

end

# ========================================================================================

code

fire:
   guy = GetSourceRef();
   if(GetThingHealth(guy) <= 0)
   {
      Return;
   }
   dummy = FireProjectile(guy, projectile, -1, -1, '0.0098 0.057 0.01', '0 0 0', 1.0, 0x60, autoAimZFOV, autoAimXFOV);
   dummy = FireProjectile(guy, projectile, -1, -1, '0.0098 0.057 0.01', '0 0 0', 1.0, 0x60, autoAimZFOV, autoAimXFOV);
   dummy = FireProjectile(guy, projectile, -1, -1, '0.0098 0.057 0.01', '0 0 0', 1.0, 0x60, autoAimZFOV, autoAimXFOV);
   dummy = FireProjectile(guy, projectile, -1, -1, '0.0098 0.057 0.01', '0 0 0', 1.0, 0x60, autoAimZFOV, autoAimXFOV);
   dummy = FireProjectile(guy, projectile, -1, -1, '0.0098 0.057 0.01', '0 0 0', 1.0, 0x60, autoAimZFOV, autoAimXFOV);
   return;

# ........................................................................................

damaged:
   damage = GetParam(0);
   ReturnEx(damage);
   return;

# ........................................................................................

skill:
   bin = GetParam(0);
   if (bin == 24)                            // Force Pull
   {
      senderref = GetSenderRef();

      AISetClass(senderref, flee_ai);
      AIFlee(senderref, GetLocalPlayerThing());

      Return;
   }
   else
   if (bin == 31)                            // Force Grip
   {
      ReturnEx(10);                          // return base damage that is taken by this actor.
      Return;
   }
   else
   if (bin == 34)                            // Deadly Sight
   {
      ReturnEx(5);                           // return base damage that is taken by this actor.
      Return;
   }
   ReturnEx(-1);
   return;

# ........................................................................................

end

But it still shoots the only one weapon tpl I have designated it in the master.tpl
Any ideas? I tried looking at such cogs from SS3 but those are too complex with weapon modes, etc.

------------------
nil nip nada zip zero naught lip zil
This is retarded, and I mean drooling at the mouth
2004-03-01, 4:44 PM #2
Try a different template for this cog.

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.

The 2 riddle!
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2004-03-01, 4:50 PM #3
Look at the stormtrooper rifle cog. You are'nt spcifying the fire error. It's firing your projectiles, but they are all going along the same path and are at the same spot.

Try using this code instead
Code:
for(i = 0 ; i < 8 ; i = i + 1)
{
	rVec = VectorSet((Rand() - 0.5) * 15, (Rand() - 0.5) * 15, 0.0);
	FireProjectile(guy, projectile, -1, -1, '0.0098 0.057 0.01', rVec, 1.0, 0x60, autoAimFOV, autoAimXFOV);
}

The variable 'rvec' is of the 'vector' type.

------------------
I am Darth Slaw.
The Dark Lord of the Sith,
And part of the Nightfire mod team
May the mass times acceleration be with you.
2004-03-01, 4:56 PM #4
The problem is your having the shots come all from one spot.. Try it more like this:


Code:
dummy = FireProjectile(guy, projectile, -1, -1, '0.0098 0.051 0.01', '0 0 0', 1.0, 0x60, autoAimZFOV, autoAimXFOV);
dummy = FireProjectile(guy, projectile, -1, -1, '0.0098 0.052 0.01', '0 0 0', 1.0, 0x60, autoAimZFOV, autoAimXFOV);
dummy = FireProjectile(guy, projectile, -1, -1, '0.0098 0.053 0.01', '0 0 0', 1.0, 0x60, autoAimZFOV, autoAimXFOV);
dummy = FireProjectile(guy, projectile, -1, -1, '0.0098 0.054 0.01', '0 0 0', 1.0, 0x60, autoAimZFOV, autoAimXFOV);
dummy = FireProjectile(guy, projectile, -1, -1, '0.0098 0.055 0.01', '0 0 0', 1.0, 0x60, autoAimZFOV, autoAimXFOV);
return;


I'm not sure though.. O_o

[Edit: Didnt Format the Code correctly.. o.o]

[This message has been edited by Jedi_Nenshou (edited March 02, 2004).]
"Greetings young Padawan."

↑ Up to the top!