The following cog works if the mutator template is set to crossbow. But if I change it to crate6_2, nothing appears...
Code:
symbols
template mutator=crossbow local
template wpl=walkplayer local
thing mutatoron local
thing mutator0 local
thing mutator1 local
thing mutator2 local
thing mutator3 local
thing mutator4 local
thing mutator5 local
thing mutator6 local
thing mutator7 local
thing mutator8 local
thing mutator9 local
model off=mutator0.3do local
model on=mutator1.3do local
int thingcount local
int nummutators local
int random local
int firsttime local
message loading
message timer
message pulse
end
# ========================================================================================
code
loading:
if(!IsServer()) Return;
firsttime = 1;
nummutators = 0;
SetTimerEx(5, 111, -1, -1);
Return;
timer:
// Initialization
if(GetSenderId() == 111)
{
thingcount = GetThingCount();
for(i = 0; i < thingcount; i = i + 1)
{
if((GetThingTemplate(i) == wpl) && (nummutators < 10))
{
mutator0[nummutators] = CreateThing(mutator, i);
nummutators = nummutators + 1;
}
}
}
SetPulse(10);
Return;
pulse:
//if only one player return
jkStringClear();
jkStringConcatAsciiString("Random Mutation");
jkStringOutput(-3, -1);
if(firsttime == 1)
{
firsttime = 0;
}
else
{
SetThingModel(mutatoron, off);
}
random = Rand() * nummutators;
mutatoron = mutator0[random];
SetThingModel(mutatoron, on);
Return;
end"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)