UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

SP spawn system help?

broken avatar :(
Created 10 years ago
by daedra descent
0 Members and 1 Guest are viewing this topic.
1,106 views
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 8 years ago
Posts
2,790
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
Signature
Let's keep this thread on topic from here on in. -DBZ

+1 to off-topic reply -DBZ

lmao. Too funny.

Goliath Script Placer: http://ugx-mods.com/forum/index.php/topic,11234.msg125257/topicseen.html#new

"...Christ, people. Learn C, instead of just stringing random characters
together until it compiles (with warnings)..."

-Linus Torvalds
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
I was wondering if anyone could help me figure out why AI aren't spawning in my spawn system. obviously SinglePlayer levels don't have all the fancy scripting like that used in zombiemode, so I had to create a new spawning system.

AI spawn logic script:
Code Snippet
Plaintext
#include maps\_utility; 
#include maps\soviet_utility;
main()
{
level.enemy_spawns = getEntarray("daedra_spawners","targetname");

level.friendly_spawns = getEntarray("daedra_spawners","targetname");

if(!isdefined(level.friendly_spawns) )
{
level.friendly_spawns do_spawn_logic_friendly();
level.allie = level.friendly_spawns;
}
if(!isdefined(level.enemy_spawns) )
{
level.enemy_spawns do_spawn_logic_friendly();
level.axis = level.enemy_spawns;
}
}
do_spawn_logic_friendly()
{
self.count = 0;
players = get_players();

if(!isdefined(level.zones) )
{
if(players istouching(level.zones) && level.zones.is_active == true )
{
self.count = 9999;
self dospawn();
}
}
}
// Assigns a gun to an enemy dependent upon their team/class.
weapon_class_think( team, class )
{
weaponList = [];
weapon = "";



if(!isdefined (level.allie) )
{
switch( class )
{
case "assualt":
weaponList[weaponList.size] = "stg44";
weaponList[weaponList.size] = "gewehr43";
weaponList[weaponList.size] = "doublebarrel_sawed_grip";
weaponList[weaponList.size] = "doublebarrel";
weaponList[weaponList.size] = "shotgun";
break;

default:
weaponList[weaponList.size] = "gewehr43";
break;
}
}
if(!isdefined (level.axis) )
{

switch( class )
{
case "assualt":
weaponList[weaponList.size] = "stg44";
weaponList[weaponList.size] = "gewehr43";
weaponList[weaponList.size] = "doublebarrel_sawed_grip";
weaponList[weaponList.size] = "doublebarrel";
weaponList[weaponList.size] = "shotgun";
break;

default:
weaponList[weaponList.size] = "gewehr43";
break;
}
}

if( weaponList.size > 1 )
{
tWeaponList = array_randomize( weaponList );
weapon = tWeaponList[RandomInt( tWeaponList.size )];
self set_npc_weapon( weapon );
}
else
{
return weaponList[0];
}
}
do_settings_set(team, class)
{
if(!isdefined (level.allie) )
{
switch(class)
{
case "Attacker":
self PushPlayer( true );
self disable_pain();
self.goalradius = 512;
// self.maxhealth = GetDvarInt( "payload_attackerHealth" ) + 10;
getToPlayers();
break;
 
case "Defender":
self PushPlayer( true );
self enable_pain();
self.goalradius = 1024;
// self.maxhealth = GetDvarInt( "payload_defenderHealth" ) + 10;
getToPlayers();
break;
}
}

if(!isdefined (level.axis) )
{
switch(class)
{
case "Attacker":
self PushPlayer( true );
self disable_pain();
self.goalradius = 512;
// self.maxhealth = GetDvarInt( "payload_attackerHealth" ) + 10;
getToPlayers();
break;
 
case "Defender":
self PushPlayer( true );
self enable_pain();
self.goalradius = 1024;
// self.maxhealth = GetDvarInt( "payload_defenderHealth" ) + 10;
getToPlayers();
break;
}
}
}

Zone system:
Code Snippet
Plaintext
#include maps\_utility; 
#include common_scripts\utility;
#include maps\soviet_utility;

zone_setup()
{
level.zones = getEntarray("general_zones", "targetname");

initial_zone = getEntarray("initial_zone", "targetname");

level.zones manage_zone_ai();

if(!isdefined (initial_zone) )
{
initial_zone.is_active = true;
}
}
manage_zone_ai()
{
spawners = undefined;

if(isDefined(self.target))
{
spawners = getentarray(self.target,"targetname");
}

goals = getstructarray("exterior_goal","targetname");
check_ent = undefined;
while(getdvarint("noclip") == 0 ||getdvarint("notarget") != 0 )
{
zone_active = false;
players = get_players();

for(i=0;i<players.size;i++)
{
if(isDefined(check_ent))
{
if(players[i] istouching(self) || players[i] istouching(check_ent))
{
zone_active = true;
}
}
else
{
if(players[i] istouching(self))
{
zone_active = true;
}
}
}
//players are in the volume, activate any associated spawners
if(zone_active )
{
if(isDefined(spawners))
{
for(x=0;x<spawners.size;x++)
{
//Duplicate spawners are allowed
no_dupes = array_check_for_dupes( level.enemy_spawns, spawners[x] );
if(!no_dupes)
{
if( (!isDefined(spawners[x].locked_spawner)) || ( isDefined(spawners[x].locked_spawner && !spawners[x].locked_spawner)) )
{
level.enemy_spawns = add_to_array(level.enemy_spawns,spawners[x]);
}
}
}
}

//activate the associated goals
for(x=0;x<goals.size;x++)
{
if(isDefined(goals[x].is_active) )
{
if( isDefined(goals[x].script_string) && (goals[x].script_string == self.targetname + "_goal"))
{
goals[x] thread trigger_on();
}
if(isDefined(check_ent))
{
if( isDefined(goals[x].script_string) && isDefined(check_ent.script_noteworthy) && goals[x].script_string == check_ent.script_noteworthy + "_goal")
{
goals[x] thread trigger_on();
}
}
}
}
}

//players are not in the volume, so disable the spawners
else
{
if(isDefined(spawners))
{
for(x=0;x<spawners.size;x++)
{
if(isDefined(spawners[x].script_string) && spawners[x].script_string == self.targetname)
{
level.enemy_spawns = array_remove_nokeys(level.enemy_spawns, spawners[x]);
}
}
}

//disable the associated goals
for(x=0;x<goals.size;x++)
{
if(isDefined(goals[x].is_active) )
{
if ( isDefined(goals[x].script_string) && (goals[x].script_string == self.targetname + "_goal") )
{
goals[x] thread trigger_off();
}
if(isDefined(check_ent))
{
if( (isDefined(goals[x].script_string)) && (isDefined(check_ent.script_noteworthy)) && (goals[x].script_string == check_ent.script_noteworthy + "_goal"))
{
goals[x] thread trigger_off();
}
}
}
}
}

//wait a second before another check
wait(1);
}
}


 
Loading ...