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 → Bombers
Bombers
2003-07-19, 4:07 PM #1
Code:
# Another cog for Dash_rendar
#
# Makes a Tie Bomber fly around its frames
#when a switch is activated.
# This time, drops bombs.
#
# [DP + SM]
#==============================================================#
flags=0x40
#==============================================================#
symbols

thing     TieBomber

surface   Switch

flex      bombtime
flex      bombInterval
flex      speed

int       numframes
int       triggerID
int       done=0           local

template  bomb=08tiebomb

vector    bomboffset       local
vector    lvecOffset       local
vector    rvecOffset       local
vector    newpos           local

message   activated
message   pulse
message   trigger

end
#==============================================================#
code
#------------------------------------------------------
activated:
	if(done || !IsServer() && IsMulti()) Return;
	done = 1;
	SetWallCel(Switch, 1);
	MoveToFrame(TieBomber, numframes - 1, speed);
	SetPulse(bombInterval);
	Sleep(bombtime);
	SetPulse(0);
	WaitForStop(TieBomber);
	SetWallCel(Switch, 0);
	SkipToFrame(TieBomber, 0, speed);
	done = 0;

Return;
#------------------------------------------------------
pulse:
	SendTrigger(-1, triggerID, 0, 0, 0, 0);

Return;
#------------------------------------------------------
trigger:
	if(GetSourceRef() != triggerID) Return;
	bomboffset = VectorScale(GetThingUVec(TieBomber), -0.305);
	rvecOffset = VectorScale(GetThingRVec(TieBomber), -0.1);
	lvecOffset = VectorScale(GetThingLVec(TieBomber), -0.1);
	bomboffset = VectorAdd(bomboffset, VectorAdd(rvecOffset, lvecOffset));
	newpos = VectorAdd(GetThingPos(TieBomber), bomboffset);
	CreateThingAtPos(bomb, GetThingSector(TieBomber), newpos, '0 0 0');

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


[edit] Cleaned code and added the 'end' for the code section. - SM

I need this cog to be on a timer instead of a switch. TY

------------------
I and only I know what I'm thinking.

[This message has been edited by SaberMaster (edited July 20, 2003).]
<SalvadorChicka> i wasn't all "omg canadians have sex with each other!"
2003-07-19, 6:12 PM #2
Gahhhhhhhhhhhhhhhh burning eyes!!!!!!!!!!!!!!!!!!!!!!!!!!!!

need code tags and end line (enter key [http://forums.massassi.net/html/tongue.gif]) then help will arrive from me.

------------------
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
2003-07-19, 6:19 PM #3
Go over to the main editing forum. My copy paste aint workin.

------------------
I and only I know what I'm thinking.

[This message has been edited by COTF_Dude (edited July 19, 2003).]
<SalvadorChicka> i wasn't all "omg canadians have sex with each other!"
2003-07-19, 9:27 PM #4
You can't copy text from inside our UBB code tags. Instead, just edit the post and copy the text from the edit box.

So you want the bombers to fly on a timer? As in so many seconds after startup?

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2003-07-20, 5:37 AM #5
Yeah, thats pretty much what i want.

------------------
I and only I know what I'm thinking.
<SalvadorChicka> i wasn't all "omg canadians have sex with each other!"
2003-07-20, 5:49 AM #6
thank you. Here ya go.
Code:
symbols

thing     TieBomber

flex      bombtime
flex      bombInterval
flex      speed
flex      delay

int       numframes
int       triggerID

template  bomb=08tiebomb

vector    bomboffset       local
vector    lvecOffset       local
vector    rvecOffset       local
vector    newpos           local

message   switch
message   pulse
message   trigger

end
#==============================================================#
code
#------------------------------------------------------
Startup:
	Sleep(delay);
	If(!IsServer() && IsMulti()) Return;
	MoveToFrame(TieBomber, numframes - 1, speed);
	SetPulse(bombInterval);
	Sleep(bombtime);
	SetPulse(0);
Return;
#------------------------------------------------------
pulse:
	SendTrigger(-1, triggerID, 0, 0, 0, 0);

Return;
#------------------------------------------------------
trigger:
	if(GetSourceRef() != triggerID) Return;
	bomboffset = VectorScale(GetThingUVec(TieBomber), -0.305);
	rvecOffset = VectorScale(GetThingRVec(TieBomber), -0.1);
	lvecOffset = VectorScale(GetThingLVec(TieBomber), -0.1);
	bomboffset = VectorAdd(bomboffset, VectorAdd(rvecOffset, lvecOffset));
	newpos = VectorAdd(GetThingPos(TieBomber), bomboffset);
	CreateThingAtPos(bomb, GetThingSector(TieBomber), newpos, '0 0 0');

Return;
#------------------------------------------------------
end
The way it is right now, it will only do the path once.

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

The Magician Saber System.

The 2 riddle!

[This message has been edited by Descent_pilot (edited July 20, 2003).]
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack

↑ Up to the top!