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 → Setthinglook makes my projectile disappear, WTF!
Setthinglook makes my projectile disappear, WTF!
2002-10-19, 8:32 AM #1
Code:
# Jedi Knight Cog Script
#
# FORCE_LIGHTNING.COG
#
# FORCEPOWER Script - Lightning
#  Dark Side Power
#  Bin 32
#
# [YB]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved


symbols

thing       player                           local

flex        cost=40.0                        local
int         rank                             local
int         mana                             local
int         bin                              local

template    auraflare=+dest_cloud            local
template    ball=+force_ltpeice                     local'
model       round=sphere2.3do local
model       long=aura.3do local
template    ring=+conccloud                  local
template    blast=+Force_repel               local
template    flash=+ssparks_saber             local
sound       fireSound=ForceLitning02.wav     local
int         fireChannel=-1                   local
int         modeTrack=-1                     local
sound       transform=transform.wav          local
flex        autoAimFOV=45                    local

message     startup
message     activated
message     deactivated
message     fire
message     killed
message     selected
message     pulse
message     timer

end

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

code

startup:
   player = GetLocalPlayerThing();
   aura=0;
   Return;

activated:
   ringcount=0;
   if(aura == 0)
    {
     aura=1;
     setpulse(0.01);
     setinvactivated(player, 21, 1);
   if(getinv(player, 14) >= 2)
    {
     randa=rand()*2;
     randb=rand()*2;
     if(randa < 1)
     {
     FireProjectile(player, flash, -1, -1, '0 0 0', '0 0 0', 1.0, 0, 0.0, 0.0);
      }
     randb=rand()*2;
     if(randb < 1)
     {
     FireProjectile(player, blast, -1, -1, '0 0 0', '0 0 0', 1.0, 0, 0.0, 0.0);
      }
     }
    }
    else
    if(aura == 1)
    {
     aura=0;
     call stop_power;
    }

   Return;

selected:
   jkPrintUNIString(player, 32);
   Return;

deactivated:
   bin = GetSenderRef();
   DeactivateBin(player, bin);
   
   Return;

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

killed:
   if(GetSenderRef() != player) Return;

   call stop_power;
   Return;

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

stop_power:
   setinv(player, 63, 1);
   setinvactivated(player, 21, 0);
   setpulse(0);
   if(getinvactive(player, 22) != 1)
     {
     setactorextraspeed(player, 0);
     }
   Return;

pulse:
player=getlocalplayerthing();
if(getthinghealth(player) > 0)
{
if(getinv(player, 14) >=2)
{
 if(getinvactive(player, 22) != 1)
    {
    setactorextraspeed(player, 2);
    }
    else
    { 
   return;
    }
setinv(player, 63, 2);
changeinv(player, 14, -0.5); 
thrust=getthingthrust(player);
if(vectorx(thrust) == 0 && vectory(thrust) == 0 && vectorz(thrust) == 0)
{
projectile=FireProjectile(player, ball, -1, -1, '0 0 0', '0, 0, 0', 1.0, 0, 0.0, 0.0);
setthingmodel(projectile, round);
}
else
{
if(isthingmoving(player) > 0)
{
projectile=FireProjectile(player, ball, -1, -1, '0 0 0', '0, 0, 0', 1.0, 0, 0.0, 0.0);
setthingmodel(projectile, long);
call align;
}
}
setlifeleft(projectile, 0.01);

if(getattachflags(player) == 0x1)
 {
  ringcount=ringcount+1;
  if(ringcount == 10)
    {
    ringcount=0;
    creatething(ring, player);
    }
 }
 }
 else
 {
 call stop_power;
 }
}
return;

align:

player=getlocalplayerthing();
SetThingLook(projectile,VectorSub(GetThingPos(player), GetThingPos(projectile)));

return;
end


This is a cog for a ki boost mode/ssj mode for my dragon ball Z mod.

It's quite l33t so far, except for the aura.

Here's what I'm trying to accomplish:

You notice that the projectiles have an 0.01 lifespan, just like the pulse.

The idea is that when the player is not moving or trying to move, it fires one aura 3do.

When the player is moving, it fires a different aura 3do, with a ki trail, and makes it point at him.

The problem is that, for whatever reason, the projectile disappears. I traced the problem down to setthinglook() in align: and I don't know what else to do, so I'll ask you guys.
2002-10-19, 9:50 AM #2
Aside from a plethora of unassigned or undefined variables, its "Isinvactivated", NOT "Getinvactive"...

Code:
# Jedi Knight Cog Script
#
# FORCE_LIGHTNING.COG
#
# FORCEPOWER Script - Lightning
#  Dark Side Power
#  Bin 32
#
# [YB]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
#==============================================================#
symbols

thing     player                 local

int       bin                    local

template  ball=+force_ltpeice    local
template  ring=+conccloud        local
template  blast=+Force_repel     local
template  flash=+ssparks_saber   local

model     round=sphere2.3do      local
model     long=aura.3do          local

flex      Randa                  local
flex      Randb                  local

int       Ringcount              local
int       Aura=0                 local

vector    Thrust                 local

thing     Projectile             local

message   startup
message   activated
message   deactivated
message   fire
message   killed
message   selected
message   pulse
message   timer

#flex cost=40.0 local
#int rank local
#int mana local
#template auraflare=+dest_cloud local
#sound fireSound=ForceLitning02.wav local
#int fireChannel=-1 local
#int modeTrack=-1 local
#sound transform=transform.wav local
#flex autoAimFOV=45 local

end
#==============================================================#
code
#------------------------------------------------------
startup:
	player = GetLocalPlayerThing();
	Aura = 0;

Return;
#------------------------------------------------------
activated:
	Ringcount = 0;
	if(Aura == 0)
	{
		Aura = 1;
		SetPulse(0.01);
		SetInvActivated(player, 21, 1);
		if(GetInv(player, 14) >= 2)
		{
			Randa = Rand() * 2;
			Randb = Rand() * 2;
			if(Randa < 1)
			{
				FireProjectile(player, flash, -1, -1, '0 0 0', '0 0 0', 1.0, 0, 0.0, 0.0);
			}
			Randb = Rand() * 2;
			if(Randb < 1)
			{
				FireProjectile(player, blast, -1, -1, '0 0 0', '0 0 0', 1.0, 0, 0.0, 0.0);
			}
		}
	}
	else if(Aura == 1)
	{
		Aura = 0;
		call stop_power;
	}

Return;
#------------------------------------------------------
selected:
	jkPrintUNIString(player, 32);

Return;
#------------------------------------------------------
deactivated:
	bin = GetSenderRef();
	DeactivateBin(player, bin);

Return;
#------------------------------------------------------
killed:
	if(GetSenderRef() != player) Return;
	call stop_power;

Return;
#------------------------------------------------------
stop_power:
	SetInv(player, 63, 1);
	SetInvActivated(player, 21, 0);
	SetPulse(0);
	if(IsInvActivated(player, 22) != 1)
	{
		SetActorExtraSpeed(player, 0);
	}

Return;
#------------------------------------------------------
pulse:
	player = GetLocalPlayerThing();
	if(GetThingHealth(player) > 0)
	{
		if(GetInv(player, 14) >= 2)
		{
			if(IsInvActivated(player, 22) != 1)
			{
				SetActorExtraSpeed(player, 2);
			}
			else
			{
				Return;
			}
			SetInv(player, 63, 2);
			ChangeInv(player, 14, -0.5);
			Thrust = GetThingThrust(player);
			if(VectorX(Thrust) == 0 && VectorY(Thrust) == 0 && VectorZ(Thrust) == 0)
			{
				Projectile = FireProjectile(player, ball, -1, -1, '0 0 0', '0 0 0', 1.0, 0, 0.0, 0.0);
				SetThingModel(Projectile, round);
			}
			else
			{
				if(IsThingMoving(player) > 0)
				{
					Projectile = FireProjectile(player, ball, -1, -1, '0 0 0', '0 0 0', 1.0, 0, 0.0, 0.0);
					SetThingModel(Projectile, long);
					call align;
				}
			}
			SetLifeLeft(Projectile, 0.01);
			if(GetAttachFlags(player) == 0x1)
			{
				Ringcount = Ringcount + 1;
				if(Ringcount == 10)
				{
					Ringcount = 0;
					CreateThing(ring, player);
				}
			}
		}
		else
		{
			call stop_power;
		}
	}

Return;
#------------------------------------------------------
align:
	player = GetLocalPlayerThing();
	SetThingLook(Projectile, VectorSub(GetThingPos(player), GetThingPos(Projectile)));

Return;
#------------------------------------------------------
end


Do note, I only fixed the glaring errors that Parsec picked up.

------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-10-19, 12:15 PM #3
Thanks anyway GBK, but it still didn't work.
[/edit]

All the extra crap was stuff I was planning to take out later but never got around to.

When I comment out the setthinglook() part, it creates the projectile as usual, it just doesn't look at me.

For now, I'll try one more approach, any more help would still be appreciated.

[This message has been edited by XxCHeCkSuMxX (edited October 19, 2002).]
2002-10-20, 4:28 PM #4
I dont think this is the solution but just curious:

Why are you constantly defining player?

player = GetLocalPlayerThing();

you are doing that in pulse and in align which get called 'very' frequently. Id trying removing that line from pulse and align and see if it works.

Normally the player's ID number does not change so the player = GetLocalPlayerThing(); done once in startup enough.
- Wisdom is 99% experience, 1% knowledge. -

↑ Up to the top!