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

A game breaking issue

broken avatar :(
Created 12 years ago
by Ege115
0 Members and 1 Guest are viewing this topic.
2,297 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
Hey everyone!

I came across to an another bug with my elevaotor in my map. If a player is standing were the doors are about to close, then the player will get stuck in the doors and then the map will come in to a game breaking issue!

So I tried to solve this by trying to put in a trigger multiple between the doors, and then I made a small script to fix it.
And what I tried to do was if a player is touching the trigger multiple which is at the doors, then the trigger that make the elevator to move gets disabled, and then if the player is not touching the trigger then the elevator trigger can be used again.

So I tried to make a script that did so, and this is how I made the script.

Code Snippet
Plaintext
eledoor_stuck_fix()
{
door_fix = getent ("door_fix", "targetname");
egetrigger1 = getent ("egetrigger1", "targetname");
eletrigger1 = getent ("eletrigger1", "targetname");
while(1)
{
players = getplayers();
for(i=0;i<players.size;i++)
{
if(players[i] isTouching(door_fix))
{
egetrigger1 disable_trigger();
eletrigger1 disable_trigger();
}
else
{
egetrigger1 enable_trigger();
eletrigger1 enable_trigger();
}
}
wait(0.1);
}
}

But when I try it ingame, you can still use the elevator even if the player is standing in the trigger multiple. Are there some lines that are missing that I have to add to get it working?

Thanks in advance  :)
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
what you should do is to add a trigger multiple where door closes and     
Code Snippet
Plaintext
  if ( !player isTouching(multiple) )
{
and here you continue the function
}

the "!" means "if not"
so you tell the script that if the player isnt touching the trigger it can close the doors

ps. im still trying to make one elevator of my own but it was bug after bug  :please:
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
I tested it, and I added the line you showed me and I added it so it looks like this.

Code Snippet
Plaintext
eledoor_stuck_fix()
{
door_fix = getent ("door_fix", "targetname");
egetrigger1 = getent ("egetrigger1", "targetname");
eletrigger1 = getent ("eletrigger1", "targetname");
while(1)
{
players = getplayers();
for(i=0;i<players.size;i++)
{
        else if(players[i] isTouching(door_fix))
{
egetrigger1 disable_trigger();
eletrigger1 disable_trigger();
}
  players = get_players();
  for(i=0;i<players.size;i++)
  if ( !player isTouching(door_fix) )
{
egetrigger1 enable_trigger();
eletrigger1 enable_trigger();
}
}
wait(0.1);
}
}

But I got a script compile error that says,

unitilised variable 'player'

And I don't know why it does that because I do already have,

Code Snippet
Plaintext
players = get_players();

Any ideas, anything else I have missed in the script?
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
change 'player' to 'players'.

that might help a little.
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
Okey, thanks deadra, it adding "players innsted of "player" did work, but thanks deadra, it fixed the compile error, but when I test it, it still doen't disable itself. I think it is getting wierd now. Because, if it says in the script that if the player  is not touching the trigger, then it should be disabled but it doesn't.

Any more ideas maybe?

Post Merge: February 03, 2014, 06:04:32 am
Edit: Okey, I don't know what else I can do to fix this, could someone please tell me if I maybe have the lines at the wrong place, or I should add an another line or if the script looks right etc?
This is the version that fixed the script compile error, but it still doesn't do its job ingame.

Code Snippet
Plaintext
eledoor_stuck_fix()
{
door_fix = getent ("door_fix", "targetname");
egetrigger1 = getent ("egetrigger1", "targetname");
eletrigger1 = getent ("eletrigger1", "targetname");
while(1)
{
players = getplayers();
for(i=0;i<players.size;i++)
{
if(players[i] isTouching(door_fix))
{
egetrigger1 disable_trigger();
eletrigger1 disable_trigger();
}
  players = get_players();
  for(i=0;i<players.size;i++)
  if ( !players isTouching(door_fix) )
{
egetrigger1 enable_trigger();
eletrigger1 enable_trigger();
}
}
wait(0.1);
}
}
Last Edit: February 03, 2014, 06:04:32 am by Ege115
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.
Use this code. When you run your map with it and use the elevator, it will print out some stuff when it runs. If you see any red text, it cant find one of your ents. if you see all green text, then it found your ents and your script must have a logic error if it does not do its job. If you see no prints, your code isnt even running.
Code Snippet
Plaintext
eledoor_stuck_fix()
{
door_fix = getent ("door_fix", "targetname");
if(!isDefined(door_fix)) iPrintLn("^1DOOR NOT DEFINED");
else iPrintLn("^2DOOR OK");
egetrigger1 = getent ("egetrigger1", "targetname");
if(!isDefined(egetrigger1)) iPrintLn("^1EGE TRIG 1 NOT DEFINED");
else iPrintLn("^2EGE 1 OK");
eletrigger1 = getent ("eletrigger1", "targetname");
if(!isDefined(eletrigger1)) iPrintLn("^1ELE TRIG 1 NOT DEFINED");
else iPrintLn("^2ELE 1 OK");
while(1)
    {
        players = getplayers();
        for(i=0;i<players.size;i++)
        {
            if(players[i] isTouching(door_fix))
            {
                egetrigger1 disable_trigger();
                eletrigger1 disable_trigger();
            }
              players = get_players();
              for(i=0;i<players.size;i++)
              if ( !players isTouching(door_fix) )
            {
                egetrigger1 enable_trigger();
                eletrigger1 enable_trigger();
            }
        }
        wait(0.1);
    }
}
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
I'll try it out Treminaor, thank you.

I had a different solution but I haven't tested it yet.
But I will test this first, thank you!
I come back when I have tested it because I don't have time right now.

 
Loading ...