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

Turret Power

HOT
broken avatar :(
Created 10 years ago
by nabaro
0 Members and 1 Guest are viewing this topic.
9,412 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 22 January 2014
Last active: 3 years ago
Posts
143
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
nabaro's Groups
nabaro's Contact & Social Linkschelseafan122099nabarogamerblast11
I made a script to turn on jug by using a turret for 10 seconds (not necessarily consecutive). There are no syntax errors, however, jug turns on within 10 seconds of my spawning in, regardless of whether I am using the turret or not. Here is my script:

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

main()
{
players = get_players();
player = players[0];
activator = 0;
while(activator < 200)
{
firing = player IsFiring();
if(player HasWeapon("30cal_bipod_stand") && (firing == "true"))
{
wait(0.05);
activator = activator + 1;
}
}
level notify("juggernog_on");
}

Thanks in advance! (Also, another thing is that this will only work for player 1 right now (solo). This is just for testing and not a concern as of now).
Last Edit: April 15, 2014, 06:56:50 pm by nabaro
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 4 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
that because
Code Snippet
Plaintext
level notify("juggernog_on");
should be inside the if statement lol
nevermind saw what you did, just add another if statement below the one you have like this
Code Snippet
Plaintext
if(activator == 200)
level notify("juggernog_on");
Last Edit: April 15, 2014, 07:03:43 pm by jjbradman
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 22 January 2014
Last active: 3 years ago
Posts
143
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
nabaro's Groups
nabaro's Contact & Social Linkschelseafan122099nabarogamerblast11
Are you sure about this? I want the variable activator to go up while I am firing, and then have juggernog turn on when activator = 200 (10 seconds), so I put the level notify outside the while loop so that once it breaks (activator is greater than or equal to 200) then juggernog will turn on.
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 4 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
Are you sure about this? I want the variable activator to go up while I am firing, and then have juggernog turn on when activator = 200 (10 seconds), so I put the level notify outside the while loop so that once it breaks (activator is greater than or equal to 200) then juggernog will turn on.
i edited my post above
and i think your while loop would be better like this xD just to be sure
Code Snippet
Plaintext
while(activator < 201)
to break the code inside cause once jugg is on it would be useless to keep running that loop
also when a while loop ends the code inside it stops runing  but it doesnt mean that the code will wait the while loop to stop to continue reading the rest of the code thats why your jugg always was on even if you didnt grabed the turret
Last Edit: April 15, 2014, 07:08:31 pm by jjbradman
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 22 January 2014
Last active: 3 years ago
Posts
143
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
nabaro's Groups
nabaro's Contact & Social Linkschelseafan122099nabarogamerblast11
Okay, will test.
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 8 years ago
Posts
2,790
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
Code Snippet
Plaintext
if(activator == 200)
level notify("juggernog_on");

He said that he wanted the code to init while he was fireing, so...

Code Snippet
Plaintext
if(activator == 200 && player isfiring() )
level notify("juggernog_on");

unless thats not what he meant.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 16 June 2013
Last active: 1 year ago
Posts
1,005
Respect
Forum Rank
Zombie Colossus
Primary Group
Community Mapper
My Groups
More
My Contact & Social Links
More
Signature
Hey if you had tons of fun on playing my maps please DONATE :)

play ESTATE now, and claim your mansion back from the undead!
×
jei9363's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
jei9363's Contact & Social Linksjei9363jei9363jayingardia
Code Snippet
Plaintext
if(player HasWeapon("30cal_bipod_stand") && (firing == "true"))

replace

Code Snippet
Plaintext
(firing == "true")

with

Code Snippet
Plaintext
(player IsFiring() == true)

this error short circuited the if statement to true, causing it to count from the loading up of the map
Last Edit: April 15, 2014, 07:15:22 pm by jei9363
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 22 January 2014
Last active: 3 years ago
Posts
143
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
nabaro's Groups
nabaro's Contact & Social Linkschelseafan122099nabarogamerblast11
To jj:

Unfortunately, it still doesn't work, which means that the problem stems from the variable activator increasing when it is not supposed to. Thanks for your advice, though!

To daedra:

What I meant is that the variable activator will be increasing while firing the turret by waiting 0.05 seconds and then adding one to activator. Once activator is equal to or greater than 200, the while loop will break as its condition is no longer met, and the script will proceed to the next line, which turns on jug.


Post Merge: April 15, 2014, 07:15:02 pm
To jei:

Yeah, I think that's it. I'll test it out now. Thanks!
Last Edit: April 15, 2014, 07:15:02 pm by nabaro
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 16 June 2013
Last active: 1 year ago
Posts
1,005
Respect
Forum Rank
Zombie Colossus
Primary Group
Community Mapper
My Groups
More
My Contact & Social Links
More
×
jei9363's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
jei9363's Contact & Social Linksjei9363jei9363jayingardia
if you have an undefined variable firing, the if statement will always be true
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 4 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
He said that he wanted the code to init while he was fireing, so...

Code Snippet
Plaintext
if(activator == 200 && player isfiring() )
level notify("juggernog_on");

unless thats not what he meant.
daedra you drunk xD that was an additional if statement to make the notify not to check if player was firing
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 22 January 2014
Last active: 3 years ago
Posts
143
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
nabaro's Groups
nabaro's Contact & Social Linkschelseafan122099nabarogamerblast11
jei, I took out the firing variable and replaced the if statement's code with what you posted. Unfortunately, it still doesn't work.
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 4 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
To jj:

Unfortunately, it still doesn't work, which means that the problem stems from the variable activator increasing when it is not supposed to. Thanks for your advice, though!

To daedra:

What I meant is that the variable activator will be increasing while firing the turret by waiting 0.05 seconds and then adding one to activator. Once activator is equal to or greater than 200, the while loop will break as its condition is no longer met, and the script will proceed to the next line, which turns on jug.


Post Merge: April 15, 2014, 07:15:02 pm
To jei:

Yeah, I think that's it. I'll test it out now. Thanks!
lol this seems like a mess to me xD if you cant get it to work just post the edited code to point what is wrong
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 16 June 2013
Last active: 1 year ago
Posts
1,005
Respect
Forum Rank
Zombie Colossus
Primary Group
Community Mapper
My Groups
More
My Contact & Social Links
More
×
jei9363's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
jei9363's Contact & Social Linksjei9363jei9363jayingardia
jei, I took out the firing variable and replaced the if statement's code with what you posted. Unfortunately, it still doesn't work.

how are you calling this script?
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 4 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 this script should be set as the thndergun one in zombiemode.gsc
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 22 January 2014
Last active: 3 years ago
Posts
143
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
nabaro's Groups
nabaro's Contact & Social Linkschelseafan122099nabarogamerblast11
To answer both you guys' questions: this is the most up-to-date version of the code:

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

main()
{
players = get_players();
player = players[0];
activator = 0;
while(activator < 200)
{
if(player HasWeapon("30cal_bipod_stand") && (player IsFiring() == true))
{
wait(0.05);
activator = activator + 1;
}
}
level notify("juggernog_on");
}

and this is how it is being called in my mapname.gsc:

Code Snippet
Plaintext
	 FUNCTION CALLS - PRE _Load
----------------------*/
level thread DLC3_threadCalls();
level thread maps\_pump::main();

 
Loading ...