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

Black Ops 2 Style Weapon Icon

HOT
broken avatar :(
Created 9 years ago
by Scobalula
0 Members and 1 Guest are viewing this topic.
11,837 views
broken avatar :(
×
broken avatar :(
OnionmanVere Bo21
Location: ieu dnt wnt 2 no
Date Registered: 27 September 2013
Last active: 3 days ago
Posts
1,864
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Mapper
My Groups
More
Personal Quote
ok
Signature
Aye mate you don't know me so y don't you shut tf up ok buddy :)

×
Scobalula's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Box Mappers Elite
Box Mappers Elite
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.
Scobalula's Contact & Social Links
I've been trying this for ages last night and still can't seem to get it (I am new to programming/scripting/coding, etc. in general tho.), in short I am looking to replicate this:




(no, not the actual M14 icon some in chat thought I was on about, I can get that with iPak exporter by Tom)

I could just make a trigger in Radiant and work with that but this is way too inefficient and I fear I'll run into getting closer to g_spawn if I start doubling how many ents are used for weapon buys.

I have tried several things, including getting the script_noteworthy of the gun, the weapon name, etc. in _zombiemode_weapons.

My idea is to have it get the script_noteworthy of the weapon or the weapon name defined in add_zombie_weapon() and then based off that have a material witht he same name to display, either through GSC or Menu with DVARs, so for example it would get script_noteworthy of let's say m1911 and then a material would be set up called m1911 and it would set that.

I'm new to scripting like I said so do excuse my ignorance, this could be something so easy and I'm making doggies dinner out of it, I understand for scripters it's probably easier to just give me a direct script and leave it at that but if possible I would appreciate if you do answer this to explain how it's done, etc. all in effort to improve my scripting skills so I don't have to come back that often. :D

Thanks in advance. :)
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 5 years ago
Posts
6,877
Respect
Forum Rank
Immortal
Primary Group
Community 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.
Community 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
this feature was also in BO2

something i wanted to, but i suspect its already set up,, i just dont know how to use it lol ( weapons on the floor display the hud icon )

you could either store weapons in a array, and use that to work out what image to show, or write a big case function

Code Snippet
Plaintext
switch( gun )
{
    case "zombie_colt":
        return "colt_hud_image";
}
Marked as best answer by Scobalula 9 years ago
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
I've been meaning to get around to this but I have been too busy troubleshooting ORBiT. I think it can be done in menu using an existing dvar, like the flamethrower uses. I've added icons to hints for perks, several of them, and started to try my one hud that requires the gun image, and it seemed to work but I didn't have images so it was the default texture for most, then I got distracted. I would look in the weaponinfo menuDef in the hud.menu for something commented out that relates to the weapon icon or something if I remember correctly. Then use that dvar. It might be set when your holding the weapon?


If I'm wrong about that, then it simply becomes a matter of you setting your own dvar, based on the weapon file name. You could simply make your material match the weapon file name with _icon or something on the end. Use gsc to get the current wall weapon with _icon at end and set the client dvar to that, for the itemdef you added to menu. Of course you would need to be using  menu hinstring method for your wall weapons for this to work easily.
Last Edit: February 23, 2016, 01:33:45 pm by MakeCents
broken avatar :(
×
broken avatar :(
OnionmanVere Bo21
Location: ieu dnt wnt 2 no
Date Registered: 27 September 2013
Last active: 3 days ago
Posts
1,864
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Mapper
My Groups
More
Personal Quote
ok
×
Scobalula's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Box Mappers Elite
Box Mappers Elite
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.
Scobalula's Contact & Social Links
I've been meaning to get around to this but I have been too busy troubleshooting ORBiT. I think it can be done in menu using an existing dvar, like the flamethrower uses. I've added icons to hints for perks, several of them, and started to try my one hud that requires the gun image, and it seemed to work but I didn't have images so it was the default texture for most, then I got distracted. I would look in the weaponinfo menuDef in the hud.menu for something commented out that relates to the weapon icon or something if I remember correctly. Then use that dvar. It might be set when your holding the weapon?


If I'm wrong about that, then it simply becomes a matter of you setting your own dvar, based on the weapon file name. You could simply make your material match the weapon file name with _icon or something on the end. Use gsc to get the current wall weapon with _icon at end and set the client dvar to that, for the itemdef you added to menu. Of course you would need to be using  menu hinstring method for your wall weapons for this to work easily.

I was able to get it to work with some help with Hitman fixing up my sloppy scripting, lol, I got the the weapon wall buys with getentarray, then checked if the player is, looking at the gun and if their distance is not too far away. Then I just got what the script_noteworthy of the trigger their looking at and currently all I've done is print this on screen but I understand enough of menu editing to get it to work in menu with dvars. :D



Code Snippet
Plaintext
weapons_icons()
{
weapon_buys = getentarray("weapon_upgrade","targetname");
iprintln("function_started2");

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

}

weapon_icons_check()
{
players = Get_Players();
iprintln("function_started_22");
for(i = 0; i < players.size; i++)
{
while(1)
{
if(players[i] islookingatent(self) && (distance(players[i].origin, self.origin) < 80))
{
weapon = self.script_noteworthy;


players[i] iPrintLn("Looking at Trigger");
players[i] iPrintLn( weapon );

wait 0.05;
}
else
wait 0.05;
}
}
}

(*for anyone watching this thread wanting to use this script make sure to have trem's hintstring fix gsc included as it has a function that I used above (islookingatent)*)

Only issue I have is that if you're at the other side of the wall, if close enough it is possible to trigger this and display the print, but I can place my weapons and props in map accordingly to get around this, and also if you view at a certain angle it will trigger it also but not the hintstring, last one still need to work on.
Last Edit: February 23, 2016, 01:46:51 pm by Scobalula
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

Only issue I have is that if you're at the other side of the wall,

You can use bullettracepassed to get around the seeing from the other side of a wall thing.


Edit: I thought you wanted to set the hud icon to the weapon. If that is what you wanted, then you can just add to trems menu stuff instead of doing all this. And either way, really, you can just edit trems hintstring thing to get the weapon info too. You don't need another looping script.
Last Edit: February 23, 2016, 01:55:46 pm by MakeCents
broken avatar :(
×
broken avatar :(
OnionmanVere Bo21
Location: ieu dnt wnt 2 no
Date Registered: 27 September 2013
Last active: 3 days ago
Posts
1,864
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Mapper
My Groups
More
Personal Quote
ok
×
Scobalula's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Box Mappers Elite
Box Mappers Elite
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.
Scobalula's Contact & Social Links
You can use bullettracepassed to get around the seeing from the other side of a wall thing.


Edit: I thought you wanted to set the hud icon to the weapon. If that is what you wanted, then you can just add to trems menu stuff instead of doing all this. And either way, really, you can just edit trems hintstring thing to get the weapon info too. You don't need another looping script.

I tried using trem's hintstring fix but for some reason when I used it with the weapons gsc it doesn't show anything at the weapon.  I changed all instances of SetHintString in it to _SetHintString and made sure that localized hintstrings weren't being used.
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
I tried using trem's hintstring fix but for some reason when I used it with the weapons gsc it doesn't show anything at the weapon.  I changed all instances of SetHintString in it to _SetHintString and made sure that localized hintstrings weren't being used.

Not sure about that, I use my own, but I would figure it can be used on any trigger_use. Does he have you include a new gsc and did you include it? Is it possible that it is an error on your part, or it just doesn't work. Cause if it was working you could add a few lines to it to set the material to a client dvar, add an itemdef to menu, adjust positioning, and wala, done.
broken avatar :(
×
broken avatar :(
OnionmanVere Bo21
Location: ieu dnt wnt 2 no
Date Registered: 27 September 2013
Last active: 3 days ago
Posts
1,864
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Mapper
My Groups
More
Personal Quote
ok
×
Scobalula's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Box Mappers Elite
Box Mappers Elite
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.
Scobalula's Contact & Social Links
Not sure about that, I use my own, but I would figure it can be used on any trigger_use. Does he have you include a new gsc and did you include it? Is it possible that it is an error on your part, or it just doesn't work. Cause if it was working you could add a few lines to it to set the material to a client dvar, add an itemdef to menu, adjust positioning, and wala, done.

Tried with a test trigger_use, only shows the hint icon. Menu file and GSC are included in mod and at top of script.



Code Snippet
Plaintext
hint_test()
{

trigger = getent("test_trigger", "targetname");
trigger _setHintString("Test String");

}
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
Tried with a test trigger_use, only shows the hint icon. Menu file and GSC are included in mod and at top of script.

(Image removed from quote.)

Code Snippet
Plaintext
hint_test()
{

trigger = getent("test_trigger", "targetname");
trigger _setHintString("Test String");

}

That just shows that nothing is happening with that trigger at all. I assume your only using one trigger with that kvp, so getent isn't the issue. Have you gotten it to work on anything else? I'll have to go find his stuff on the wiki and see. I'm pretty sure that he made it to work with any trigger_use though.

Edit: I just looked at his stuff, and it should work. If you got others to work, then its not menu, but if not, then maybe it is
Last Edit: February 23, 2016, 02:43:25 pm by MakeCents
broken avatar :(
×
broken avatar :(
OnionmanVere Bo21
Location: ieu dnt wnt 2 no
Date Registered: 27 September 2013
Last active: 3 days ago
Posts
1,864
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Mapper
My Groups
More
Personal Quote
ok
×
Scobalula's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Box Mappers Elite
Box Mappers Elite
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.
Scobalula's Contact & Social Links
That just shows that nothing is happening with that trigger at all. I assume your only using one trigger with that kvp, so getent isn't the issue. Have you gotten it to work on anything else? I'll have to go find his stuff on the wiki and see. I'm pretty sure that he made it to work with any trigger_use though.

Oh I love this game, I rebuild mod and it works. :please:

EDIT: Still doesn't seem to work with the weapons gsc though..
Last Edit: February 23, 2016, 02:43:34 pm by Scobalula
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
Oh I love this game, I rebuild mod and it works. :please:

EDIT: Still doesn't seem to work with the weapons gsc though..

His tut specifically recommends it with the weapons gsc, so unless you have other modifications that would some how override this, I don't know, or maybe its positioning of the prefab?

You get that working, then it's pretty easy to add the icons from there.

Edit: But when I get home I will also check that first idea I said again and see if that is the easiest way.

Edit: The build twice issue is usually related to menu files. If you put your menu files in your mod folder. If you put them in raw folder then you don't have that issue.
Last Edit: February 23, 2016, 03:02:58 pm by MakeCents
broken avatar :(
×
broken avatar :(
OnionmanVere Bo21
Location: ieu dnt wnt 2 no
Date Registered: 27 September 2013
Last active: 3 days ago
Posts
1,864
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Mapper
My Groups
More
Personal Quote
ok
×
Scobalula's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Box Mappers Elite
Box Mappers Elite
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.
Scobalula's Contact & Social Links
His tut specifically recommends it with the weapons gsc, so unless you have other modifications that would some how override this, I don't know, or maybe its positioning of the prefab?

You get that working, then it's pretty easy to add the icons from there.

Edit: But when I get home I will also check that first idea I said again and see if that is the easiest way.

Edit: The build twice issue is usually related to menu files. If you put your menu files in your mod folder. If you put them in raw folder then you don't have that issue.

Just an update: I decided to place 2 other triggers, separate targetnames and hintstrings and added a print to trem's gsc to check what hintstrings are added, those 3 triggers got added and their string was printed, but I got nothing for weapons trigger, so I'm guessing the hintstring isn't being passed to trem's gsc.
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
Just an update: I decided to place 2 other triggers, separate targetnames and hintstrings and added a print to trem's gsc to check what hintstrings are added, those 3 triggers got added and their string was printed, but I got nothing for weapons trigger, so I'm guessing the hintstring isn't being passed to trem's gsc.

Show me what you added to weapons gsc, and where you put the iprintln in trems stuff.
broken avatar :(
×
broken avatar :(
OnionmanVere Bo21
Location: ieu dnt wnt 2 no
Date Registered: 27 September 2013
Last active: 3 days ago
Posts
1,864
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Mapper
My Groups
More
Personal Quote
ok
×
Scobalula's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Box Mappers Elite
Box Mappers Elite
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.
Scobalula's Contact & Social Links
Show me what you added to weapons gsc, and where you put the iprintln in trems stuff.

For weapons gsc I done as was said on the Wiki and replaced every entry (8 of them) of SetHintString with _SetHintString, so I would assume this is where hintstring is set for weapons:

Code Snippet
Plaintext
// For buying weapon upgrades in the environment
init_weapon_upgrade()
{
weapon_spawns = [];
weapon_spawns = GetEntArray( "weapon_upgrade", "targetname" );

for( i = 0; i < weapon_spawns.size; i++ )
{
hint_string = get_weapon_hint( weapon_spawns[i].zombie_weapon_upgrade );

weapon_spawns[i] _sethintstring( hint_string );
weapon_spawns[i] setCursorHint( "HINT_NOICON" );
weapon_spawns[i] UseTriggerRequireLookAt();

weapon_spawns[i] thread weapon_spawn_think();
model = getent( weapon_spawns[i].target, "targetname" );
model hide();
}
}

As for the iprintln in trem's gsc here:

Code Snippet
Plaintext
//|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
//|||| Name : trem_hintstrings.gsc
//|||| Info : Fixes hintstrings that don't update.
//|||| Site : [url=http://www.ugx-mods.com]www.ugx-mods.com[/url]
//|||| Author : [UGX] treminaor
//|||| Notes : v1.4
//|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

#include maps\_utility;

_setHintString(string) //#bestengine2014
{
self thread setHintString_fixed_thread(string); //so that i don't have to write "thread" before all of my trig calls.
iprintln(string); // <------------------ HERE
}

Here is my _zombiemode_weapons.gsc: (stock essentially with only edit being hintstring and edits to strings for weapons)

http://pastebin.com/LJXQZudW
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
What is this hint_string at this point? If it is one of those &"Press...." things this method doesn't work.

Code Snippet
Plaintext
weapon_spawns[i] _sethintstring( hint_string ); 


If you add hint_string = "testing this"; above, does it show the hintstring testing this? I'm assuming it is one of those &"hint strings" is why I suggested trying this.

Edit: I looked at the script and those _sethinstring(&"hints") won't work either. It won't parse those for some reason.
Last Edit: February 23, 2016, 05:01:41 pm by MakeCents

 
Loading ...