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 tornado script

broken avatar :(
Created 12 years ago
by javipotter
0 Members and 1 Guest are viewing this topic.
5,151 views
broken avatar :(
×
broken avatar :(
Location: escastellon
Date Registered: 14 February 2013
Last active: 6 years ago
Posts
106
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
javipotter's Groups
javipotter's Contact & Social LinksJAVI-POTTERZombieModdingJavipotterjavi potter
Hi, could anyone add what it needs to add to make the tornado kill you when you touch it?
Here is the script
Code Snippet
Plaintext
// Coded by YaPh1l
// Date: 09. October 2013

#include maps\_utility;
#include common_scripts\utility;
#include maps\_zombiemode_utility;

// Call after _zombiemode::main()
init()
{
    level._effect["tornado"] = LoadFx("tornado_fx");
    level.fx_move_speed = 10; // units per second
    level thread fx_move_think();
}

fx_move_think()
{
    locations = GetStructArray("tornado_location", "targetname");
    iPrintLn("Tornado locations found: " + locations.size);
   
    last_location = Random(locations);
    fx = Spawn("script_model", last_location.origin);
    fx SetModel("tag_origin");
    PlayFxOnTag(level._effect["tornado"], fx, "tag_origin");
   
    while(true)
    {
        while(true)
        {
            locations = array_randomize(locations);
            if(locations[0] != last_location) break;
        }
       
        for(i = 0; i < locations.size; i++)
        {
            iPrintLn("Moving to: (" + locations.origin[0] + "|" + locations.origin[1] + "|" + locations.origin[2] + ")");
            dist = Distance(locations.origin, fx.origin);
            time = (dist / level.fx_move_speed);
            fx MoveTo(locations.origin, time);
            wait(time);
        }
       
        last_location = locations[locations.size - 1];
    }
}
thats the script so if anyone can add something to make the tornado kill you when you touch it, it will be perfect
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 7 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
Code Snippet
Plaintext
// Coded by YaPh1l
// Date: 09. October 2013

#include maps\_utility;
#include common_scripts\utility;
#include maps\_zombiemode_utility;

// Call after _zombiemode::main()
init()
{
    level._effect["tornado"] = LoadFx("tornado_fx");
    level.fx_move_speed = 10; // units per second
    players = get_players();
locations = GetStructArray("tornado_location", "targetname");
    for(i=0; i<players.size; i++)
if ( players[i] IsTouching( locations ) )
{
    players[i] suicide();
//RadiusDamage( level.player.origin, 500, 300, 250, attacker );
}
level thread fx_move_think();
}

fx_move_think(locations)
{
    locations = GetStructArray("tornado_location", "targetname");
    iPrintLn("Tornado locations found: " + locations.size);
   
    last_location = Random(locations);
    fx = Spawn("script_model", last_location.origin);
    fx SetModel("tag_origin");
    PlayFxOnTag(level._effect["tornado"], fx, "tag_origin");
   
    while(true)
    {
        while(true)
        {
            locations = array_randomize(locations);
            if(locations[0] != last_location) break;
        }
       
        for(i = 0; i < locations.size; i++)
        {
            iPrintLn("Moving to: (" + locations.origin[0] + "|" + locations.origin[1] + "|" + locations.origin[2] + ")");
            dist = Distance(locations.origin, fx.origin);
            time = (dist / level.fx_move_speed);
            fx MoveTo(locations.origin, time);
            wait(time);
        }
       
        last_location = locations[locations.size - 1];
    }
this might work , maybe not and maybe the game will restart if the player dies i cant be sure because i cant test it
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.
Spoiler: click to open...
Code Snippet
Plaintext
// Coded by YaPh1l
// Date: 09. October 2013

#include maps\_utility;
#include common_scripts\utility;
#include maps\_zombiemode_utility;

// Call after _zombiemode::main()
init()
{
    level._effect["tornado"] = LoadFx("tornado_fx");
    level.fx_move_speed = 10; // units per second
    players = get_players();
locations = GetStructArray("tornado_location", "targetname");
    for(i=0; i<players.size; i++)
if ( players[i] IsTouching( locations ) )
{
    players[i] suicide();
//RadiusDamage( level.player.origin, 500, 300, 250, attacker );
}
level thread fx_move_think();
}

fx_move_think(locations)
{
    locations = GetStructArray("tornado_location", "targetname");
    iPrintLn("Tornado locations found: " + locations.size);
   
    last_location = Random(locations);
    fx = Spawn("script_model", last_location.origin);
    fx SetModel("tag_origin");
    PlayFxOnTag(level._effect["tornado"], fx, "tag_origin");
   
    while(true)
    {
        while(true)
        {
            locations = array_randomize(locations);
            if(locations[0] != last_location) break;
        }
       
        for(i = 0; i < locations.size; i++)
        {
            iPrintLn("Moving to: (" + locations.origin[0] + "|" + locations.origin[1] + "|" + locations.origin[2] + ")");
            dist = Distance(locations.origin, fx.origin);
            time = (dist / level.fx_move_speed);
            fx MoveTo(locations.origin, time);
            wait(time);
        }
       
        last_location = locations[locations.size - 1];
    }
this might work , maybe not and maybe the game will restart if the player dies i cant be sure because i cant test it
I have never used the function suicide(), if you are sure it works then ok. As for your method of checking the player's interception with the structs, it is not a very good way to perform this task. The tornado FX will be huge, you would have to get to the very center of it for anything to happen. A better solution would be to check the player's squared distance to the struct, that way you can change the value of how far the player needs to be. Ensuring the player is actually hurt when he touches the FX, not just the struct. You are also only checking for it within the init() function which means it will only be called once for each time the init() function is called(which is once). Seeing as within one of the loops there is a wait for the FX's moving time the script would likely have to go through further changing to have a constant player check.
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 7 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
da fuk .____________________.
ok i have to accept im just a begginer xD
long live saje one (/._.)/
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
As for your method of checking the player's interception with the structs, it is not a very good way to perform this task.
I think it even is impossible. What I mean is, I think IsTouching() does not accept script_structs, as they do not have any physical size in the map.
Also, I am not sure, but I think Suicide() will cause an immediate map restart in Coop.

- Phil.
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 7 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
I think it even is impossible. What I mean is, I think IsTouching() does not accept script_structs, as they do not have any physical size in the map.
Also, I am not sure, but I think Suicide() will cause an immediate map restart in Coop.

- Phil.

but he can try by attaching a damage brush to the location struct, cant he? .-.
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 3 years ago
Posts
5,544
Respect
6,646Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
Signature
If Java had true garbage collection, most programs would delete themselves upon execution.
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
I'll admit I've only read the most recent replies, but what you need to do is spawn a trigger_radius from script and use that to detect when players should get hurt. Then you handle the damage with doDamage().

broken avatar :(
×
broken avatar :(
Location: escastellon
Date Registered: 14 February 2013
Last active: 6 years ago
Posts
106
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
javipotter's Groups
javipotter's Contact & Social LinksJAVI-POTTERZombieModdingJavipotterjavi potter
so, do i try the first thing jj told? hahaha thanks everyone for helping me :P
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
Then you handle the damage with doDamage().
Unless the damage is deadly, in which case you want to use RadiusDamage() with a very small radius (10) at the player's origin, because deadly amounts of damage inflicted via DoDamage() cause a map restart in Coop.

- Phil.
Last Edit: January 29, 2014, 07:53:52 pm by YaPh1l
broken avatar :(
×
broken avatar :(
Location: escastellon
Date Registered: 14 February 2013
Last active: 6 years ago
Posts
106
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
javipotter's Groups
javipotter's Contact & Social LinksJAVI-POTTERZombieModdingJavipotterjavi potter
I want the player die while touching it, at the moment, and if possible not to restart game cause on coop for example he is dead but u can revive him.
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 7 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
Unless the damage is deadly, in which case you want to use RadiusDamage() with a very small radius (10) at the player's origin, because deadly amounts of damage inflicted via DoDamage() cause a map restart in Coop.

- Phil.

why with such an small radious phil? o.O

just make a trigger_multiple covering where you want players to get killed
edit: nevermind i quit  :fuuu: here i commented out some lines that might be usefull if you want to continue with this

Code Snippet
Plaintext
// Coded by YaPh1l
// Date: 09. October 2013

#include maps\_utility;
#include common_scripts\utility;
#include maps\_zombiemode_utility;

// Call after _zombiemode::main()
init()
{
    level._effect["tornado"] = LoadFx("tornado_fx");
    level.fx_move_speed = 10; // units per second
    level thread fx_move_think();
}

fx_move_think()
{
    damage_radious = 10
player = undefined
//-------------------------------

//    locations = GetStructArray("tornado_location", "targetname");
//    trig = GetEnt("damage_trig", "targetname");
// trig EnableLinkTo();
// locations SetModel( "tag_origin" );
// trig LinkTo( locations, "tag_origin" );
// trig EntityRadiusDamage( level.player.origin, damage_radious, 300, 250, attacker );
//  RadiusDamage( level.player.origin, damage_radious, 400, 250, attacker );
   
//------------------------------

iPrintLn("Tornado locations found: " + locations.size);
   
    last_location = Random(locations);
    fx = Spawn("script_model", last_location.origin);
    fx SetModel("tag_origin");
    PlayFxOnTag(level._effect["tornado"], fx, "tag_origin");
   
    while(true)
    {
        while(true)
        {
            locations = array_randomize(locations);
            if(locations[0] != last_location) break;
        }
       
        for(i = 0; i < locations.size; i++)
        {
            iPrintLn("Moving to: (" + locations.origin[0] + "|" + locations.origin[1] + "|" + locations.origin[2] + ")");
            dist = Distance(locations.origin, fx.origin);
            time = (dist / level.fx_move_speed);
            fx MoveTo(locations.origin, time);
            wait(time);
        }
       
        last_location = locations[locations.size - 1];
    }
}
Last Edit: January 29, 2014, 08:25:51 pm by jjbradman
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 3 years ago
Posts
5,544
Respect
6,646Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
why with such an small radious phil? o.O
Because you don't want the radius to affect anything except the player the damage is intended for.
broken avatar :(
×
broken avatar :(
Location: escastellon
Date Registered: 14 February 2013
Last active: 6 years ago
Posts
106
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
javipotter's Groups
javipotter's Contact & Social LinksJAVI-POTTERZombieModdingJavipotterjavi potter
jj with ur first script when u respawn u are dead in the same instant xDDD
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 7 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
jj with ur first script when u respawn u are dead in the same instant xDDD

thats just a taste of my amazing scripting skills xDDDD
broken avatar :(
×
broken avatar :(
Location: escastellon
Date Registered: 14 February 2013
Last active: 6 years ago
Posts
106
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
javipotter's Groups
javipotter's Contact & Social LinksJAVI-POTTERZombieModdingJavipotterjavi potter
and in the second one bad syntax xDDDD player = function thats the error ahaha
EDIT: Sorry i think it has been my fault, im compiling again
RE EDIT: Sorry again I wasnt wrong i got that error ^
Last Edit: January 29, 2014, 09:00:56 pm by javipotter

 
Loading ...