mirror of
https://github.com/InfinityLoader/IL-GSC.git
synced 2025-06-28 18:37:53 -05:00
Added AW, BO2, Ghosts, IW, MWR, WW2 Scripts
This commit is contained in:
238
BO2/PC/ZM/codescripts/character.gsc
Normal file
238
BO2/PC/ZM/codescripts/character.gsc
Normal file
@ -0,0 +1,238 @@
|
||||
/*******************************************************************
|
||||
* Decompiled By: Bog
|
||||
* Decompiled File: codescripts\character.gsc
|
||||
* Game: Call of Duty: Black Ops 2
|
||||
* Platform: PC
|
||||
* Function Count: 12
|
||||
* Decompile Time: 26 ms
|
||||
* Timestamp: 10/27/2023 3:01:58 AM
|
||||
*******************************************************************/
|
||||
|
||||
//Function Number: 1
|
||||
setmodelfromarray(a)
|
||||
{
|
||||
self setmodel(a[randomint(a.size)]);
|
||||
}
|
||||
|
||||
//Function Number: 2
|
||||
precachemodelarray(a)
|
||||
{
|
||||
for(i = 0;i < a.size;i++)
|
||||
{
|
||||
precachemodel(a[i]);
|
||||
}
|
||||
}
|
||||
|
||||
//Function Number: 3
|
||||
randomelement(a)
|
||||
{
|
||||
return a[randomint(a.size)];
|
||||
}
|
||||
|
||||
//Function Number: 4
|
||||
attachfromarray(a)
|
||||
{
|
||||
self attach(randomelement(a),"",1);
|
||||
}
|
||||
|
||||
//Function Number: 5
|
||||
new()
|
||||
{
|
||||
self detachall();
|
||||
oldgunhand = self.anim_gunhand;
|
||||
if(!(IsDefined(oldgunhand)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
self.anim_gunhand = "none";
|
||||
self [[ anim.putguninhand ]](oldgunhand);
|
||||
}
|
||||
|
||||
//Function Number: 6
|
||||
save()
|
||||
{
|
||||
info["gunHand"] = self.anim_gunhand;
|
||||
info["gunInHand"] = self.anim_guninhand;
|
||||
info["model"] = self.model;
|
||||
info["hatModel"] = self.hatmodel;
|
||||
info["gearModel"] = self.gearmodel;
|
||||
if(IsDefined(self.name))
|
||||
{
|
||||
info["name"] = self.name;
|
||||
/#
|
||||
println("Save: Guy has name ",self.name);
|
||||
#/
|
||||
}
|
||||
else
|
||||
{
|
||||
/#
|
||||
println("save: Guy had no name!");
|
||||
#/
|
||||
}
|
||||
|
||||
attachsize = self getattachsize();
|
||||
for(i = 0;i < attachsize;i++)
|
||||
{
|
||||
info["attach"][i]["model"] = self getattachmodelname(i);
|
||||
info["attach"][i]["tag"] = self getattachtagname(i);
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
//Function Number: 7
|
||||
load(info)
|
||||
{
|
||||
self detachall();
|
||||
self.anim_gunhand = info["gunHand"];
|
||||
self.anim_guninhand = info["gunInHand"];
|
||||
self setmodel(info["model"]);
|
||||
self.hatmodel = info["hatModel"];
|
||||
self.gearmodel = info["gearModel"];
|
||||
if(IsDefined(info["name"]))
|
||||
{
|
||||
self.name = info["name"];
|
||||
/#
|
||||
println("Load: Guy has name ",self.name);
|
||||
#/
|
||||
}
|
||||
else
|
||||
{
|
||||
/#
|
||||
println("Load: Guy had no name!");
|
||||
#/
|
||||
}
|
||||
|
||||
attachinfo = info["attach"];
|
||||
attachsize = attachinfo.size;
|
||||
for(i = 0;i < attachsize;i++)
|
||||
{
|
||||
self attach(attachinfo[i]["model"],attachinfo[i]["tag"]);
|
||||
}
|
||||
}
|
||||
|
||||
//Function Number: 8
|
||||
precache(info)
|
||||
{
|
||||
if(IsDefined(info["name"]))
|
||||
{
|
||||
/#
|
||||
println("Precache: Guy has name ",info["name"]);
|
||||
#/
|
||||
}
|
||||
else
|
||||
{
|
||||
/#
|
||||
println("Precache: Guy had no name!");
|
||||
#/
|
||||
}
|
||||
|
||||
precachemodel(info["model"]);
|
||||
attachinfo = info["attach"];
|
||||
attachsize = attachinfo.size;
|
||||
for(i = 0;i < attachsize;i++)
|
||||
{
|
||||
precachemodel(attachinfo[i]["model"]);
|
||||
}
|
||||
}
|
||||
|
||||
//Function Number: 9
|
||||
get_random_character(amount)
|
||||
{
|
||||
self_info = strtok(self.classname,"_");
|
||||
if(self_info.size <= 2)
|
||||
{
|
||||
return randomint(amount);
|
||||
}
|
||||
|
||||
group = "auto";
|
||||
index = undefined;
|
||||
prefix = self_info[2];
|
||||
if(IsDefined(self.script_char_index))
|
||||
{
|
||||
index = self.script_char_index;
|
||||
}
|
||||
|
||||
if(IsDefined(self.script_char_group))
|
||||
{
|
||||
type = "grouped";
|
||||
group = "group_" + self.script_char_group;
|
||||
}
|
||||
|
||||
if(!(IsDefined(level.character_index_cache)))
|
||||
{
|
||||
level.character_index_cache = [];
|
||||
}
|
||||
|
||||
if(!(IsDefined(level.character_index_cache[prefix])))
|
||||
{
|
||||
level.character_index_cache[prefix] = [];
|
||||
}
|
||||
|
||||
if(!(IsDefined(level.character_index_cache[prefix][group])))
|
||||
{
|
||||
initialize_character_group(prefix,group,amount);
|
||||
}
|
||||
|
||||
if(!(IsDefined(index)))
|
||||
{
|
||||
index = get_least_used_index(prefix,group);
|
||||
if(!(IsDefined(index)))
|
||||
{
|
||||
index = randomint(5000);
|
||||
}
|
||||
}
|
||||
|
||||
while(index >= amount)
|
||||
{
|
||||
index = index - amount;
|
||||
}
|
||||
|
||||
level.character_index_cache[prefix][group][index]++;
|
||||
return index;
|
||||
}
|
||||
|
||||
//Function Number: 10
|
||||
get_least_used_index(prefix,group)
|
||||
{
|
||||
lowest_indices = [];
|
||||
lowest_use = level.character_index_cache[prefix][group][0];
|
||||
lowest_indices[0] = 0;
|
||||
for(i = 1;i < level.character_index_cache[prefix][group].size;i++)
|
||||
{
|
||||
if(level.character_index_cache[prefix][group][i] > lowest_use)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if(level.character_index_cache[prefix][group][i] < lowest_use)
|
||||
{
|
||||
lowest_indices = [];
|
||||
lowest_use = level.character_index_cache[prefix][group][i];
|
||||
}
|
||||
|
||||
lowest_indices[lowest_indices.size] = i;
|
||||
}
|
||||
}
|
||||
|
||||
/#
|
||||
assert(lowest_indices.size,"Tried to spawn a character but the lowest indices didn\'t exist");
|
||||
#/
|
||||
return random(lowest_indices);
|
||||
}
|
||||
|
||||
//Function Number: 11
|
||||
initialize_character_group(prefix,group,amount)
|
||||
{
|
||||
for(i = 0;i < amount;i++)
|
||||
{
|
||||
level.character_index_cache[prefix][group][i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//Function Number: 12
|
||||
random(array)
|
||||
{
|
||||
return array[randomint(array.size)];
|
||||
}
|
32
BO2/PC/ZM/codescripts/character_mp.gsc
Normal file
32
BO2/PC/ZM/codescripts/character_mp.gsc
Normal file
@ -0,0 +1,32 @@
|
||||
/*******************************************************************
|
||||
* Decompiled By: Bog
|
||||
* Decompiled File: codescripts\character_mp.gsc
|
||||
* Game: Call of Duty: Black Ops 2
|
||||
* Platform: PC
|
||||
* Function Count: 3
|
||||
* Decompile Time: 6 ms
|
||||
* Timestamp: 10/27/2023 3:01:58 AM
|
||||
*******************************************************************/
|
||||
|
||||
#include codescripts/character;
|
||||
|
||||
//Function Number: 1
|
||||
setmodelfromarray(a)
|
||||
{
|
||||
self setmodel(a[randomint(a.size)]);
|
||||
}
|
||||
|
||||
//Function Number: 2
|
||||
precachemodelarray(a)
|
||||
{
|
||||
for(i = 0;i < a.size;i++)
|
||||
{
|
||||
precachemodel(a[i]);
|
||||
}
|
||||
}
|
||||
|
||||
//Function Number: 3
|
||||
attachfromarray(a)
|
||||
{
|
||||
self attach(codescripts/character::randomelement(a),"",1);
|
||||
}
|
29
BO2/PC/ZM/codescripts/delete.gsc
Normal file
29
BO2/PC/ZM/codescripts/delete.gsc
Normal file
@ -0,0 +1,29 @@
|
||||
/*******************************************************************
|
||||
* Decompiled By: Bog
|
||||
* Decompiled File: codescripts\delete.gsc
|
||||
* Game: Call of Duty: Black Ops 2
|
||||
* Platform: PC
|
||||
* Function Count: 1
|
||||
* Decompile Time: 4 ms
|
||||
* Timestamp: 10/27/2023 3:01:59 AM
|
||||
*******************************************************************/
|
||||
|
||||
//Function Number: 1
|
||||
main()
|
||||
{
|
||||
/#
|
||||
assert(IsDefined(self));
|
||||
#/
|
||||
wait(0);
|
||||
if(IsDefined(self))
|
||||
{
|
||||
/#
|
||||
println("");
|
||||
println("*** trigger debug: delete.gsc is deleting trigger with ent#: " + self getentitynumber() + " at origin: " + self.origin);
|
||||
println("");
|
||||
self.classname == "trigger_once" || self.classname == "trigger_radius" || self.classname == "trigger_multiple"
|
||||
IsDefined(self.classname)
|
||||
#/
|
||||
self delete();
|
||||
}
|
||||
}
|
41
BO2/PC/ZM/codescripts/struct.gsc
Normal file
41
BO2/PC/ZM/codescripts/struct.gsc
Normal file
@ -0,0 +1,41 @@
|
||||
/*******************************************************************
|
||||
* Decompiled By: Bog
|
||||
* Decompiled File: codescripts\struct.gsc
|
||||
* Game: Call of Duty: Black Ops 2
|
||||
* Platform: PC
|
||||
* Function Count: 3
|
||||
* Decompile Time: 5 ms
|
||||
* Timestamp: 10/27/2023 3:01:59 AM
|
||||
*******************************************************************/
|
||||
|
||||
//Function Number: 1
|
||||
initstructs()
|
||||
{
|
||||
level.struct = [];
|
||||
}
|
||||
|
||||
//Function Number: 2
|
||||
createstruct()
|
||||
{
|
||||
struct = spawnstruct();
|
||||
level.struct[level.struct.size] = struct;
|
||||
return struct;
|
||||
}
|
||||
|
||||
//Function Number: 3
|
||||
findstruct(position)
|
||||
{
|
||||
foreach(key, _ in level.struct_class_names)
|
||||
{
|
||||
foreach(s_array in level.struct_class_names[key])
|
||||
{
|
||||
foreach(struct in s_array)
|
||||
{
|
||||
if(distancesquared(struct.origin,position) < 1)
|
||||
{
|
||||
return struct;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user