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 → I need some help with a cog...
I need some help with a cog...
2003-05-22, 6:06 PM #1
I need one that when a thing is killed, it creates an actor template at two different ghosts, and when those two actors are killed, it creates another template at another ghost.

It should work kinda like what the Ladder levels for JO are like.

------------------
Look for my current project, The Force in Your Soul.
Last week I cudn't evn spel grajuat, but now I is one.

*Takes out his blaster and fires shots at the wall, the blastmarks leave the words "S-TROOPER WUZ 'ERE!!!"
2003-05-22, 7:19 PM #2
I think there's an LEC cog similar to it, but it'll need modifications.
First, do you mean you want to use the same template as the thing that was killed? If not, I'll make it non-local so you can choose, or I can make it for a random template each time one of the new things are killed.

------------------
"The Just shall live by faith." - Galatians 3:11

[This message has been edited by DogSRoOL (edited May 22, 2003).]
Catloaf, meet mouseloaf.
My music
2003-05-23, 4:21 AM #3
Code:
# Jedi Knight Cog Script
#
# Ladder type level cog
# Sends a trigger (id+1) when a thing is killed
# Sends a trigger to the next cog when all things are killed
# Can support infinite things (if there's no cog limit)
# Lvec is always 0 0 0
#
# [DP]
#
symbols
vector            pos
vector            pos1
vector            pos2
vector            pos3
vector            pos4
int               numPos=0
sector            posSec
sector            posSec1
sector            posSec2
sector            posSec3
sector            posSec4
int               triggerID
int               nextID
template          creation
int               onStart=1
int               numThings=0
int               i                    local
int               dummy                local
int               numDead=0            local

message           startup
message           killed
message           trigger

end

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

code

Startup:
   If(onStart)
   {
      For(i=0; i<numPos; i=i+1)
      {
         dummy = CreateThingAtPos(creation, posSec, pos, '0 0 0');
         CaptureThing(dummy);
      }
   }
   Return;

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

Killed:
   SendTrigger(-1, triggerID+1, 0, 0, 0, 0);
   Return;

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

Trigger:
   // Create things
   If(GetSourceRef() == triggerID)
   {
      For(i=0; i<numPos; i=i+1)
      {
         dummy = CreateThingAtPos(creation, posSec, pos, '0 0 0');
         CaptureThing(dummy);
      }
   }
   // If something was killed
   If(GetSourceRef() == triggerID + 1)
   {
      numDead = numDead + 1;
      If(numDead >= numThings)
         SendTrigger(-1, nextID, 0, 0, 0, 0);
   }
   Return;

end
Should work, but if not, I'll fix it.

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

The Magician Saber System.

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

Completed
Judgement Day (HLP), My level pack
2003-05-23, 4:37 AM #4
On that cog, I would guess that the "pos" in the symbols section would be where the thing is created, right?

------------------
Look for my current project, The Force in Your Soul.
Last week I cudn't evn spel grajuat, but now I is one.

*Takes out his blaster and fires shots at the wall, the blastmarks leave the words "S-TROOPER WUZ 'ERE!!!"
2003-05-23, 6:12 AM #5
That would've been much easier using ghosts. But on the upside, you could get the position of the actor when he's killed, destroy the body, and generate a new one there, if you wanted.

------------------
"The Just shall live by faith." - Galatians 3:11
Catloaf, meet mouseloaf.
My music
2003-05-23, 7:50 AM #6
is this for MP?
because from my playing around with triggers, all the players computers in the level would send that trigger and makes the enemies and for every trigger you would get more enemies and you would end up with a LOT of enemies if you have lots of people in the game.
could be wrong though.
if this is for MP check for that. if it does happen you can limit the trigger to only one sent by going like this:
Code:
if(IsServer())
  SendTrigger(-1, trigger, 0, 0, 0, 0);

that would limit it to only the servers computer sending the trigger.
if its not for MP, well then never mind. [http://forums.massassi.net/html/redface.gif]

------------------
Famous last words - "It seemed like a good idea at the time."

[This message has been edited by DSLS_DeathSythe (edited May 23, 2003).]
Famous last words - "It seemed like a good idea at the time."
2003-05-23, 10:17 AM #7
well, if its MP you need my paitented AI sync system.
Code:
pulse:
SyncThingState(dude);
return;


from
Code:
# Jedi Knight Cog Script
#
# syncswitch.cog
# this cog will "spawn" a AI at a ghost position
# it also partaily "syncs" there psoiton so not to mutch trouble
# with that.
# it will activate on startup or when you activate a switch.
# [PJB]

symbols
surface      switch                             linkid=0                      
message      startup                                                          
message      activated                                                        
message      killed                                                           
message      pulse                                                            
sector       enterme                                                          
thing        dude                               linkid=1                      local
template     enemy_tpl                          desc=enemy_to_generate        
int          top=0                              local                         
end                                                                           

## Code Section

code

//-------------------------------------------------------------------------------------------------

startup:
if (top==0)
{
dude=CreateThing(enemy_tpl, generator_pos);
	SetPulse(0.1); 
top=1;
}
return;

activated:
if (GetSenderID()==0)
{
if (top==0)
{
dude=CreateThing(enemy_tpl, generator_pos);
	SetPulse(0.1); 
top=1;
}
}
return;

pulse:
SyncThingState(dude);
return;

killed:
if (GetSenderID()==1) top=0;
return;
end


------------------
I am pjb.
Another post......
another moment of my life wasted.....
at least i made a level.
PJB's JK page's

-the PJB jedi rule book-
rule one, "never trust a bartender with bad grammar"-kyle katarn in JO

Rule Two, "Gravity is a crule misstress" -kyle katarn in MotS, and the alternatior MK I in AJTD
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2003-05-23, 5:51 PM #8
pos would have been the posistion of the ghost, and secPos is the sector that the ghost would have resided in. This way saves on things. Triggers don't just mean MP. Triggers are great for when you want to reach a mass section of cogs all at once. You would have to switch a few things but I could get the AI incorperated. This cog is a basic TCS, just slightly specialized. [http://forums.massassi.net/html/wink.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!