maybe helps:
http://forums.bots-united.com/showpost.php?p=57730&postcount=12
Add ammo and Health
Thanks for your help guys, but it’s not working. Here’s my script, I copied it out of ailmanki’s Post (changed the origins, of course)
//inside of the spawn-block
create
{
classname “misc_mg42”
targetname “main_gate_mg42”
accuracy “25”
harc “45”
origin “3576 1352 32”
angle “0”
spawnflags 2 //tripod=0? or NOTRIPOD=2
scriptname “main_gate_mg42”
}
create { classname "func_timer" random "20" wait "90" origin "3576 1352 32" spawnflags "1" targetname "tomtest" target "main_gate_mg42_2" } create { classname "target_script_trigger" origin "0 0 400" targetname "main_gate_mg42_2" scriptname "main_gate_mg42" target "main_gate_mg42" }
//at the very end of the script
main_gate_mg42
{
spawn { print "main_gate_mga42 spawn" }
trigger main_gate_mg42 { repairmg42 main_gate_mg42 }
death { print "main_gate_mg42 death" }}
The Usable- and the Repairable-Hint show up, but the MG is accesible only on one certain spot, when I run around it, the hint is there, but when i hit F, nothing happens. I think its the “0 0 400”-origin, but I dont know what to change.
As a little help for myself, I took this script out of the map-bsp, maybe it helps you a bit. I hope you can help me, I dont really know how this works and do not understand, why I need five triggers for only one damn HNAC.
{
“scriptname” “mg2_mat”
“targetname” “mg2_mat”
“skin” “models/mapobjects/cmarker/axis_crates.skin”
“angle” “270”
“model” “models/mapobjects/cmarker/cmarker_crates.md3”
“origin” “4184 608 -8”
“classname” “misc_gamemodel”
}
{
“classname” “misc_gamemodel”
“origin” “4160 620 40”
“model” “models/mapobjects/cmarker/cmarker_flag.md3”
“angle” “270”
“skin” “models/mapobjects/cmarker/axis_cflag.skin”
“targetname” “mg2_mat”
“scriptname” “mg2_mat”
“spawnflags” “2”
“frames” “190”
“modelscale” “0.4”
}
{
“model” “*27”
“origin” “4210 639 14”
“classname” “script_mover”
“targetname” “mg2_mat”
“scriptname” “mg2_mat”
“spawnflags” “2”
}
{
“model” “*28”
“origin” “4208 664 20”
“classname” “trigger_objective_info”
“targetname” “mg2_toi”
“scriptname” “mg2_toi”
“target” “mg2”
“shortname” “MG2”
“track” “MG2”
“spawnflags” “2”
}
{
“classname” “misc_mg42”
“origin” “4184 520 16”
“angle” “270”
“health” “50”
“targetname” “mg2_gun”
“scriptname” “mg2_gun”
“track” “mg2_track”
“accuracy” “0.4”
“harc” “80”
“varc” “20”
}
{
“model” “*29”
“origin” “4224 558 16”
“classname” “func_constructible”
“spawnflags” “4”
“track” “mg2_track”
“targetname” “mg2”
“scriptname” “mg2”
}
[QUOTE=ailmanki;201313]maybe helps:
http://forums.bots-united.com/showpost.php?p=57730&postcount=12[/QUOTE]
That link was in a discussion for making a self-repairing mg42 (the func_timer triggers the target_script_trigger to trigger the repairmg42 testgun. It is not necessary to give the misc_mg42 a scriptname as the repairmg42 testgun can be performed in any other script block trigger. As it says I found no events requiring a scriptname for the misc_mg42.
More info on the misc_mg42 keys are here. And don’t origin it too close to the ground.
I think its the “0 0 400”-origin,
That won’t affect mounting the mg42. The origin of a target_script_trigger doesn’t affect anything AFAIK except where the entity would be in a map editor if it was in a map file rather than a script file. How low to the ground is your MG42 or are there nearby constrictions?
[QUOTE=Phishermans Phriend;201292]Ok, and after we all know how to include HNACS now, can you help me with including MG42s?
I included one, but when I load the map, I cant use it. The useable-hint is shown, but when i hit F, nothing happens. This is the script, can somebody please tell me whats wrong with it?
create
{
classname "misc_mg42"
scriptname "main_gate_mg42"
origin "3576 1352 32"
spawnflags "2"
}
[/QUOTE]
That’s all you need for a simple MG42… so it must be your origin (probably height)
/viewpos gives your Z position as 64 above the ground, while an MG42 is 48 units high.
So to place it on the ground, you’d need to do :
(Z-origin with /viewpos) - 40
I do not work with viewpos, because this will NEVER give you the exact position. I always decompile the mapfiles and move the HNACs around with the Radiant.
Now, what I did: I selected an MG without a Tripod, and in Radiant, it is only shown as big red brick. I put the brick on the ground, so when I enter the game, the MG is about one meter over the ground, it’s flying. What do I have to do with that brick or what do I have to do in general that I can mount my MG when the Hint is appearing?
[QUOTE=Phishermans Phriend;201343]I do not work with viewpos, because this will NEVER give you the exact position. I always decompile the mapfiles and move the HNACs around with the Radiant.
Now, what I did: I selected an MG without a Tripod, and in Radiant, it is only shown as big red brick. I put the brick on the ground, so when I enter the game, the MG is about one meter over the ground, it’s flying. What do I have to do with that brick or what do I have to do in general that I can mount my MG when the Hint is appearing?[/QUOTE]
That should be all.
Is the scriptname “main_gate_mg42” the same as another MG42 on the map? Every entity should have a different scriptname…
[QUOTE=valkyr;201345]Is the scriptname “main_gate_mg42” the same as another MG42 on the map? Every entity should have a different scriptname…[/QUOTE]Nope, thats the only entity with that scriptname. So do you know why this doesnt work as it’s supposed to?
Try putting this in goldrush.script
create
{
classname "misc_mg42"
scriptname "tank-depot-spawn/MG42"
origin "80 3488 392"
spawnflags "2"
}
It definitely works…
so try like with cabinets…
script name like original script to map…
and add it to game_manager
[QUOTE=valkyr;201366]It definitely works…[/QUOTE]Same thing, the hint appears, but I didnt find a spot where I can actually mount it.
But MGs are not that important, I still have problems with the HNACs. As you said, you can still get HNA when standing on the other side of a thin wall.
I tried changing the mins and max, but I dont have any idea how this stuff works. I have this problem with several HNACs, and I dont want you to change the values for me, please explain it to me so I can change it myself.
For example, this is one
create
{
classname “misc_cabinet_supply”
scriptname “hut_ammo”
targetname “hut_ammo”
angle “270”
origin “5744 4280 1636”
}
Can you tell me what I have to do?
And is there an opportunity to add a CM-Marker without two create-tags? I currently add markers with this script, but I reached the maximum amount of trigger_objective_infos on some maps. So is there an opportunity to only use one trigger_objective_info? I also tried to figure that out, but didnt suceed either.
create
{
classname “trigger_objective_info”
scriptname “barracks_cabinet”
target “barracks_cabinet_CM-marker”
customimage “gfx/limbo/cm_healthammo”
shortname “Barracks Cabinets”
track “the Barracks Cabinets”
spawnflags “35”
origin “-6608 3736 1544”
mins “-56 -240 -64”
maxs “56 240 64”
}
create { classname "misc_commandmap_marker" scriptname "barracks_cabinet_CM-marker" targetname "barracks_cabinet_CM-marker" origin "-6608 3736 1544" }
Ah and btw, the “You are near XY” doesnt show up at none of my HNACs. Thats not a real problem, but maybe you can tell me what I have to do to fix this.
mins and maxs are points/vectors in 3d space. i would claim that i only need 2 points to form a 3d-rectangle, would you also agree 
and the origin is the center of your object. based on that you can define 2 vectors which point a certain location. simple school math actually, i think you get the idea.
Probably easiest to explain with a screenshot…

So, let’s say the origin is the centre point of the rectangle (2432 904)
To make this size of brush you’d work out how many grid units in each direction (positive and negative) to get to the edges :
X : 2432 to 2368 = -64
Y : 904 to 864 = -40
That’s for mins (because the numbers are decreasing) But since the origin is in the centre here, maxs will be the same, so you end up with :
mins “-64 -40 ?”
maxs “64 40 ?”
Obviously you need to do the same for the height (Z)
Ok guys, thank you for your help, but I dont really know how this Radiant works, I think there is a general idea that i dont have.
I guess there’s a X, a Y and a Z-Axis. Therefore I have three values for my HNAC, they define the positions on each axis.
So those three values define ONE single point somewhere, and ET knows because of the misc_cabinet_health, how big the shit will be.
Well, so now I need something, which defines a rectangle and is exactly as big as the misc_cabinet_health. To do that, I need to know how big a HNAC is. Can anybody tell me?
yea. actually its very hard to understand how to set up the components which belong to the health and ammo cabinets without “mapping skills”. i think your problem might be that you dont know what a trigger is and why you have to set it up.
my advice is experiement a bit (with mins/maxs/origins/ammorate/etc). it depends on many things. and if you are desperate, then grab yourself the radiant and draw a trigger around the cabinets by yourself, note the coordinates and apply that to your script with all the hints given here in this thread. you wont come around a little math anyway :stroggtapir:
[QUOTE=Qualmi;201444]grab yourself the radiant and draw a trigger around the cabinets by yourself, note the coordinates and apply that to your script[/QUOTE]Thats possible?
Tell me how to add a trigger, I will try that out for sure. Thank you very very much. 
you dont need to know that if you use the standard script which was posted here in this thread.
and with adding a trigger i only meant that you should go into radiant and draw a brush around your cabinets so that you can apply the mins and maxs perfectly. it was only meant to help if you cant get it to work by your own calculations.
[QUOTE=Phishermans Phriend;201439]Ok guys, thank you for your help, but I dont really know how this Radiant works, I think there is a general idea that i dont have.
[/quote]
You’d be best learning the basics of Radiant. You don’t need to know much, just the general concepts, like co-ordinates / brushes / entities.
I guess there’s a X, a Y and a Z-Axis. Therefore I have three values for my HNAC, they define the positions on each axis.
So those three values define ONE single point somewhere, and ET knows because of the misc_cabinet_health, how big the shit will be.
Yeah.
Your origin and mins / maxs use X/Y/Z-axis co-ordinates. You can see them in Radiant - the default view is X/Y - which is a top down view, which would be left/right in the game. Press CTRL+TAB to see Z (height / up/down)
Well, so now I need something, which defines a rectangle and is exactly as big as the misc_cabinet_health. To do that, I need to know how big a HNAC is. Can anybody tell me?
It’s not that simple… as the trigger needs to be larger than the HNAC (unless I’m very wrong)… which is why you could probably use the mins/maxs I gave earlier most of the time, but to get things exact - you need to use Radiant to work out the sizes.
Try placing a misc_cabinet_health in Radiant yourself and you can work out how big it is using the grid co-ordinates.
Thank you very much for your help, I now tried to create a brush around my HNACs. I managed that and I have two keys, “mapcoordsmins” and “mapcoordsmax”. Unfortunately there are only two values for them, and the mins and max always had three.
Heres a screen:
Please spend more than 2 minutes on it : Follow the tutorials I linked to in my previous post.
Learn how to make a simple map with just a health and ammo cabinet in it.
You can’t really just jump into scripting without knowing a bit about map-making. So you’ll really have to learn the basics of map-making (Radiant) first…