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 → bob is broken :(
bob is broken :(
2003-01-28, 12:16 PM #1
Ok, a long time ago I created bob, which was a remote that hovered over the players head, and when it saw an enemy, either another player or actor, it faced it and shot at it rapidly. Now I'm attempting to recreate bob, but I'm a bit rusty, so I need help! Here's what I have:

Code:
# Jedi Knight Cog Script
#
# bob.COG
#
# bob the cog does his best to bring justice to those deserving a terrible terrible death that involves many pointy objects!
# 
#
# This Cog is Not supported by LucasArts Entertainment Co

symbols

model		bobmod=remo.3do		local

thing		bob				local
thing		player				local
thing		victim				local

sector		playersector			local

sound		bobshoot=ricochet03.wav	local

template	bobtemp=ghost			local
template	projectile1=+bryarbolt	local

flex		bobon=0			local

vector		playerpos			local
vector		bobpos				local
vector		bobnewpos			local
vector		victimnewpos			local
vector		victimpos			local

message	startup
message	activated
message	pulse	

end

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

code

startup:
	player = GetLocalPlayerThing();
	return;

activated:
	if(bobon == 0)
	{
		playersector = GetThingSector(player);
		playerpos = GetThingPos(player);
		bobpos = VectorAdd(playerpos,'0 0 0.1');
		bobon = 1;
		bob = CreateThingatPos(bobtemp,playersector,bobpos,'0 0 0');
		SetThingModel(bob,bobmod);
		AttatchThingToThing(bob,player);
		SetPulse(.05);
	}
	else 
	{
		DestroyThing(bob);
		SetPulse(0);
		bobon = 0;
	}
	return;

pulse:
	victim = FirstThinginView(bob,360,6,0x404);
	while(victim != -1)
	{
		if(victim != player)
		{
			bobnewpos = GetThingPos(bob);
			victimnewpos = GetThingPos(victim);
			victimpos = VectorSub(bobnewpos,victimnewpos);
			SetThingLook(bob,victimpos);
			FireProjectile(bob,projectile1,bobshoot,8,'0 0 0','0 0 0',1.0,0,0,0);
		}
	}
return;
		
	

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

end


When I use force grip, bob activates, and the ghost template is created above my head and assigned the remote model, but:

a.) the bob thing doesn't attatch to the player

b.) the bob thing doesn't face enemies and shoot them (I don't know if it's even searching)

I can activate and deactivate it all I want, but I'm afraid bob is useless for now [http://forums.massassi.net/html/frown.gif] Any insight as to what the problem is will be greatly appreciated. Thanks!

------------------
Those who stare in the eyes of death and laugh will be the first to go.
Those who stare in the eyes of death and laugh will be the first to go.
2003-01-28, 12:23 PM #2
3 things I can see, use the sector of the temp "bob" (ghost) instead, incase the new sector is different. Second, just before you close the while loop, add this victim = NextThingInView(); That way it checks more then once per pulse. Last, try this just for kicks, AttachThingToThingEx(bob, player, 0x8);

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

The Magician Saber System.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2003-01-28, 12:27 PM #3
I'm assuming that you mean use the sector of the temp bob in the creation of the bob object (bob = CreateThingatPos(bobtemp,playersector,bobpos,'0 0 0') [http://forums.massassi.net/html/wink.gif] but I'm confused as to how I can determine the sector of the bob object before it's created.

------------------
Those who stare in the eyes of death and laugh will be the first to go.
Those who stare in the eyes of death and laugh will be the first to go.
2003-01-28, 12:30 PM #4
oh, and the other two things didn't seemingly do anything. bob still stays where he was summoned and doesn't shoot or look at actors/players.

------------------
Those who stare in the eyes of death and laugh will be the first to go.
Those who stare in the eyes of death and laugh will be the first to go.
2003-01-28, 1:31 PM #5
ok, fixed the attach. I just spelled attach wrong, but I still can't get it to find a target [http://forums.massassi.net/html/frown.gif]

------------------
Those who stare in the eyes of death and laugh will be the first to go.
Those who stare in the eyes of death and laugh will be the first to go.
2003-01-28, 1:42 PM #6
Spelling does make a difference. [http://forums.massassi.net/html/tongue.gif]

Definately add victim = NextThingInView(); Same reason as before. It should fix the problem, its probably just getting the player and quits. Also use HasLOS(), otherwise it might attack things through walls.

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

The Magician Saber System.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2003-01-28, 2:14 PM #7
ok works now [http://forums.massassi.net/html/smile.gif] thanks for the help!

------------------
Those who stare in the eyes of death and laugh will be the first to go.
Those who stare in the eyes of death and laugh will be the first to go.
2003-01-28, 2:39 PM #8
Sure. [http://forums.massassi.net/html/biggrin.gif]

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

The Magician Saber System.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack

↑ Up to the top!