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

zone spawner getting script

broken avatar :(
Created 10 years ago
by daedra descent
0 Members and 1 Guest are viewing this topic.
3,474 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
Just want to check to see if anyone could find a problem with this script. "Self" is a zone.

Code Snippet
Plaintext
get_zone_spawners()
{
spawners = undefined;

zones = getentarray(self.script_noteworthy,"script_noteworthy");

for( k = 0; k < zones.size; k++ )
{
spawners = getEntarray(zones[k].target,"targetname");

if(level.debug == true && zones[k].is_active == true)
{
iprintln("This zone has " + spawners.size + " spawners");
}

return spawners;
}
}
Last Edit: May 30, 2014, 12:24:54 pm by daedra descent
broken avatar :(
×
broken avatar :(
Location: gbComing up in the world
Date Registered: 26 November 2013
Last active: 9 years ago
Posts
325
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
I own the hat!
×
DuaLVII's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
DuaLVII's Contact & Social Linksthomas.gascoigne.7DuaLVIIDuaLVIITheProlonger
Your probably getting an error because you need to have some kind of blank return in the function like if the for flow control returns nothing it will shoot itself in the head.
Not saying it will happen, but on load it runs itself through those scenario's.

Just need to pop it in there for the scripts convenience.

Code Snippet
Plaintext
get_zone_spawners()
{
spawners = undefined;

zones = getentarray(self.script_noteworthy,"script_noteworthy");

for( k = 0; k < zones.size; k++ )
{
spawners = getEntarray(zones[k].target,"targetname");

if(level.debug == true && zones[k].is_active == true)
{
iprintln("This zone has " + spawners.size + " spawners");
}

return spawners;
}

return false;
}

If not that, Is it an error your receiving or text not showing or is it always returning 0?
Last Edit: May 26, 2014, 07:32:40 am by DuaLVII
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
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
Your probably getting an error because you need to have some kind of blank return in the function like if the for flow control returns nothing it will shoot itself in the head.
Not saying it will happen, but on load it runs itself through those scenario's.

Just need to pop it in there for the scripts convenience.

Code Snippet
Plaintext
get_zone_spawners()
{
spawners = undefined;

zones = getentarray(self.script_noteworthy,"script_noteworthy");

for( k = 0; k < zones.size; k++ )
{
spawners = getEntarray(zones[k].target,"targetname");

if(level.debug == true && zones[k].is_active == true)
{
iprintln("This zone has " + spawners.size + " spawners");
}

return spawners;
}

return false;
}

If not that, Is it an error your receiving or text not showing or is it always returning 0?

Nah, the only issue that i get with it is that one or two AI spawn in other zones for whatever reason at the start and i have no real idea why.

Guess i should post the entire code.

Code Snippet
Plaintext
#include maps\_utility; 
#include common_scripts\utility;

main()
{
level.debug = true;
level thread zone_think();
}


Zone_think()
{
zones = getEntarray("zones","targetname");
while(1)
{
players = get_players();

for( i = 0; i < players.size; i++ )
{
for( k = 0; k < zones.size; k++ )
{
if(players[i] istouching(zones[k]) )
{
zones[k].is_active = true;
zones[k] activate_spawners();

if(zones[k].is_active == true && isdefined(zones[k].script_noteworthy) && level.debug == true )
{
players[i] iprintln( "You are in Zone: " + zones[k].script_noteworthy);
}
}
else
{
zones[k].is_active = false;
zones[k] shut_off_spawners();
}
if(zones[k].is_active == true && isdefined(zones[k].script_noteworthy) && level.debug == true )
{
players[i] iprintln( "You are in Zone: " + zones[k].script_noteworthy);
}
else if(zones[k].is_active == false && isdefined(zones[k].script_noteworthy) && level.debug == true )
{
players[i] iprintln("Zone: " + zones[k].script_noteworthy + " Not active!");
}

}

}
wait(1);
}
}
activate_spawners()
{
spawners = self get_zone_spawners();

if(isdefined(spawners) )
{
for( k = 0; k < spawners.size; k++ )
{
spawners[k].count = 9999;
}
}
}
shut_off_spawners()
{
spawners = self get_zone_spawners();

if(isdefined(spawners) )
{
for( k = 0; k < spawners.size; k++ )
{
spawners[k].count = 0;
}
}
}

get_zone_spawners()
{
zones = getentarray(self.script_noteworthy,"script_noteworthy");

for( k = 0; k < zones.size; k++ )
{
spawners = getEntarray(zones[k].target,"targetname");

if(level.debug == true && zones[k].is_active == true)
{
iprintln("This zone has " + spawners.size + " spawners");
}

return spawners;
}
}


broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Nah, the only issue that i get with it is that one or two AI spawn in other zones for whatever reason at the start and i have no real idea why.

Guess i should post the entire code.

Code Snippet
Plaintext
#include maps\_utility; 
#include common_scripts\utility;

main()
{
level.debug = true;
level thread zone_think();
}


Zone_think()
{
zones = getEntarray("zones","targetname");
while(1)
{
players = get_players();

for( i = 0; i < players.size; i++ )
{
for( k = 0; k < zones.size; k++ )
{
if(players[i] istouching(zones[k]) )
{
zones[k].is_active = true;
zones[k] activate_spawners();

if(zones[k].is_active == true && isdefined(zones[k].script_noteworthy) && level.debug == true )
{
players[i] iprintln( "You are in Zone: " + zones[k].script_noteworthy);
}
}
else
{
zones[k].is_active = false;
zones[k] shut_off_spawners();
}
if(zones[k].is_active == true && isdefined(zones[k].script_noteworthy) && level.debug == true )
{
players[i] iprintln( "You are in Zone: " + zones[k].script_noteworthy);
}
else if(zones[k].is_active == false && isdefined(zones[k].script_noteworthy) && level.debug == true )
{
players[i] iprintln("Zone: " + zones[k].script_noteworthy + " Not active!");
}

}

}
wait(1);
}
}
activate_spawners()
{
spawners = self get_zone_spawners();

if(isdefined(spawners) )
{
for( k = 0; k < spawners.size; k++ )
{
spawners[k].count = 9999;
}
}
}
shut_off_spawners()
{
spawners = self get_zone_spawners();

if(isdefined(spawners) )
{
for( k = 0; k < spawners.size; k++ )
{
spawners[k].count = 0;
}
}
}

get_zone_spawners()
{
zones = getentarray(self.script_noteworthy,"script_noteworthy");

for( k = 0; k < zones.size; k++ )
{
spawners = getEntarray(zones[k].target,"targetname");

if(level.debug == true && zones[k].is_active == true)
{
iprintln("This zone has " + spawners.size + " spawners");
}

return spawners;
}
}

If it is only at the beginning of the game, did you try adding a wait before the the code?
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 4 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter Elite
My Groups
More
×
YaPh1l's Groups
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
Are you calling your code after _zombiemode::main(). Before that, get_players() might not return any players.

- Phil.
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
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
Are you calling your code after _zombiemode::main(). Before that, get_players() might not return any players.

- Phil.

This isn't for zombiemode. Its for campaign.

This is practically the same as asylum zoning except its broken down into 5 different functions.
Last Edit: May 31, 2014, 11:54:08 am by daedra descent
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 4 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter Elite
My Groups
More
×
YaPh1l's Groups
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
Okay, then, are you calling this function after the flag "all_players_connected" has been set?

- Phil.
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
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
Okay, then, are you calling this function after the flag "all_players_connected" has been set?

- Phil.

No i didn't. Thought that was only for COOP.
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 4 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter Elite
My Groups
More
×
YaPh1l's Groups
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
Well, I'd assume you would want it to work in Coop too. all_players_connected will also be set in SP, so no harm in waiting for it to be set.

- Phil.

 
Loading ...