THese server/client cogs worked before i added a few lines. It generates objects to be created radomly at 4 ghost locations. It is largely derived from the cog that generates TieBombers in Jedi Knight and most of the variable names are the same. I tried to add scripting that would randomize the object created to 4 different objects. Now at startup the game just crashes by quiting Jedi Knight.
Im not sure how the random stuff works...I was just trying to mimic what I saw in the cog already. The changes are between "movebomber:" and "capturething:"
#SERVER: objects in multiplayer summoned by pulse
symbols
flex totaltime=8.0 // 4 * rate * rounds + delay + 0.05
int active=0 local
int trapID
message startup
message timer
message pulse
end
code
startup:
active = 1;
if (active==1)
{
active=0;
setpulse(4);
}
return;
pulse:
SendTrigger(-1, 11001 + trapID, GetThingGuid(GetSourceRef()),0,0,0);
SetTimer(totalTime);
Return;
# ...................................................................#
timer:
active = 1;
Return;
end
______________________________________________________________________
# CLIENT: generates objects.
flags=0x240
symbols
message pulse
message trigger
message exited
message damaged
template bombertemplate
template bombert2
template bombert3
template bombert4
thing bomberdummy0
thing bomberdummy1
thing bomberdummy2
thing bomberdummy3
sector vsector local
sound tieenginewhine
vector vtiebombpos local
vector newtiebombpos local
thing bomberdummyx local
thing vtiebomber local
flex random local
int lasttemplate=0 local
int curtemplate=-1 local
int cur_round=0 local
int dummy local
int rounds=4 desc=rounds
int trapID
int model local
int lastmodel=-1 local
end
#__________________________________________________________________________#
code
trigger:
if(GetSourceRef() != 11001 + trapID) Return;
cur_round = 0;
while(cur_round < rounds)
{
curtemplate=bomberdummy0[rand()*4];
while (lasttemplate==curtemplate)
{
curtemplate=bomberdummy0[rand()*4];
}
// curtemplate=bomberdummy0;
call movebomber;
cur_round = cur_round + 1;
}
Return;
movebomber:
model = (rand()*4);
while (model==lastmodel)
{
model = (rand()*4);
}
lastmodel = model;
bomberdummyx=curtemplate;
if(model == 0)
{
vtiebomber=creatething(bombertemplate, bomberdummyx);
}
if(model == 1)
{
vtiebomber=creatething(bombert2, bomberdummyx);
}
if(model == 2)
{
vtiebomber=creatething(bombert3, bomberdummyx);
}
if(model == 3)
{
vtiebomber=creatething(bombert4, bomberdummyx);
}
capturething(vtiebomber);
playsoundthing(tieenginewhine, vtiebomber, 1.0, -1, 225, 129);
movetoframe(vtiebomber, 1, 65);
waitforstop(vtiebomber);
destroything(vtiebomber);
lasttemplate=curtemplate;
return;
end
[This message has been edited by eggtooth (edited September 13, 2001).]
Im not sure how the random stuff works...I was just trying to mimic what I saw in the cog already. The changes are between "movebomber:" and "capturething:"
#SERVER: objects in multiplayer summoned by pulse
symbols
flex totaltime=8.0 // 4 * rate * rounds + delay + 0.05
int active=0 local
int trapID
message startup
message timer
message pulse
end
code
startup:
active = 1;
if (active==1)
{
active=0;
setpulse(4);
}
return;
pulse:
SendTrigger(-1, 11001 + trapID, GetThingGuid(GetSourceRef()),0,0,0);
SetTimer(totalTime);
Return;
# ...................................................................#
timer:
active = 1;
Return;
end
______________________________________________________________________
# CLIENT: generates objects.
flags=0x240
symbols
message pulse
message trigger
message exited
message damaged
template bombertemplate
template bombert2
template bombert3
template bombert4
thing bomberdummy0
thing bomberdummy1
thing bomberdummy2
thing bomberdummy3
sector vsector local
sound tieenginewhine
vector vtiebombpos local
vector newtiebombpos local
thing bomberdummyx local
thing vtiebomber local
flex random local
int lasttemplate=0 local
int curtemplate=-1 local
int cur_round=0 local
int dummy local
int rounds=4 desc=rounds
int trapID
int model local
int lastmodel=-1 local
end
#__________________________________________________________________________#
code
trigger:
if(GetSourceRef() != 11001 + trapID) Return;
cur_round = 0;
while(cur_round < rounds)
{
curtemplate=bomberdummy0[rand()*4];
while (lasttemplate==curtemplate)
{
curtemplate=bomberdummy0[rand()*4];
}
// curtemplate=bomberdummy0;
call movebomber;
cur_round = cur_round + 1;
}
Return;
movebomber:
model = (rand()*4);
while (model==lastmodel)
{
model = (rand()*4);
}
lastmodel = model;
bomberdummyx=curtemplate;
if(model == 0)
{
vtiebomber=creatething(bombertemplate, bomberdummyx);
}
if(model == 1)
{
vtiebomber=creatething(bombert2, bomberdummyx);
}
if(model == 2)
{
vtiebomber=creatething(bombert3, bomberdummyx);
}
if(model == 3)
{
vtiebomber=creatething(bombert4, bomberdummyx);
}
capturething(vtiebomber);
playsoundthing(tieenginewhine, vtiebomber, 1.0, -1, 225, 129);
movetoframe(vtiebomber, 1, 65);
waitforstop(vtiebomber);
destroything(vtiebomber);
lasttemplate=curtemplate;
return;
end
[This message has been edited by eggtooth (edited September 13, 2001).]