Crysis style weapon add-on management -1 reply

Please wait...

Guest

I didn't make it!

0 XP

 
#1 10 years ago

So my new personal project is to make a new menu for managing weapon add-ons (silencer, scope, grenade launcher) without having to go into inventory, similar to what Crysis did. Here's an example of how I want it to look (of course, I intend the finished mod to look more "presentable") :

http://img145.imageshack.us/img145/4792/exampleij7.jpg

When you somehow open the interface, "cursor mode" will be activated so that you'll click either circle to attach/detach an add-on, and then close it.

I imagine that it should be doable to some extent. The repair kit in ABC Inferno involves the same basic functionality, that is to get and check weapons ids in slots and alter conditions of the weapons.

I also know that it's possible to check if a specific item is in your inventory (someone had made a script that checks if you have bandage in your inventory, and auto-uses it when your health goes low).

I have examples on how to make custom menus with buttons (sleep and repair interfaces).

I guess I'll also need to use that shortcut mod for custom key bindings, to open the add-on interface.

One thing I don't know is whether it's possible to attach/detach add-ons through scripting. I have yet to study how it works in vanilla, to see if there's anything in vanilla scripts that manages that functionality.

I'm, of course, open to any good answer or suggestions to any of these.

edit: I forgot to mention, I'll probably make a weapon "master list" to get button offsets so that the circle/buttons will be placed on appropriate positions on screen for every single weapon.

edit2: In my >identical thread at GSC forum<, "jamie1992" suggested an option to change ammo type too, so I'll be looking to add that as well.




Atrocious

Oblivion Lost supplier

50 XP

25th March 2008

0 Uploads

1,448 Posts

0 Threads

#2 10 years ago

LOL at the names on that screenshot!

If you really can get this to work, it would be great!

To get you started - function to check if something is in inventory is very easy: if db.actor:object("antirad") thenFor using an item it is: db.actor:eat(db.actor:object("antirad"))As you can see the actor "eats" the item. Though he don't really eat it. He uses it. Might work with add-ons too. Dunno. Worth a try.

Sorry for my sig. :beer:




Amraam

I follow teh Moo!

50 XP

30th April 2008

0 Uploads

749 Posts

0 Threads

#3 10 years ago

Very neat idea!

Hope you manage to get it working and good luck!!




Guest

I didn't make it!

0 XP

 
#4 10 years ago

That's certainly a helpful start, thank you again :) I gotta try and see whether double clicking on an add-on automatically attaches it to either slot when weapons in both slots are attachable, or if it attaches it to either at all.

Can I call bind commands from within a script? Since changing ammo type has its own key bind, I hope to be able to use the same command to make it happen.

Sorry for my sig. beer.gif

I don't care about soccer at all, enjoy the victory :) In fact, I'm glad that "we" lost the game. I was afraid that people would start shooting 'till morning should we win. Even when our team scored 2 goals tonight, people started shooting like crazy.

After the match with Croatia, several people died, with dozens more injured, because of "blind bullets" stupid people fired. That damn night also cost me a date (met her in a concert that coincided with the match; she was afraid to hang out afterwards because of all the celebration madness). "We" could have lost earlier for all I care.




Atrocious

Oblivion Lost supplier

50 XP

25th March 2008

0 Uploads

1,448 Posts

0 Threads

#5 10 years ago

denizsi;4402299 Can I call bind commands from within a script? Since changing ammo type has its own key bind, I hope to be able to use the same command to make it happen.[/quote] I don't think you can call bind commands. Wouldn't be good anyway, because you can only cycle through the ammo types. Would be better to select the ammo direcly, if that's possible.

denizsi;4402299 I don't care about soccer at all, enjoy the victory :)

Me neither, but it's EC and a very good one! :)

[quote=denizsi;4402299] In fact, I'm glad that "we" lost the game. I was afraid that people would start shooting 'till morning should we win. Even when our team scored 2 goals tonight, people started shooting like crazy.

LOL! I didn't think about that. Here people only blow the horns of their cars like no tomorrow. Can be annoying but doesn't really hurt someone.




rspeed

I want to be like the Admins

50 XP

11th May 2007

0 Uploads

218 Posts

0 Threads

#6 10 years ago

in theory is possible, but it will never be like crysis, whenever you open the "menu" the game will just stop, you wont be able to move or look around, the menu will be stuck in your screen and im not sure if its possible upgrade the weapons on the fly, i dunno, i have tried to do something with flash light and i didnt work, the only way would be if you make a huge list of items and detect item, release item and and spawn a new item with the previous item section and it would make an illusion of a upgrade system on the fly ala crysis, i did something similar for inferno v1.2, but its only with traders, maybe when i release it you will get an idea of the work that need to be done. it dont need a extra program to make it, use the medkit shortcut to do it, but you wont be able to heal through key and you would need to edit medkit stuffs and set it as food and use a script to detect it, so you would need to replace the original healing system, but it would be better than using a second program to bind a key.




Guest

I didn't make it!

0 XP

 
#7 10 years ago

AtrociousI don't think you can call bind commands. Wouldn't be good anyway, because you can only cycle through the ammo types. Would be better to select the ammo direcly, if that's possible.[/quote]

Yes, that should be possible, since double clicking on an ammo loads it to the gun. So I have a feeling that the graphical ammo selection part will be the easiest.

[quote=rspeed]in theory is possible, but it will never be like crysis, whenever you open the "menu" the game will just stop, you wont be able to move or look around, the menu will be stuck in your screen

That's all ok, I didn't expect or intend it to be any different either.

and im not sure if its possible upgrade the weapons on the fly, i dunno, i have tried to do something with flash light and i didnt work

Well, flashlight by default isn't a weapon add-on, so maybe there is hope for default add-ons?

edit: It's already looking pretty bleak. I was unable to locate any script line that directly deals with any of the add-on items or the weapons. It's all hardcoded I guess. I'll keep looking in case I'm missing something, but it seems like I'll have to do as you suggested, ie. huge list of items with a maximum of 9 combinations for each add-on appliable (with/without silencer/scope/gr. launcher). I've anticipated a "master list" actually, but have expected to be able to have a control over applying add-ons through script. Hopefully, the ammo part will be easier. I guess.

I wonder if GSC will finally release the SP SDK once CS is out. I'm hoping the only reason they didn't do it with SHOC is because they'd rather release a better one for CS.




RadioactiveLobster Forum Admin

Jeff is a mean boss

565,402 XP

28th July 2002

0 Uploads

53,121 Posts

1,330 Threads

#8 10 years ago

I hope you get this working, I'd love to have this ingame


If there is no image, Mikey broke something...



Lord Pariah

Forlorn Hopes Crusader

50 XP

10th June 2008

0 Uploads

304 Posts

0 Threads

#9 10 years ago

When you somehow open the interface, "cursor mode" will be activated so that you'll click either circle to attach/detach an add-on, and then close it.

...eerrr not to piss on your bonfire here but wont that be exactly like opening up the inventory? ecpet a different looking inventory with less options? Also adding GL's IRL isn't an on the fly thing you have to use hex key/purpose built keys to dissasemble the surround and then fit one that takes the launcher. even the rails system requires a keys to undo and tighten nuts to hold gl on. same for susat and its even longer for the pso scope

maybe you could do something similar via the traders though use the SS u provided to interface with the trader and pay him for upgrades like a permenant scope that has a superior zoom to susat or pso and a permanant GL thats slightly lighter than removeable one coz its fused on and the silencer could be better than standard by helping improve accuracy.. jsut an idea.




Guest

I didn't make it!

0 XP

 
#10 10 years ago

I found some references in lua_help.script to weapons and add-ons and what I imagine to be their functionality, like:

class CWeaponAK74 : CGameObject { CWeaponAK74 ();

function _construct(); function getEnabled() const; function use(CGameObject*);

(identical entries for all items, including add-ons)

..as well as some references to what I imagine to be scope attach/detach or context menu functionality:

class ui_events { .. const INVENTORY_DETACH_SILENCER_ADDON = 64 const INVENTORY_DETACH_SCOPE_ADDON = 62 const INVENTORY_ATTACH_ADDON = 60 .. const BUTTON CLICKED = 16 const DRAG_DROP_ITEM_RBUTTON_CLICK = 25

Though I'm unable tell what these exactly are, and if they would be of any use to me. I'm blind-walking by following cross-references and searching for potential keywords when no references could be found.

Notice how those, whatever they are, are consistent with the context menu options you get in inventory? That kind of gives me hope :P

...eerrr not to piss on your bonfire here but wont that be exactly like opening up the inventory? ecpet a different looking inventory with less options?

Not really. Not for me, at least. By default, you first open the inventory, then navigate your cursor to either item -which won't always be at the very same spot in your inventory grid- left click on either item to open the context menu, then right click on appropriate option to attach or dismount an add-on. Then you close inventory,

Whereas you could simply open the add-on interface, only click once on one of the buttons to mount/dismount one single-addon and close the interface. Less navigating and not having to deal with the context menu, as well as the comfort of big buttons which won't change place all the time.

Also adding GL's IRL isn't an on the fly thing you have to use hex key/purpose built keys to dissasemble the surround and then fit one that takes the launcher. even the rails system requires a keys to undo and tighten nuts to hold gl on. same for susat and its even longer for the pso scope

While that's beside the point, since how you do it by default is pretty much how fast you can use the interface so that argument goes for vanilla game too BUT, I do intend to add an -optional- timer of sorts when you'd mount/dismount anything, not effective immediately as soon as you click on a button, but rather when you're done with managing add-ons and close the add-on interface. Sort of like queuing your actions. In fact that's exactly what it would be.