PDA

View Full Version : AI MP Cogs



TribalSphereOmni
03-18-2003, 02:45 PM
*SIGH* I just lost over 1,000 words I had just typed up on this. JUST TYPED. Anywho......I'm going to start over again....but briefer and less polite.

I need lotsa cogs. First off, MP AI cogs of Tuskens with bowcasters. They fire on the players, just not on themselves or other AI. Along with that, possibly an r2 cog that behaves like they do on SP. Also, help(step-by-step, I'm slow) in how to implement these is necessary.
Other than that, these cogs I'll need eventually:
- Bouncepad cogs. Ones that bounce up, ones that bounce you straight forward in a certain direction.
- Hurting and healing MP sector cogs. I know there are types like these out already, but I'd like a few simple ones.
- Some cogs dealing with "pressure plates." I'd like a few that can open doors and close doors once stepped on. Yet again, I've seen them before, but the ones I need differ slightly.
- Stoplight cog. This is the best I can do at explaining it. It's not really a stoplight, but more of what they do with Indy cars, but with three lights. I'll make the 3do with red, yellow, and green textures(if I can) and possibly the cog will be hooked to a host-controlled switch that has delays before the lights change from red to yellow, then green. Then after a short while, change back to red again.
Any suggestions on all this stuff will help. If you can write up a cog for any of this, I thank you. Credit will be given to any and all who contribute, and you'll get a good level released out of all of this. Thanks.

zagibu
03-18-2003, 04:35 PM
Sounds as if you were going to create a rolling level or a micro machines mod...

------------------
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)

TribalSphereOmni
03-19-2003, 12:21 PM
Shhhhhhhhhh.....yes, a rolling level. I was sure someone would have guessed.

TribalSphereOmni
03-24-2003, 09:11 PM
Any help before this topic gets lost?

DSLS_DeathSythe
03-25-2003, 12:12 AM
i can help you with some of these tomorrow.
right now i need some sleep.

------------------

Han5678
03-25-2003, 05:39 AM
here is your healing sector cog, very simple. i think that there is already one in game however



# Jedi Knight Cog Script
#
# healsect.COG
#
# heals the player in a sector
# [SCR]
#
# This Cog is Not supported by LucasArts Entertainment Co

symbols

sector sectorheal
flex healspeed=3.0
int player local
int dummy local

sound snd=heal.wav //choose yourself a sound

message startup
message pulse
message entered
message exited

end

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

code

startup:
player = GetLocalPlayerThing();

Return;

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

pulse:

HealThing(player,healspeed);

Return;

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

entered:
SetPulse(1.0);

Return;

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

exited:
SetPulse(0.0);

Return;


end


------------------
roses are red, violets are blue, I am schizophrenic, and so am I!

Han5678
03-25-2003, 05:39 AM
oops that was a double post. i can make your other cogs later but right now i am going to work on my mod

[This message has been edited by Han5678 (edited March 25, 2003).]

DSLS_DeathSythe
03-25-2003, 10:24 AM
heres a damage sector cog.


# Written By DSLS_DeathSythe
flags=0x240
symbols
#-----
message startup
message pulse
thing player=-1 local
sector plyr_sec local
flex dmg_amount=10.0
flex dmg_spd=1.0
sector dmg_sec1
sector dmg_sec2
sector dmg_sec3
sector dmg_sec4
sector dmg_sec5
#-----
end
#-----
code
#-----
startup:
player=GetLocalPlayerThing();
SetPulse(dmg_spd);
return;
#-----
pulse:
if(GetThingHealth(player) < 1) return;
plyr_sec = GetThingSector(player);
if((plyr_sec == dmg_sec1) ||
(plyr_sec == dmg_sec2) ||
(plyr_sec == dmg_sec3) ||
(plyr_sec == dmg_sec4) ||
(plyr_sec == dmg_sec5))
{
DamageThing(player, dmg_amount, 0x1, player);
}
return;
#-----
end

you can have up to 5 sector that will damage the player.

------------------

DSLS_DeathSythe
03-25-2003, 11:19 AM
Heres a cog you can use for the stop light thing.


# Written By DSLS_DeathSythe
flags=0x240
symbols
#-----
message activated
message timer
message trigger
thing strt_console=-1
material red_lit
material yellow_lit
material green_lit
flex light_spd=1.0
int color=0 local
# trigs
int act_trig=1
#-----
end
#-----
code
#-----
activated:
if(is_busy == 1) return;
if(IsServer())
{
is_busy = 1;
color = 0;
SetTimerEx(0.1, 1, 0, 0);
return;
}
return;
#-----
timer:
if(GetSenderID() == 1)
{
color = color + 1;
if(IsServer())
{
SendTrigger(-1, act_trig, color, 0, 0, 0);
}
}
return;
#-----
trigger:
if(GetSourceRef() == act_trig)
{
color = GetParam(0);
//-light goes red...
if(color == 1)
{
SetMaterialCel(red_lit, 1);
SetMaterialCel(yellow_lit, 0);
SetMaterialCel(green_lit, 0);
SetTimerEx(light_spd, 1, 0, 0);
return;
}
else
//-light goes yellow...
if(color == 2)
{
SetMaterialCel(red_lit, 0);
SetMaterialCel(yellow_lit, 1);
SetMaterialCel(green_lit, 0);
SetTimerEx(light_spd, 1, 0, 0);
return;
}
//-light goes green...
else
if(color == 3)
{
SetMaterialCel(red_lit, 0);
SetMaterialCel(yellow_lit, 0);
SetMaterialCel(green_lit, 1);
SetTimerEx((light_spd * 4), 1, 0, 0);
return;
}
//-lights goes off...
else
if(color == 4)
{
SetMaterialCel(red_lit, 0);
SetMaterialCel(yellow_lit, 0);
SetMaterialCel(green_lit, 0);
is_busy = 0;
return;
}
}
return;
#-----
end

It uses a trigger to work. If you use two or more of these cogs in the game you will need to make sure that the act_trig number is different for each one.
Only the host can activate the lights, and you can adjust how long the lights take to change.

------------------

DSLS_DeathSythe
03-25-2003, 12:16 PM
This cog will make actors in mp games but they wont be synced, meaning that the actor will be doing something at some spot on one persons computer and another thing at another spot on sombody elses computer. To get them synced up is alot harder and can cause lag.


# Written By DSLS_DeathSythe
flags=0x240
symbols
#-----
message startup
message damaged
message killed
message timer
template person_tpl
thing person=-1 local
thing make_gpos=-1
int canbehurt=0
flex damage=0.0 local
int can_respawn=1
flex respawn_delay=10.0
#-----
end
#-----
code
#-----
startup:
if(!IsServer()) return;
person = CreateThing(person_tpl, make_gpos);
CaptureThing(person);
return;
#-----
damaged:
damage = GetParam(0);
if(canbehurt == 1)
{
ReturnEx(damage);
return;
}
ReturnEx(0);
return;
#-----
killed:
ReleaseThing(person);
person = -1;
SetTimer(respawn_delay);
return;
#-----
timer:
if(can_respawn != 1) return;
person = CreateThing(person_tpl, make_gpos);
CaptureThing(person);
return;
#-----
end

You can use this cog to make both tuskans and the r2 droids. If you want it so they cannot die set the canbehurt to 0, if you want it so that they can die set it to 1. If it gets killed it will respawn after however long you put the respawn_delay at. If you dont want it to respawn set the can_respawn to 0. Hope that works for you.

------------------

TribalSphereOmni
03-25-2003, 02:19 PM
Whoa, guys...thanks. I'll get on the stuff right away....Anything else?

DSLS_DeathSythe
03-25-2003, 04:36 PM
heres a bounce pad cog.


# Written By DSLS_DeathSythe
flags=0x240
symbols
#-----
message startup
message entered
surface bounce_surf
thing bounce_thng
flex x_cord=0
flex y_cord=0
flex z_cord=0
vector bounce_vec local
vector target_vec local
flex bounce_force=5.0
thing player=-1 local
sound bounce_snd
#-----
end
#-----
code
#-----
startup:
target_vec = VectorSet(x_cord, y_cord, z_cord);
return;
#-----
entered:
player = GetSourceRef();
PlaySoundLocal(bounce_snd, 1.0, 0, 0x0);
bounce_vec = VectorScale(VectorNorm(VectorSub(target_vec, GetThingPos(player))), bounce_force);
DetachThing(player);
SetThingVel(player, bounce_vec);
return;
#-----
end

You can use either a thing or a surface as the bounce pad.
Its a little tricky to set up. Heres how to make it shoot you straight up. Take a ghost thing and put it right above the surface or thing that is to be the bounce pad. Put it like 1.0 up from it. Then look at the XYZ cords of the ghost thing and put those numbers into the x_cord, y_cord, and z_cord of the cog. then adjust the bounce force dont put it at too high of a number or the player will shoot off and never be heard from again. 10 will shoot ya pretty high.
To make it shoot the player forward put the ghost thing at like 0.2 above the boune pad and 1.0 in the direction that you want the player to go. Then copy the numbers like before. After you have the numbers you can delete the ghost thing its not needed any more. Hope that does what you need, Good luck.

------------------

DSLS_DeathSythe
03-25-2003, 08:41 PM
and heres the pressure plat doors cog.


# Written By DSLS_DeathSythe
flags=0x240
symbols
#-----
message startup
message entered
message trigger
message pulse
message timer
message blocked
surface press_surf1=-1
surface press_surf2=-1
thing press_thng1=-1
thing press_thng2=-1
thing door1=-1 linkid=1
thing door2=-1 linkid=1
flex move_spd=8.0
flex wait=3.0
int disable_adjoins=1
# trigs
int act_trig=1
#-----
end
#-----
code
#-----
startup:
if(GetCurFrame(door1) != 0)
{
MoveToFrame(door1, 0, move_spd);
if(door2 >= 0) MoveToFrame(door2, 0, move_spd);
}
if(disable_adjoins == 1)
SetSectorAdjoins(GetThingSector(door1), 0);
return;
#-----
entered:
if(GetSenderID() == 1) return;
if((IsThingMoving(door1) == 1) || (GetCurFrame(door1) == 1)) return;
SendTrigger(-1, act_trig, 0, 0, 0, 0);
return;
#-----
trigger:
if(GetSourceRef() == act_trig)
{
Call open_doors;
return;
}
return;
#-----
pulse:
if(IsThingMoving(door1)) return;
if(GetCurFrame(door1) == 1)
{
SetTimer(wait);
SetPulse(0.0);
return;
}
else
if(GetCurFrame(door1) == 0)
{
if(disable_adjoins == 1)
SetSectorAdjoins(GetThingSector(door1), 0);
SetPulse(0.0);
return;
}
return;
#-----
timer:
Call close_doors;
return;
#-----
blocked:
SendTrigger(-1, act_trig, 0, 0, 0, 0);
return;
#-----
open_doors:
SetSectorAdjoins(GetThingSector(door1), 1);
MoveToFrame(door1, 1, move_spd);
if(door2 >= 0) MoveToFrame(door2, 1, move_spd);
SetPulse(0.1);
return;
#-----
close_doors:
MoveToFrame(door1, 0, move_spd);
if(door2 >= 0) MoveToFrame(door2, 0, move_spd);
SetPulse(0.1);
return;
#-----
end

this cog uses a trigger too so you will have to make sure that the number you give act_trig is different each time you use the cog in your level. also make sure that it is different from anyother trigs that other cogs use.
the disable_adjoins is something that you only need to worry about if you are useing a door thing that you can see through like a bar gate or if you are making the door close when the pressure plat is touched, if you are going to use either of these set the disable_adjoins to 0.
Good luck.

------------------