UGX-Mods

Call of Duty: Black Ops 3 => Help Desk => Scripting => Topic started by: Warheez on December 04, 2016, 07:05:35 pm

Title: Make door open after a certain amount of kills.
Post by: Warheez on December 04, 2016, 07:05:35 pm
I am currently working on a challenge map, and i want a door to open, after the player gets 200 kills. I'm really not onto scripting, and didn't find any script for this for BO3, so please help.
Title: Re: Make door open after a certain amount of kills.
Post by: MakeCents on December 05, 2016, 06:28:19 pm
For this I would make a custom door script. Lets keep it simple at first. Have a trigger_use and a script_brushmodel. Select the trigger, then the brush, and press w. Make the trigger targetname totalkills.

In script you would get each trigger and thread a function on them. In this function you would get the triggers target, as an ent or as an array depending on your door. From here it depends how you want to open the door. Up, side, split? I find a friendly way to change you mind is to set a script_struct as the target of the door/brush, rather than using a script_vector kvp, and make it so the door will move to that structs origin from its origin.

I'm not sure how to check total kills, but I would guess checking each players kills would work, and there is stuff in _zm_stats.gsc for that.

Something like this might work, idk. I just wrote it up quick, could be fool of errors too, lol. Name script kill_doors.gsc
Code Snippet
Plaintext
#using scripts\shared\array_shared;
#using scripts\codescripts\struct;

/*
#####################
by: M.A.K.E C E N T S
#####################
Script:

Add to main in mapname.gsc
kdoors::init(  );

Add to top of mapname.gsc
#using scripts\zm\kill_doors;

Add to zone file
scriptparsetree,scripts/zm/kill_doors.gsc

###############################################################################
Radiant:

trigger targers script brushmodel
targetname>totalkills
zombie_cost># of kills
script_flag>flag to set for zone

script brushmodel targets a struct (the brush will move to this origin - optional)
targetname will be auto#
target will be auto# matching structs targetname

structs targetname will also be auto# matching brushes target
###############################################################################
*/

#namespace kdoors;

function init()
{
level.totalkills = 20;
trigs = GetEntArray("totalkills","targetname");
array::thread_all(trigs, &SetupDoors);
}

function SetupDoors()
{
if(!IsDeflected(self.zombie_cost))
{
self.zombie_cost = level.totalkills;
}
self SetHintString("You must reach " + self.zombie_cost + " kills to open this door");
self SetCursorHint("HINT_NOICON");
self thread WaitForKills();
}

function WaitForKills()
{
self thread OperateDoor();
if(isdefined(self.scrpt_flag))
{
flag::init(self.script_flag);
}
while(1)
{
if(GetKills() >= self.zombie_cost)
{
self OperateDoor(true);
if(isdefined(self.script_flag))
{
flag::set(self.script_flag);
}
self Delete();
return;
}
wait(.1);
}
}

function GetKills()
{//not sure about this function, never go kills before
totalkills = 0;
players = GetPlayers();
for( i=0;i<players.size;i++ ){
if(isdefined(players[i].pers["kills"]))
{
totalkills += players[i].pers["kills"];
}
}
return totalkills;
}

function OperateDoor(open = false)
{
doors = GetEntArray(self.target,"targetname");
foreach(door in doors)
{
if(open)
{
door NotSolid();
door ConnectPaths();
door thread OpenDoor();
}
else
{
door DisconnectPaths();
}

}
}

function OpenDoor()
{
dest = self.origin + (0,0,80);
if(IsDeflected(self.target))
{
mystruct = struct::get(self.target, "targetname");
if(IsDeflected(mystruct))
{
dest = mystruct.origin;
}
}
if(isdefined(self.script_vector))
{
dest = self.origin + self.script_vector;
}
//play sound
//play fx
//change speed of door opening
self MoveTo(dest, 1);
}
Title: Re: Make door open after a certain amount of kills.
Post by: Cxwh on December 10, 2016, 02:48:30 pm
I know this may sound stupid, but can't I do this when the amount of kills is reached
Code Snippet
Plaintext
trigger notify("trigger", self);