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

Lift problem

broken avatar :(
Created 11 years ago
by Linoxet
0 Members and 1 Guest are viewing this topic.
5,229 views
broken avatar :(
×
broken avatar :(
Location: br
Date Registered: 10 December 2013
Last active: 4 years ago
Posts
159
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
Linoxet's Groups
Linoxet's Contact & Social LinksTutizillalinoxetbanguela
Hi, i've tried to add a simple platform that once you press the trigger will go up/down. When i'm in game the lift moves without me pressing anything, and keep going up and down for no reason, and also the trigger still have the hand icon and do not show any text. That's not the first time this happens to me, I don't know what I did wrong  :(

[sorry for bad english]

Here's my code:

Code Snippet
Plaintext
lift()
{
lift = getEnt("lift", "targetname");
trig = getEnt("trigg", "targetname");

trig SetCursorHint( "HINT_NOICON" );
trig UseTriggerRequireLookAt();
trig setHintString("Press ^2[&&1] ^6to move lift");

//false == down, true == up
lift_is = false;

for (;;)
{
trig waittill("trigger");

if (lift_is == false)
{
lift MoveZ (176, 4);
lift_is = true;
wait 5;
}

if (lift_is == true)
{
lift MoveZ (-176, 4);
lift_is = false;
wait 5;
}
}
wait 0.5;
}
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 6 years ago
Posts
6,875
Respect
Forum Rank
Immortal
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Signature
If you want scripts / features made for you, then contact me by PM or email / skype etc
it will cost you tho so if you have no intention of reciprocating don't even waste my time ;)
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social LinksHarryBo000[email protected]HarryBo21
What kind of trigger did you use?

and did you give it tagetname "trigg" or "trig"?
Last Edit: October 18, 2015, 08:38:12 pm by Harry Bo21
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 3 years ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Team Member
My Groups
More
My Contact & Social Links
More
Personal Quote
(ง º ω º )ง u wont sum m8y?
Signature
Do not take life too seriously. You will never get out of it alive.
×
DidUknowiPwn's Groups
UGX Team Member
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.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
What kind of trigger did you use?

and did you give it tagetname "trigg" or "trig"?
If the trigger was undefined it wouldn't work would it now :P?
Anyway the trigger isn't a trigger_use so either add a few validation checks such as UseButtonPressed() and other shit.

So, do use either method for it.
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 6 years ago
Posts
6,875
Respect
Forum Rank
Immortal
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social LinksHarryBo000[email protected]HarryBo21
If the trigger was undefined it wouldn't work would it now :P?
Anyway the trigger isn't a trigger_use so either add a few validation checks such as UseButtonPressed() and other shit.

So, do use either method for it.
When ive done this in the past, it just threads on level, and 'because' that isnt a trigger, just automatically keeps going off - or i assumed that was the reason

or if the trig gets deleted, without ending the thread

and as he also has this :

trig SetCursorHint( "HINT_NOICON" );

yet the hand is showing... ;)


also might wanna change this part ( depending on how you want the lift to work, but im guessing this way )

Code Snippet
Plaintext
if (lift_is == false)
{
lift MoveZ (176, 4);
lift_is = true;
wait 5;
}
else if (lift_is == true) // else if - or could use just "else"
{
lift MoveZ (-176, 4);
lift_is = false;
wait 5;
}
Last Edit: October 18, 2015, 09:12:23 pm by Harry Bo21
Marked as best answer by Linoxet 11 years ago
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods 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
Your trigger is undefined, and passing as true, skipping the wait till trigger. Since you have a hand icon, but it is moving, we know that your script is running, but there is an error. Either with kvp, or with script. I'd recommend deleting that target name of one of them and making it the target of the other anyway. Then you can get one ent, and get it's target for the other, less chance for errors.
Last Edit: October 18, 2015, 09:13:33 pm by MakeCents
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 6 years ago
Posts
6,875
Respect
Forum Rank
Immortal
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social LinksHarryBo000[email protected]HarryBo21
Also you can use a waittill( "move_done" ); rather than the wait 5;

at least i think thats correct, one of the others will correct me if not, but that way itll wait till the lift is done moving, rather than having to work out how long to wait. Would also be helpful if you have several uses for this lift, not neccesarily all moving the same distance or rate
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
Turn developer on. It'll tell you whats wrong.

Edit: which is probably what everyone else said, its undefined.
Last Edit: October 18, 2015, 09:33:52 pm by daedra descent
broken avatar :(
×
broken avatar :(
Location: br
Date Registered: 10 December 2013
Last active: 4 years ago
Posts
159
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
Linoxet's Groups
Linoxet's Contact & Social LinksTutizillalinoxetbanguela
Thanks, I'll try what you guys said and will be back here if needed :D
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 6 years ago
Posts
6,875
Respect
Forum Rank
Immortal
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social LinksHarryBo000[email protected]HarryBo21
Thanks, I'll try what you guys said and will be back here if needed :D
When you find your solution, please come back and mark best answer, so other people with a similar issue know to look here ;)
broken avatar :(
×
broken avatar :(
Location: br
Date Registered: 10 December 2013
Last active: 4 years ago
Posts
159
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
Linoxet's Groups
Linoxet's Contact & Social LinksTutizillalinoxetbanguela
I had 2 triggers with the same targename, one on the first floor and another one on the second floor, maybe that was causing the problem, but anyway, its working, thanks!

[srry for bad english :v]
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 6 years ago
Posts
6,875
Respect
Forum Rank
Immortal
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social LinksHarryBo000[email protected]HarryBo21
I had 2 triggers with the same targename, one on the first floor and another one on the second floor, maybe that was causing the problem, but anyway, its working, thanks!

[srry for bad english :v]
Glad you got it working bud ;)
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 6 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Signature
Donate to me if you enjoy my work. https://www.paypal.me/thezombiekilla6
×
Dust's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Dust's Contact & Social Linksdust103194MrZ0mbiesFanaticMrZ0mbiesFanatic
I had 2 triggers with the same targename, one on the first floor and another one on the second floor, maybe that was causing the problem, but anyway, its working, thanks!

[srry for bad english :v]

Since you had 2 triggers with same targetname, you would have to use getentarray instead of getent. getent is only for 1 trig with a certain targetname, getentarray is for more than one. For something like this I would recommend what makecents said.
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 3 years ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Team Member
My Groups
More
My Contact & Social Links
More
Personal Quote
(ง º ω º )ง u wont sum m8y?
×
DidUknowiPwn's Groups
UGX Team Member
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.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Two triggers with the same name would throw a script error.
broken avatar :(
×
broken avatar :(
Location: br
Date Registered: 10 December 2013
Last active: 4 years ago
Posts
159
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
Linoxet's Groups
Linoxet's Contact & Social LinksTutizillalinoxetbanguela
Since you had 2 triggers with same targetname, you would have to use getentarray instead of getent. getent is only for 1 trig with a certain targetname, getentarray is for more than one. For something like this I would recommend what makecents said.

Yeah, I used getEntArray and edited the code, now it's working perfecly, thanks for the help guys, i'm new to scripting :D

Code Snippet
Plaintext
lift()
{
trig = getEntArray("trigger", "targetname");

for (i=0;i<trig.size;i++)
{
trig[i] thread trigs_think();
}

//false == down, true == up
level.lift_is = false;
level.lift_moving = false;
}

trigs_think()
{
lift = getEnt("lift", "targetname");

self SetCursorHint( "HINT_NOICON" );
self UseTriggerRequireLookAt();
self setHintString("Press ^3[&&1] ^7to move lift");

for (;;)
{
self waittill("trigger");

if (level.lift_is == false && level.lift_moving == false)
{
level.lift_moving = true;
lift MoveZ (128, 4);
level.lift_is = true;
wait 5;
level.lift_moving = false;
}

else if (level.lift_is == true && level.lift_moving == false)
{
level.lift_moving = true;
lift MoveZ (-128, 4);
level.lift_is = false;
wait 5;
level.lift_moving = false;
}
wait 0.5;
}
}

 
Loading ...