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

Zombies function

broken avatar :(
Created 13 years ago
by Ege115
0 Members and 1 Guest are viewing this topic.
1,841 views
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 2 years ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Ege115's Contact & Social LinksEge115
Hello everyone!

Do someone here knows how to make a function in a script so lets say when activating a trigger the zombies will stop follow the player and walk or run to some other random places and then a some seconds later the zombies will start following you again?
If someone wants to help me with that, I would really appreciate that!
Thanks!

Post Merge: December 02, 2013, 10:29:10 pm
Stop followING the player I mean.

And between THEN and A, the A should not be there I know, sorry
I always discover wrong english after I posted the topic, lol.
Last Edit: December 02, 2013, 10:29:10 pm by Ege115
Marked as best answer by Ege115 12 years ago
broken avatar :(
×
broken avatar :(
Former UGX Lead Asset Creator
Location: ca
Date Registered: 17 August 2012
Last active: 7 years ago
Posts
1,932
Respect
Forum Rank
Zombie Destroyer
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
Personal Quote
Eh?
Signature

(Click to enter portfolio)
×
SajeOne's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
Well to do something like that we can use the "getEnt" function to retrieve the trigger from script and use a waittill to wait for that trigger to be triggered. Example:

Code Snippet
Plaintext
trig = getEnt("trigger", "targetname");
trig waittill("trigger");

Then to set players invisible to zombies we can do two different things. This first scenario would only hide the player that pressed the trigger. By changing the waittill we used to this:

Code Snippet
Plaintext
trig waittill("trigger", user);

We can now retrieve the variable that we have called "user" which is equal to the player entity that triggered the trigger. We can now use this variable to change a property the player entity has to true.

Code Snippet
Plaintext
user.ignoreme = true;

Making "user.ignoreme" true means the zombies will not be attracted to him.

You can then use a wait to wait for a certain amount of time and then set "user.ignoreme" back to false. Example:

Code Snippet
Plaintext
user.ignoreme = true;
wait 30;
user.ignoreme = false;

The second way we can do this is by making all the players invisible once the trigger is triggered. This can be done by creating a variable that will be equal to the array of players and then using a for loop to loop through the array setting each player invisible. Example:

Code Snippet
Plaintext
players = getPlayers();
for(i = 0; i < players.size; i++)
    players[i].ignoreme = true;

wait 30;

for(i = 0; i < players.size; i++)
    players[i].ignoreme = false;

The full thing would look something like this:

Code Snippet
Plaintext
trig = getEnt("trigger", "targetname");
trig waittill("trigger");
players = getPlayers();
for(i = 0; i < players.size; i++)
    players[i].ignoreme = true;
wait 30;
for(i = 0; i < players.size; i++)
   players[i].ignoreme = false;
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 2 years ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Ege115's Contact & Social LinksEge115
Yes I know I have learned the basic stuff like
getent = ("SCRIPT","targetname");
or wait (5);
or
when stuff will move
movez, movex, movey in different directions with help from how long it takes for like the brush to move and how far it will move like,
SCRIPT movex ("-15, 4")

well yea you know the basics.

But I will test that you told me sajeone, thank you!

I will reply when I have tested this if I have time.

 
Loading ...