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 making models appear after something happens

HOT
broken avatar :(
Created 10 years ago
by Dust
0 Members and 1 Guest are viewing this topic.
5,364 views
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 4 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 LinksMrZ0mbiesFanaticdust103194MrZ0mbiesFanatic
Okay i have spent the past 2 hours trying to fix this stupid script and it is driving me insane. Basically i want some models to appear after players hit the button, the button part is fine but the models has a hand symbol in game here is my script, this is so easy but it is refusing to work.

Code Snippet
Plaintext
#include common_scripts\utility; 
#include maps\_utility;
#include maps\_zombiemode_utility;
init()
{
  precachemodel("bo2_p6_dogtags_friend");
  dogtags = getentarray("dogtags_ee","targetname");
dogtags hide();
  thread button_press();
}

//Function that handles the button pressing
button_press()
{
    button = getent("button","targetname");
button_trig = getent("button_trig","targetname");
button_trig setCursorHint("HINT_NOICON");
button_trig sethintstring("Press &&1 to do something exciting");
button_trig waittill("trigger", player);
button_trig disable_trigger();
button hide();
thread dogtags();
IPrintLnBold("Let the Games Begin");
}

//Function that handles the dog tags appearing
dogtags()
{
    dogtags = getentarray("dogtags","targetname");
dogtags show();
dogtags thread model_spin();

dogtags_trig = getent("dogtags_trig","targetname");
dogtags_trig setCursorHint("HINT_NOICON");
dogtags_trig sethintstring("Press &&1 to collect Dog Tags");
dogtags_trig waittill("trigger", player);
dogtags_trig disable_trigger();
}

//Time to make it spin
model_spin()
{
while(1)
{
self rotateyaw(360,5);
wait(5);
}
}

Here is the pictures in radiant, like i said the button is fine just focus on the dogtags() part



I want to get into scripting but errors like this with no explanation is so annoying
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 5 days ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
Community 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
So, the only problem is that the models are showing the "NOICON" symbol?
Does the models show or what?
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 4 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
×
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 LinksMrZ0mbiesFanaticdust103194MrZ0mbiesFanatic
So, the only problem is that the models are showing the "NOICON" symbol?
Does the models show or what?

Ya the models show up at the beginning of the game with the "noicon" symbol, but the thing is i want it to show up after the players hit the button thats in the map not before, also even when i hit the buttons it still shows that noicon symbol instead of saying "Press F to collect Dog Tags"
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 5 days ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
Community 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
Ya the models show up at the beginning of the game with the "noicon" symbol, but the thing is i want it to show up after the players hit the button thats in the map not before, also even when i hit the buttons it still shows that noicon symbol instead of saying "Press F to collect Dog Tags"
For me it sounds like you are not calling the script in your mapname.gsc
Do you have the script called?
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 4 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
×
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 LinksMrZ0mbiesFanaticdust103194MrZ0mbiesFanatic
For me it sounds like you are not calling the script in your mapname.gsc
Do you have the script called?

Ya i called it in both my mapname and zombiemode, also if i didnt call the script at all wouldnt that mean the button wouldnt work either, but the button works its just the dogtags
broken avatar :(
×
broken avatar :(
Location: be
Date Registered: 17 August 2013
Last active: 3 years ago
Posts
369
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
Web & Software Developer and Designer
Signature
"Deleted code is debugged code." - Jeff Sickel
"Mathematicians stand on each others' shoulders and computer scientists stand on each others' toes." - Richard Hamming
×
JR-Imagine's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
You are calling functions on an array, I'll edit with a fix. ;)

Edit: This should work:
Code Snippet
Plaintext
#include common_scripts\utility; 
#include maps\_utility;
#include maps\_zombiemode_utility;
init()
{
precacheModel("bo2_p6_dogtags_friend");
dogtags = getEntArray("dogtags_ee", "targetname");

for(i=0;i<dogtags.size;i++)
dogtags[i] Hide();

thread button_press();
}

//Function that handles the button pressing
button_press()
{
button = getEnt("button","targetname");
button_trig = getEnt("button_trig","targetname");
button_trig setCursorHint("HINT_NOICON");
button_trig sethintstring("Press &&1 to do something exciting");
button_trig waittill("trigger", player);
button_trig disable_trigger();
button hide();
thread dogtags();
IPrintLnBold("Let the Games Begin");
}

//Function that handles the dog tags appearing
dogtags()
{
dogtags = getEntArray("dogtags","targetname");

for(i=0;i<dogtags.size;i++)
{
dogtags[i] Show();
dogtags[i] thread model_spin();
}

dogtags_trig = getEnt("dogtags_trig","targetname");
dogtags_trig setCursorHint("HINT_NOICON");
dogtags_trig setHintString("Press &&1 to collect Dog Tags");
dogtags_trig waittill("trigger", player);
dogtags_trig disable_trigger();
}

//Time to make it spin
model_spin()
{
while(1)
{
self rotateyaw(360,5);
wait(5);
}
}
Last Edit: May 14, 2014, 07:21:43 pm by JR-Imagine
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 4 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
×
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 LinksMrZ0mbiesFanaticdust103194MrZ0mbiesFanatic
You are calling functions on an array, I'll edit with a fix. ;)

Also tried just using getent and that didnt work either but ill wait for your fix
broken avatar :(
×
broken avatar :(
Location: be
Date Registered: 17 August 2013
Last active: 3 years ago
Posts
369
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
Web & Software Developer and Designer
×
JR-Imagine's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Also tried just using getent and that didnt work either but ill wait for your fix
GetEnt is to get a single entity with a certain targetname, GetEntArray is used to get an array of all entities with a certain targetname. You can't call functions on an array and therefor have to use a for() loop to call it on each entity inside the array. ;)
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 4 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
×
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 LinksMrZ0mbiesFanaticdust103194MrZ0mbiesFanatic
Well that made the models disappear till you hit the button, but then when the models come back its still a hand symbol and theres only 1 model when i put 10 in the map
broken avatar :(
×
broken avatar :(
Location: be
Date Registered: 17 August 2013
Last active: 3 years ago
Posts
369
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
Web & Software Developer and Designer
×
JR-Imagine's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Well that made the models disappear till you hit the button, but then when the models come back its still a hand symbol and theres only 1 model when i put 10 in the map
I just noticed you have different targetnames for the dogtags: (I should seriously read through scripts a lil' better next time. xD)
Code Snippet
Plaintext
dogtags = getEntArray("dogtags_ee", "targetname");
And:
Code Snippet
Plaintext
dogtags = getEntArray("dogtags", "targetname");

I noticed you used GetEnt for the trigger, is there only one trigger to pick up the dogtags or multiple?

Edit: Fixed the models not showing up, realised there was an infinite loop called inside a for() loop:
Code Snippet
Plaintext
#include common_scripts\utility; 
#include maps\_utility;
#include maps\_zombiemode_utility;
init()
{
precacheModel("bo2_p6_dogtags_friend");
dogtags = getEntArray("dogtags_ee", "targetname");

for(i=0;i<dogtags.size;i++)
dogtags[i] Hide();

thread button_press();
}

//Function that handles the button pressing
button_press()
{
button = getEnt("button","targetname");
button_trig = getEnt("button_trig","targetname");
button_trig setCursorHint("HINT_NOICON");
button_trig sethintstring("Press &&1 to do something exciting");
button_trig waittill("trigger", player);
button_trig disable_trigger();
button hide();
IPrintLnBold("Let the Games Begin");
thread dogtags();
thread model_spin();
}

//Function that handles the dog tags appearing
dogtags()
{
dogtags_trig = getEnt("dogtags_trig","targetname");
dogtags_trig setCursorHint("HINT_NOICON");
dogtags_trig setHintString("Press &&1 to collect Dog Tags");
dogtags_trig waittill("trigger", player);
dogtags_trig disable_trigger();
}

//Time to make it spin
model_spin()
{
dogtags = getEntArray("dogtags_ee","targetname");
for(i=0;i<dogtags.size;i++)
dogtags[i] Show();

while(1)
{
for(i=0;i<dogtags.size;i++)
dogtags[i] rotateyaw(360,5);
wait(5);
}
}

Edit: Optimized the above script again. :P
Last Edit: May 14, 2014, 07:39:58 pm by JR-Imagine
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 4 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
×
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 LinksMrZ0mbiesFanaticdust103194MrZ0mbiesFanatic
I just noticed you have different targetnames for the dogtags: (I should seriously read through scripts a lil' better next time. xD)
Code Snippet
Plaintext
dogtags = getEntArray("dogtags_ee", "targetname");
And:
Code Snippet
Plaintext
dogtags = getEntArray("dogtags", "targetname");

I noticed you used GetEnt for the trigger, is there only one trigger to pick up the dogtags or multiple?

Theres only 1 trigger to pick up the dog tags but multiple dog tags, if that makes sense. okay nice 2 down 1 more to go, they all appear now, just need to fix the hand symbol

edit: nevermind, saw your edit trying it now

edit again: still back to only showing 1 dogtags and the hand icon is still there
Last Edit: May 14, 2014, 07:38:42 pm by thezombiekilla6
broken avatar :(
×
broken avatar :(
Location: be
Date Registered: 17 August 2013
Last active: 3 years ago
Posts
369
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
Web & Software Developer and Designer
×
JR-Imagine's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
nevermind, saw your edit trying it now
Optimized it a bit and change the targetnames to be the same, hope it works now. ^
Edit: Should work now, if it doesn't, I'm out of ideas. o_O
Last Edit: May 14, 2014, 07:41:58 pm by JR-Imagine
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 4 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
×
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 LinksMrZ0mbiesFanaticdust103194MrZ0mbiesFanatic
models show up after hitting the button but its still the hand symbol, also to note, the spin thread not working either but may fix that after the hand symbol goes away.

Edit: tried the latest one and still same thing. PHIL if your out there we may need you :P

Post Merge: May 14, 2014, 07:50:03 pm
wait, since theres 10 dogtags and 10 triggers one for each one, shouldnt the dogtags_trig be a getentarray too? i know you asked me that before but i thought you meant multiple for just 1 dog tag not multiple as in all triggers the same
Last Edit: May 14, 2014, 07:50:55 pm by thezombiekilla6
broken avatar :(
×
broken avatar :(
Location: be
Date Registered: 17 August 2013
Last active: 3 years ago
Posts
369
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
Web & Software Developer and Designer
×
JR-Imagine's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
wait, since theres 10 dogtags and 10 triggers one for each one, shouldnt the dogtags_trig be a getentarray too?
Didn't you just say there was only 1 trigger? xD K, I'll edit the script for it.
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 4 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
×
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 LinksMrZ0mbiesFanaticdust103194MrZ0mbiesFanatic
Didn't you just say there was only 1 trigger? xD K, I'll edit the script for it.
i know you asked me that before but i thought you meant multiple for just 1 dog tag not multiple as in all triggers the same

 
Loading ...