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

Waittill not firing

broken avatar :(
Created 11 years ago
by greattomato
0 Members and 1 Guest are viewing this topic.
1,869 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 19 August 2015
Last active: 11 years ago
Posts
5
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
greattomato's Groups
greattomato's Contact & Social Links
Hey Everyone,

Made some progress making my map work like the following: no health regen, have to kill an enemy AI in order to gain health back. 

However, the program can not pass the waittill for some reason.  Could someone let me know if I implemented this correctly?

Code Snippet
Plaintext
main()
{
maps\_load::main();

level.player takeallweapons();
level.player giveWeapon("mp5");
level.player switchToWeapon("mp5");
level.healthRegenDisabled = true;
regenTime = 1000;
level.playerHealth_RegularRegenDelay = regenTime * 1000;

level.healthOverlayCutoff = 1000;//.55;//getdvarfloat("scr_player_healthregentime");

  myArray = getentarray("badguys", "targetname");
for(i=0;i<myArray.size;i++)
{
myArray[i] thread HealthController(myArray[i]);
}

}


HealthController(guy)
{
CanRegen = false;
CurrentPlayerHealth = level.player.health;
while(1)
{
if(CanRegen)
{
level.player.health = level.player.maxhealth;
CurrentPlayerHealth = level.player.maxhealth;
iprintlnbold("hey its not crashing");
CanRegen = false;
break;
}
else
{
level.player.health = CurrentPlayerHealth;
iprintlnbold("Its false");
}
guy waittill("damage", damage);

CanRegen = true;
iprintlnbold("It got below the canregen");


}
}
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods 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
Code Snippet
Plaintext
myArray = getentarray("badguys", "targetname");
What is this and how is it damaged? If it is not getting past the damage waittill, my first guess is it is not getting damage. So what is "it". This array gets a list of "badguys", "targetname". Are you shooting these "badguys"?

Or Do you mean to thread this on the zombies? There are ways for you get arrays of zombies, not like this I don't think.

Also, you don't need both myArray thread on and myArray passed if they were defined ents. Plus this level.player.health thing, I am not sure it is going to achieve what you are going for.

Me personally, if you found away to stop them from regenerating health, I would simple go to zombiemode_spawner and in the maybe around self thread zombie_think(); thread a new function for this:

Code Snippet
Plaintext
//find this
self thread zombie_think();
//add this below it
self thread PlayerHeal();
//make new function similar to this below the init function end }
PlayerHeal(){
    While(isdefined(self) && self.health>0){//edit, added while loop
self waittill( "damage", amount, attacker );
if(is_player_valid( attacker ) && attacker.health <= attacker.maxhealth){
if(attacker.health+10 <= attacker.maxhealth){
attacker.health = attacker.health+10;
}else{
attacker.health = attacker.maxhealth;
}
}
    }
}
Last Edit: August 24, 2015, 06:45:10 pm by MakeCents
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 19 August 2015
Last active: 11 years ago
Posts
5
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
greattomato's Groups
greattomato's Contact & Social Links
badguys is a spawner in the level.  I tried it out and if I make it a regular AI it works.  I need to use spawners but I'm not sure how to get the actual AI that it spawns so i might have to think of a different way of doing this.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods 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
badguys is a spawner in the level.  I tried it out and if I make it a regular AI it works.  I need to use spawners but I'm not sure how to get the actual AI that it spawns so i might have to think of a different way of doing this.

Exactly, that is why I wrote what I wrote. If it is only these spawners that you want to give players health, you can use a kvp for that, probably script_string, and check that in the new function.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 19 August 2015
Last active: 11 years ago
Posts
5
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
greattomato's Groups
greattomato's Contact & Social Links
Hm I'm having trouble figuring this out.  I can't seem to get the targetname of the AI's since they are being spawned by the spawner.  Is there an easy way to get this?  The badguys never acctually take damage since its just a spawner..:(
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods 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
Hm I'm having trouble figuring this out.  I can't seem to get the targetname of the AI's since they are being spawned by the spawner.  Is there an easy way to get this?  The badguys never acctually take damage since its just a spawner..:(

That's why I was saying to do it from zombiemode spawner. Those functions are thread on each zombie that is spawned, so you can just add another thread, using self. See my first answer, added while loop.

You can get a list of ai but that will be more difficult to manage, and you wouldn't use targetname. If you just thread it as they spawn, then your done.
Last Edit: August 24, 2015, 06:42:57 pm by MakeCents

 
Loading ...