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.
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
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
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.
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
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
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.
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.
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.
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
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.
EDIT: Still doesn't seem to work with the weapons gsc though..
Last Edit: February 23, 2016, 02:43:34 pm by Scobalula
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
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.
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.
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] 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)
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