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

Hurt Trigger for AI only

broken avatar :(
Created 8 years ago
by fanmagic
0 Members and 1 Guest are viewing this topic.
2,456 views
broken avatar :(
×
broken avatar :(
Location: deDortmund
Date Registered: 20 December 2015
Last active: 8 days ago
Posts
307
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter
My Groups
More
Personal Quote
Payback
Signature
Tears Of The Fallen | Join the project https://discord.gg/8gDNQRj
×
fanmagic's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
fanmagic's Contact & Social LinksTears Of The Fallen
How can i setup a hurt trigger which only damage zombies?
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
How can i setup a hurt trigger which only damage zombies?

Use a trigger_muliple in radiant, get the ent in script and just waittill it is triggered, and then check if the ent that triggered it is not a player.

Code Snippet
Plaintext

ent waittill( "trigger", who );
if(!IsPlayer( who )){
//do this to ai
who DoDamage( 50, ent.origin );
}


Depending on what you do, additional dog checks would be necessary. You could additionally check all ai if touching trigger when it is triggered and dodamage to each one instead of just the one that triggered.

Code Snippet
Plaintext
while(1){
ent waittill( "trigger", who );
ai = GetAiArray( "axis" );
for( i = 0; i < ai.size; i++ ){
if(ai[i] IsTouching( ent )) ai[i] DoDamage( 50, ent.origin );
}
wait(.5);
}

Last Edit: June 21, 2016, 03:31:28 pm by MakeCents
broken avatar :(
×
broken avatar :(
Location: deDortmund
Date Registered: 20 December 2015
Last active: 8 days ago
Posts
307
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter
My Groups
More
Personal Quote
Payback
×
fanmagic's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
fanmagic's Contact & Social LinksTears Of The Fallen
Use a trigger_muliple in radiant, get the ent in script and just waittill it is triggered, and then check if the ent that triggered it is not a player.

Code Snippet
Plaintext

ent waittill( "trigger", who );
if(!IsPlayer( who )){
//do this to ai
}


Depending on what you do, additional dog checks would be necessary
I would like to make a trap which kills zombies and dogs in higher rounds, but can't kill the player that fast.

Example:
A trigger hurt with dmg and damage 10000.
--> Can kill zombies in higher rounds, but also kill the player instantly.

So i need to reduce the player damage to example 25.

Thanks for your help so far ;)
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
×
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
I would like to make a trap which kills zombies and dogs in higher rounds, but can't kill the player that fast.

Example:
A trigger hurt with dmg and damage 10000.
--> Can kill zombies in higher rounds, but also kill the player instantly.

So i need to reduce the player damage to example 25.

Thanks for your help so far ;)

Ok, I would do something like this then:
Code Snippet
Plaintext
while(1){
ent waittill( "trigger", who );
if(IsPlayer( who )){
if(who.health>21){
who DoDamage( 20, who.origin );
}else{
RadiusDamage( who.origin, 10, 20, 20,1 );
}
}else{
ai = GetAISpeciesArray( "axis", "all");
for( i = 0; i < ai.size; i++ ){
if(ai[i] IsTouching( ent )) ai[i] DoDamage( 50, ent.origin );
}
}
wait(.5);//time between hurting
}


You could just combine the players and ai array and then check each of those instead. But its about the same either way.
Code Snippet
Plaintext
while(1){
ent waittill( "trigger", who );
players = get_players( );
ai = GetAISpeciesArray( "axis", "all");
allents = array_combine( players,ai );

for( i=0;i<allents.size;i++ ){
if(allents[i] IsTouching( ent )){
if(IsPlayer( allents[i] )){
if(allents[i].health>21){
allents[i] DoDamage( 20, allents[i].origin );
}else{
RadiusDamage( allents[i].origin, 10, 20, 20,1 );
}
}else{
allents[i] DoDamage( 50, ent.origin );
}
}
}
wait(.5);//time between hurting
}
The difference would be in the last one, you will hurt everyone, but in the first one you may not hurt the player or may not hurt the ai, depending on which returns the trigger...
Last Edit: June 21, 2016, 03:44:25 pm by MakeCents
broken avatar :(
×
broken avatar :(
Location: deDortmund
Date Registered: 20 December 2015
Last active: 8 days ago
Posts
307
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter
My Groups
More
Personal Quote
Payback
×
fanmagic's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
fanmagic's Contact & Social LinksTears Of The Fallen
Ok, I would do something like this then:
Code Snippet
Plaintext
while(1){
ent waittill( "trigger", who );
if(IsPlayer( who )){
if(who.health>21){
who DoDamage( 20, who.origin );
}else{
RadiusDamage( who.origin, 10, 20, 20,1 );
}
}else{
ai = GetAISpeciesArray( "axis", "all");
for( i = 0; i < ai.size; i++ ){
if(ai[i] IsTouching( ent )) ai[i] DoDamage( 50, ent.origin );
}
}
wait(.5);
}

Code Snippet
Plaintext
ai = GetAISpeciesArray( "axis", "all");
         for( i = 0; i < ai.size; i++ ){
            if(ai[i] IsTouching( ent )) ai[i] DoDamage( 50, ent.origin );

And i can change the 50 for example to 1000 to do more damage to the ai, right?
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
×
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
Code Snippet
Plaintext
ai = GetAISpeciesArray( "axis", "all");
         for( i = 0; i < ai.size; i++ ){
            if(ai[i] IsTouching( ent )) ai[i] DoDamage( 50, ent.origin );

And i can change the 50 for example to 1000 to do more damage to the ai, right?

Yup, and I added more options. If you want to kill them, people usually do:
Code Snippet
Plaintext
ai[i].health + 666
Last Edit: June 21, 2016, 03:45:50 pm by MakeCents
broken avatar :(
×
broken avatar :(
Location: deDortmund
Date Registered: 20 December 2015
Last active: 8 days ago
Posts
307
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter
My Groups
More
Personal Quote
Payback
×
fanmagic's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
fanmagic's Contact & Social LinksTears Of The Fallen
Yup, and I added more options. If you want to kill them, people usually do:
Code Snippet
Plaintext
ai[i].health + 666
Ok, try it out now. Thank you very much :)

 
Loading ...