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

Break barrier ugx_requiem style?

broken avatar :(
Created 9 years ago
by Linoxet
0 Members and 1 Guest are viewing this topic.
2,325 views
broken avatar :(
×
broken avatar :(
Location: br
Date Registered: 10 December 2013
Last active: 3 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 played UGX Requiem and I am trying to add wood barriers only breakable with my custom axe, similar to requiem map. I've made a script but it works with a problem.

Code Snippet
Plaintext
axe_break()
{
triggers = GetEntArray("trigger_break_axe", "targetname");

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

wait_for_break()
{
blocker = GetEnt(self.target, "targetname");

while(1)
{
self waittill("trigger", player);

weapon = player getCurrentWeapon();

if (weapon == "axe")
{
player play_sound_on_entity( "wood_break" );
blocker delete();
flag_set(self.script_noteworthy);
self delete();
}
wait 0.3;
}
}

The script actually works, in radiant I have a trigger_damage for each wooden barrier. But when I hit the trigger with  the weapon ("axe") the game freezes for 1 or 2 seconds, and after a delay the blocker is deleted.

What is causing the game to freeze? And why is there a delay for the blocker to be deleted when there is no delay on the script :v

Thanks in advance, sorry for english :p
Marked as best answer by Linoxet 9 years ago
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 1 year ago
Posts
1,186
Respect
1,369Add +1
Forum Rank
Zombie Colossus
Primary Group
Community 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.
Community 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
Break the loop when the part is deleted, 'self' doesn't exist anymore then so that's prob causing the runtime-error:

Code Snippet
Plaintext
wait_for_break()
{
blocker = GetEnt(self.target, "targetname");

while(1)
{
self waittill("trigger", player);

weapon = player getCurrentWeapon();

if (weapon == "axe")
{
player play_sound_on_entity( "wood_break" );
blocker delete();
flag_set(self.script_noteworthy);
self delete();
                        break;                                                    // ADD THIS
}
wait 0.3;
}
}
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 5 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
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
It's either that ^ or you have multiple targets, or accidentally use the same kvp, and you need to get an array of them... and delete each one. If this is the case, it is better to use w to make an auto trigger, if you are not already.
broken avatar :(
×
broken avatar :(
Location: br
Date Registered: 10 December 2013
Last active: 3 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
It's either that ^ or you have multiple targets, or accidentally use the same kvp, and you need to get an array of them... and delete each one. If this is the case, it is better to use w to make an auto trigger, if you are not already.

I used auto trigger, I don't have multiple targets :P
I solved the problem, not every trigger had a script_noteworthy set, so I removed this "flag_set(self.script_noteworthy);" and added this,
Code Snippet
Plaintext
if (IsDefined(self.script_noteworthy))
{
        flag_set(self.script_noteworthy);
}

but the without the "break;" it would still be freezing, thanks for the quick reply guys! :D
Last Edit: February 08, 2016, 07:29:38 pm by Linoxet
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 9 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
 Personally I'd give a general target name to all of the barrier groups and then have a script noteworthy to get the individual group parts. Then use array thread and wait till each parts are damaged and remove the part from the array.

Edit

Nvm then...
Last Edit: February 08, 2016, 07:33:52 pm by daedra descent
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 5 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
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
lol, I was wondering if it was a zone issue, but didn't see script_flag, where you're using script_noteworthy, and totally skipped over the flag_set.

And also, I don't think theirs was individual like that... I think it was linear with just one trigger with an array of targets. Just every time the axe hit it, another one would break... or so I thought.
Last Edit: February 08, 2016, 07:37:54 pm by MakeCents

 
Loading ...