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

Help with Triggering flame/electric FX on zombies

HOT
broken avatar :(
Created 12 years ago
by whippytrout
0 Members and 1 Guest are viewing this topic.
5,536 views
broken avatar :(
×
broken avatar :(
Location: usgeorgia
Date Registered: 24 April 2013
Last active: 3 years ago
Posts
560
Respect
Forum Rank
Zombie Enslaver
Primary Group
Mapper
×
whippytrout's Groups
Mapper Has released one or more maps to the UGX-Mods community.
whippytrout's Contact & Social LinksWhippyTroutWhippyTrout
I came across a tutorial on zombiemodding that triggered fx on zombies but it seemed to be broken, a couple of years old, and had a lot of controversy over how to do it the right way in the comments so I followed npissoawsome's comments which had his version of a script (shown below). To summarize what I'm trying to do is simple, I created a trigger_multiple in front of my zombie spawns, then i created a trigger that starts the zombie rounds and activates the trigger_multiple. My problem is that the fx doesn't play on the zombie when it passes through the trigger_multiple, but it plays on me if I pass through the trigger_multiple. If Someone can please take a look at the code below and see why the zombies don't play the fx I would be grateful, plus it could be added to the tutorials if it gets solved and can finally be a resolved issue.

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

effect_init()
{
//Original script by blackwe11
//Modified by npissoawsome
level waittill("start_rounds");
//EDIT THESE///////////////////////////////////////////////////////////
trig = getEnt("cell_trig", "targetname");
thread effect_think("zombie_effect_trigger", trig, undefined);
// thread effect_loader("targetname of trigger, you need to have this", "targetname of activating trigger, undefined if no trigger", "1 = needs power, undefined = doesn't need power");

/////////////////////////////////////////////////////////////////////////
}

//////////////////////////////////////////////////////
//DON'T EDIT ANYTHING BEYOND THIS POINT///
/////////////////////////////////////////////////////

effect_think(trigger_name, start_trigger_name, power)
{
if(isdefined(power))
{
if(power == 1)
{
flag_wait("electricity_on");
}
}
trigger = getent(trigger_name, "targetname");
if(isDefined(start_trigger_name))
{
start_trigger = getent(start_trigger_name, "targetname");

if(isDefined(start_trigger.script_noteworthy))
{
start_trigger setCursorHint(start_trigger.script_noteworthy);
}

if(isDefined(start_trigger.script_string))
{
start_trigger setHintString(start_trigger.script_string);
}

while(true)
{
start_trigger waittill("trigger", player);
if(isDefined(start_trigger.zombie_cost))
{
cost = start_trigger.zombie_cost;
if(player.score >= cost)
{
player playsound("cha_ching");
player maps\_zombiemode_score::minus_to_player_score(cost);
thread effect_loader(trigger);
break;
}else
{
player playsound("no_cha_ching");
}
}else
{
thread effect_loader(trigger);
break;
}
}
}else
{
thread effect_loader(trigger);
}
}

effect_loader(trigger)
{
iPrintLn("Flame On!!!");
while(true)
{
trigger waittill("trigger", player);
damage = (player.max_health / 4);
player dodamage(damage, player.origin);
if(isDefined(trigger.script_noteworthy))
{
switch(trigger.script_noteworthy)
{
case "fire":
if(isDefined(trigger.script_flag) && trigger.script_flag == "looping")
{

while(IsAlive(player))
{
playfxontag(level._effect["zombie_fire"] , player, "j_spine4");
playfxontag(level._effect["zombie_fire"] , player, "j_neck");

wait(5);
}
}else
{
playfxontag(level._effect["zombie_fire"] , player, "j_spine4");
playfxontag(level._effect["zombie_fire"] , player, "j_neck");
}
break;

case "electric":
if(isDefined(trigger.script_flag) && trigger.script_flag == "looping")
{
while(IsAlive(player))
{

playfxontag(level._effect["electricity"] , player, "j_spine4");
playfxontag(level._effect["electricity"] , player, "j_neck");

wait(5);
}
}else
{
playfxontag(level._effect["electricity"] , player, "j_spine4");
playfxontag(level._effect["electricity"] , player, "j_neck");
}
break;

case "random":

randomfx = randomint(2);

if(isDefined(trigger.script_flag) && trigger.script_flag == "looping")
{

while(IsAlive(player))
{

if(randomfx == 0)
{
playfxontag(level._effect["electricity"] , player, "j_spine4");
playfxontag(level._effect["electricity"] , player, "j_neck");
wait(3);
}else if(randomfx == 1)
{
playfxontag(level._effect["zombie_fire"] , player, "j_spine4");
playfxontag(level._effect["zombie_fire"] , player, "j_neck");
wait(5);
}

}
}else
{
if(randomfx == 0)
{
playfxontag(level._effect["electricity"] , player, "j_spine4");
playfxontag(level._effect["electricity"] , player, "j_neck");
}else if(randomfx == 1)
{
playfxontag(level._effect["zombie_fire"] , player, "j_spine4");
playfxontag(level._effect["zombie_fire"] , player, "j_neck");
}
}

break;

case "both":

if(isDefined(trigger.script_flag) && trigger.script_flag == "looping")
{
while(IsAlive(player))
{

playfxontag(level._effect["electricity"] , player, "j_spine4");
playfxontag(level._effect["zombie_fire"] , player, "j_neck");

wait(4);

}
}else
{
playfxontag(level._effect["electricity"] , player, "j_spine4");
playfxontag(level._effect["zombie_fire"] , player, "j_neck");
}

break;

default:
if(isDefined(trigger.script_flag) && trigger.script_flag == "looping")
{

while(IsAlive(player))
{

playfxontag(level.lelectric_fx, player, "j_spine4");
playfxontag(level.lelectric_fx, player, "j_neck");

wait(5);
}
}else
{
playfxontag(level._effect["electricity"] , player, "j_spine4");
playfxontag(level._effect["electricity"] , player, "j_neck");
}
break;
}
}else
{
iPrintLn("Trigger Undefined");
}
wait(0.5);
}
}

P.S. I also checked all my zombies and they have the right joints for attaching the fx each model has a j_spine4 and a j_neck. Here is the original tutorial: http://www.zombiemodding.com/index.php?topic=3234.msg92035#msg92035
Last Edit: February 06, 2014, 01:05:12 am by whippytrout
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 10 years ago
Posts
2,789
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
Thats a lot of code for something simple like spawning an FX on an AI origin, lol.

I'm not 100% sure, but your playfxontag(); has "player" as a variable that your passing through, AND the script doesn't even get an Array of the Axis AI in the map to spawn the FX on, which leads me to believe that this script wasn't intended for AI to begin with.

I created a function that (from what i can tell) does what you want. I never tested it, but it should work.

Code Snippet
Plaintext
FX_trig()
{
players = get_players();

AI = getaispeciesarray("axis");

triggers = getEntarray("flame_triggers", "targetname");


while(1)
{
for( i = 0; i < triggers; i++ )
{
if(players istouching(triggers[i]) && AI istouching(triggers[i]) ) // make sure that both Players and AI are in the trigs before playing the FX
{
playfx("CHANGE_THIS", AI.origin);
}
}
}
}









Last Edit: February 06, 2014, 03:34:44 pm by daedra descent
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 6 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Scripter Elite
My Groups
More
×
YaPh1l's Groups
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
@daedra descent
Your script won't even compile. Sorry.

@whippytrout
You probably forgot to check AI_AXIS on your trigger_multiple. Depending on what you want, you might also want to check NOTPLAYER.
Also, that script does damage to the triggering zombie / player (but the code is wrong, so it actually doesn't). I don't know if you want that or not. Lastly, if you use the script_flag = looping KVP, it will wait till the zombie / player is dead and not react to other zombies / players meanwhile. Well, that's all I found looking over it quickly.

- Phil.
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 10 years ago
Posts
2,789
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
@daedra descent
Your script won't even compile. Sorry.

-

Yeah i noticed that now, fixed it.



broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 6 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Scripter Elite
My Groups
More
×
YaPh1l's Groups
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
It still won't work though. You only acquire the players and AI once, then never again, so you don't take into account any disconnecting players and most importantly, all the zombies that have not spawned at the time you are calling this (which are quite a lot). Also, your loop does never wait, so the engine will terminate it or it will cause it to lock up.

- Phil.
broken avatar :(
×
broken avatar :(
Location: usgeorgia
Date Registered: 24 April 2013
Last active: 3 years ago
Posts
560
Respect
Forum Rank
Zombie Enslaver
Primary Group
Mapper
My Groups
More
My Contact & Social Links
More
×
whippytrout's Groups
Mapper Has released one or more maps to the UGX-Mods community.
whippytrout's Contact & Social LinksWhippyTroutWhippyTrout
Thanks for the help seems like all I have to do is check the boxes you mentioned on the trigger multiple. I'm on my phone now but I'll try it when I get to my pc. It seems that you think this script is not very practical which I noticed as well. Do you know of a better way to play the fx on the zombies that wont hurt zombies? Right now I activate a trigger and the zombies spawn and walk through the trigger multiple and catch fire. It also seems the code still runs because when I quit the game it takes about 30 seconds to end. Couldn't I just make a function that waits till the trigger is pressed to play fx on zombies joints similiar to daedra descent's code?
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 6 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Scripter Elite
My Groups
More
×
YaPh1l's Groups
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
Well, if you remove the few lines referring to damage and not set the script_flag KVP, it basically does exactly that.
Could be done more nicely for sure, but it would work.
Also, script code execution does not prevent the game from exiting, scripts just get terminated, at least usually.

- Phil.
broken avatar :(
×
broken avatar :(
Location: usgeorgia
Date Registered: 24 April 2013
Last active: 3 years ago
Posts
560
Respect
Forum Rank
Zombie Enslaver
Primary Group
Mapper
My Groups
More
My Contact & Social Links
More
×
whippytrout's Groups
Mapper Has released one or more maps to the UGX-Mods community.
whippytrout's Contact & Social LinksWhippyTroutWhippyTrout
Ok I played around with it and checked the axis box and the noplayer box in radiant and it works as you said, only the first zombie catches on fire. So I removed the script flag: looping kvp and all the zombies catch on fire but the fire goes out after a few seconds. My new question is can i make all the zombies stay on fire all the time and I need it to only happen if I select one of my two zombie spawn/round start triggers. Right now I have two triggers and if i use one it starts the round and spawns a zombie variant but no matter which one i use it always spawns them on fire. I just want one to be on fire. In the beginning of the script I thought I set one of the triggers as the activate trigger but it must not be working.  Here is the lines im referring to. Do I need to thread effect_loader like I did effect_think?

Code Snippet
Plaintext
 trig = getEnt("cell_trig", "targetname");
    thread effect_think("zombie_effect_trigger", trig, undefined);
    // thread effect_loader("targetname of trigger, you need to have this", "targetname of activating trigger, undefined if no trigger", "1 = needs power, undefined = doesn't need power");
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 6 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Scripter Elite
My Groups
More
×
YaPh1l's Groups
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
Well, you can just not call effect_think() at all and directly call effect_loader() in the code of the one trigger.
To keep the fire burning, you need an extra function which does this while(IsAlive(...)) loop, so that it can be thread-called to not block the execution of the main trigger function. Alternatively, you can use a looping FX and link tag_origin scriptmodels to the zombie and delete them once the zombie dies, basically like the eye glow code from _zombiemode_spawner. That requires more work though.

- Phil.
broken avatar :(
×
broken avatar :(
Location: usgeorgia
Date Registered: 24 April 2013
Last active: 3 years ago
Posts
560
Respect
Forum Rank
Zombie Enslaver
Primary Group
Mapper
My Groups
More
My Contact & Social Links
More
×
whippytrout's Groups
Mapper Has released one or more maps to the UGX-Mods community.
whippytrout's Contact & Social LinksWhippyTroutWhippyTrout
Ok I did what you said about the two triggers and it works great. I'm having a little trouble with the threading part you mentioned would fix the fire from going out. I kinda get what your saying but I'm not 100% on how to do it. I've tried many ways but they all just set the first zombie on fire. I wrote a new script to try and make this work maybe you can point out where i need to thread or if I even have it set up right.

Code Snippet
Plaintext
effect_init()
{
trig = getEnt("hazmat_trig", "targetname");
trig2 = getEnt("cell_trig", "targetname");
level.zombie_variant = 0;
trigger = getent("zombie_effect_trigger", "targetname");

if(isdefined(trig))
  {
trig SetCursorHint("HINT_NOICON");
      trig SetHintString("Press & Hold &&1 to Pickup Orb");
      while(1)
      {
trig waittill("trigger", user);
        if( is_player_valid(user))
        {
user playsound( "cha_ching" );
    level.zombie_variant = 1;
level notify("start_rounds");
          trig delete();
  trig2 delete();
                          thread effect_loader(trigger);
}
  }
  }

if(isdefined(trig2))
  {
trig2 SetCursorHint("HINT_NOICON");
      trig2 SetHintString("Press & Hold &&1 to Read Book");
      while(1)
      {
trig2 waittill("trigger", user);
        if( is_player_valid(user))
        {
user playsound( "cha_ching" );
    level.zombie_variant = 2;
level notify("start_rounds");
    trig delete();
trig2 delete();
thread effect_loader(trigger);
}

  }

 
}

effect_loader(trigger)
{
iPrintLn("Flame On!!!");
while(true)
{
trigger waittill("trigger", player);
damage = (player.max_health / 4);
player dodamage(damage, player.origin);
if(isDefined(trigger.script_noteworthy))
{
switch(trigger.script_noteworthy)
{
case "fire":
if(isDefined(trigger.script_flag) && trigger.script_flag == "looping")
{

while(IsAlive(player))
{
playfxontag(level._effect["zombie_fire"] , player, "j_spine4");
playfxontag(level._effect["zombie_fire"] , player, "j_neck");

wait(5);
}
}else
{
playfxontag(level._effect["zombie_fire"] , player, "j_spine4");
playfxontag(level._effect["zombie_fire"] , player, "j_neck");
}
break;

case "electric":
if(isDefined(trigger.script_flag) && trigger.script_flag == "looping")
{
while(IsAlive(player))
{

playfxontag(level._effect["electricity"] , player, "j_spine4");
playfxontag(level._effect["electricity"] , player, "j_neck");

wait(5);
}
}else
{
playfxontag(level._effect["electricity"] , player, "j_spine4");
playfxontag(level._effect["electricity"] , player, "j_neck");
}
break;
}
}else
{
iPrintLn("Trigger Undefined");
}
wait(0.5);
}
}
Last Edit: February 07, 2014, 12:45:50 am by whippytrout
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 2 years ago
Posts
1,186
Respect
1,332Add +1
Forum Rank
Zombie Colossus
Primary Group
Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
Signature
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntStuffyBluntstuffy@BluntZombieStuffyZombie
From what i can tell, you're starting of the wrong way to begin with, you want to try something like this i guess:

Code Snippet
Plaintext
effect_init()
{
trig = getEnt("hazmat_trig", "targetname");
trig2 = getEnt("cell_trig", "targetname");

trig thread hazmat_fx();         you "thread" it so this function keeps going while the new one runs, instead of waiting for it to finish
trig2 thread cell_fx();

level.zombie_variant = 0;
}

hazmat_fx()
{
your hazmat trigger here, deleting the other one
}

cell_fx()
{
your other trigger here deleting the hazmat one
}


and work from there...
(you can "thread" a function on every zombie that plays the fx and stops when he dies the same way...)
broken avatar :(
×
broken avatar :(
Location: usgeorgia
Date Registered: 24 April 2013
Last active: 3 years ago
Posts
560
Respect
Forum Rank
Zombie Enslaver
Primary Group
Mapper
My Groups
More
My Contact & Social Links
More
×
whippytrout's Groups
Mapper Has released one or more maps to the UGX-Mods community.
whippytrout's Contact & Social LinksWhippyTroutWhippyTrout
I get what your saying but I'm still confused as to what exactly I'm trying to fix. I mean I have two triggers, each starts round 1 and each selects a different zombie variant. I have a trigger multiple that is supposed to play a fire or electricity fx on each zombie if they walk through the trigger but It only plays on the first zombie that touches it. That has something to do with what phil and you said about threading but I dont know if I'm supposed to thread before each trigger starts the round and have the actual start round code and fx code in a different function or what. I feel so close I just cant get the fx to play on every zombie. I also didnt include the first triggers code in the script above, I added it in if that helps
Last Edit: February 07, 2014, 12:49:58 am by whippytrout
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 2 years ago
Posts
1,186
Respect
1,332Add +1
Forum Rank
Zombie Colossus
Primary Group
Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntStuffyBluntstuffy@BluntZombieStuffyZombie
It's an interesting way of seeting up a function  ;D, but if the triggers work it's fine i guess... For the threading part:

Code Snippet
Plaintext
effect_loader(trigger)
{
    iPrintLn("Flame On!!!");
    while(true)
    {
        trigger waittill("trigger", player);
        damage = (player.max_health / 4);
        player dodamage(damage, player.origin);
        if(isDefined(trigger.script_noteworthy))
        {
            switch(trigger.script_noteworthy)
            {
                case "fire":
                    if(isDefined(trigger.script_flag) && trigger.script_flag == "looping")
                    {
                       
                        while(IsAlive(player)) // Here it keep's looping on the first zombie, without the rest of the function running so it doesn't "look" for new zombs untill the first one is dead.. Thread the part that plays the fx so the other function can keep tracking the zombs..
                        {
                            playfxontag(level._effect["zombie_fire"] , player, "j_spine4");
                            playfxontag(level._effect["zombie_fire"] , player, "j_neck");
                           
                            wait(5);
                        }
                    }else
                    {
                        playfxontag(level._effect["zombie_fire"] , player, "j_spine4");
                        playfxontag(level._effect["zombie_fire"] , player, "j_neck");
                    }
                break;
Last Edit: February 07, 2014, 07:32:41 am by BluntStuffy
broken avatar :(
×
broken avatar :(
Location: usgeorgia
Date Registered: 24 April 2013
Last active: 3 years ago
Posts
560
Respect
Forum Rank
Zombie Enslaver
Primary Group
Mapper
My Groups
More
My Contact & Social Links
More
×
whippytrout's Groups
Mapper Has released one or more maps to the UGX-Mods community.
whippytrout's Contact & Social LinksWhippyTroutWhippyTrout
Thank that makes sense. I set up my script to do that and I added in some print lines to see if it works and keeps looping and it does. I just dont know how to make the fx play. Its not showing up and it probably has something to do with the player variable. It gave me errors about it until I added self.player to it now it runs but no fx. here is the first part:
Code Snippet
Plaintext
......
case "fire":
if(isDefined(trigger.script_flag) && trigger.script_flag == "looping")
{

while(IsAlive(player))
{
thread activate_fx();

wait(5);
}
}.......
Then I have the thread:
Code Snippet
Plaintext
activate_fx()
{

if(level.zombie_variant == 1)
{
iPrintLn("Fire zombies activated"); // this plays over and over onscreen when zombies touch trig
playfxontag(level._effect["zombie_fire"] , self.player, "j_spine4");
playfxontag(level._effect["zombie_fire"] , self.player, "j_neck"); 
}
if(level.zombie_variant == 2)
{
iPrintLn("Electric zombies activated");
playfxontag(level._effect["electricity"] , self.player, "j_spine4");
playfxontag(level._effect["electricity"] , self.player, "j_neck");
}

}
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 6 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Scripter Elite
My Groups
More
×
YaPh1l's Groups
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
First, you want to thread the loop too. Also, thread-call the function on the triggering entity:
Code Snippet
Plaintext
case "fire":
        if(isDefined(trigger.script_flag) && trigger.script_flag == "looping")
                    {
                            player thread activate_fx();
                    }
Then, in activate_fx(), put the loop and use self as the reference to the entity:
Code Snippet
Plaintext
activate_fx()
{

if(level.zombie_variant == 1)
{
        iPrintLn("Fire zombies activated"); // this plays over and over onscreen when zombies touch trig
        while(IsAlive(self))
        {
               playfxontag(level._effect["zombie_fire"] , self, "j_spine4");
               playfxontag(level._effect["zombie_fire"] , self, "j_neck");
               wait(5);
        }
}
// same for the other variant(s)
}

- Phil.
Last Edit: February 07, 2014, 10:40:04 pm by YaPh1l

 
Loading ...