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 → Randomizer added to this cog stopped it from working
Randomizer added to this cog stopped it from working
2001-09-13, 7:11 AM #1
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).]
2001-09-13, 7:22 AM #2
In the startup there is no need for all "active" variable commands, as it seems to me that it always goes in the if statement and just start the pulse anyway.

And if I remember correctly, "GetThingGuid" is for MotS not for JK, maybe that's the reason. Rather use GetThingSignature for same purpose or just take that parameter down as you aren't referring to it in the trigger message anyway.

------------------
http://millennium.massassi.net/ - Millennium

[This message has been edited by Hideki (edited September 13, 2001).]

↑ Up to the top!