AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [Alien Swarm] Finding current equipped weapon name (https://forums.alliedmods.net/showthread.php?t=144066)

comp_noob 11-28-2010 12:00

[Alien Swarm] Finding current equipped weapon name
 
hi, i tried to make a plugin for the game, but encountered errors while getting the weapon index for the weapon in slot x by using GetPlayerWeaponSlot()... it replied with this: [SM] Native "GetPlayerWeaponSlot" reported: "Weapon_GetSlot" not supported by this mod. is there an alternate way which i could do so?

McFlurry 11-28-2010 15:36

Re: [Alien Swarm] Finding current equipped weapon name
 
I believe alien swarm should be fully supported as of 1.3.5 try downloading a new snapshot.

comp_noob 11-28-2010 19:31

Re: [Alien Swarm] Finding current equipped weapon name
 
the sourcemod that i am using now is 1.4 beta snapshot... and it said that it is not supported... and i noticed a few other things about alien swarm, panels and menus are not supported, it says vgui is missing... and coloured text too, all the text appear same colour(yellow) although i formatted them to be different...

McFlurry 11-28-2010 19:46

Re: [Alien Swarm] Finding current equipped weapon name
 
Hmm, well most of sourcemod should be working though I've only worked with hooked events so for on alien swarm.

comp_noob 11-28-2010 19:58

Re: [Alien Swarm] Finding current equipped weapon name
 
so there isn't any way to actually get the currently equipped weapon on the marine? i've seen from some other pages that there is a GetMarine() to get the actual controlled marine by the player, because the player isn't moving at all.. as taken from here:
From the Valve Wiki:
"Unlike most Source engine games, the player in Alien Swarm is an invisible
commander entity. It does not move. If the player is currently controlling a
marine, then calling the GetMarine() method on the player will return it."
But then, is there a full list of the new scripting api reference of alien swarm available? there seems to be some commands that are new...

comp_noob 11-29-2010 04:13

Re: [Alien Swarm] Finding current equipped weapon name
 
by the way, is there any way to check the available api reference from the sourcemod? like check what scripting api is available for alien swarm in the sourcemod files?

psychonic 11-29-2010 07:37

Re: [Alien Swarm] Finding current equipped weapon name
 
Quote:

Originally Posted by comp_noob (Post 1359216)
so there isn't any way to actually get the currently equipped weapon on the marine? i've seen from some other pages that there is a GetMarine() to get the actual controlled marine by the player, because the player isn't moving at all.. as taken from here:
From the Valve Wiki:
"Unlike most Source engine games, the player in Alien Swarm is an invisible
commander entity. It does not move. If the player is currently controlling a
marine, then calling the GetMarine() method on the player will return it."
But then, is there a full list of the new scripting api reference of alien swarm available? there seems to be some commands that are new...

With a small amount of looking, the only way I found in SP to link between commander/players/clients and marines is to find each of the marine resource ents, either with FindEntityByClassname or watching for them with SDK Hooks' OnEntityCreated forward and then look at the m_Command and m_MarineEntity on each as noted in my response to one of your posts on the SDK Hooks thread, https://forums.alliedmods.net/showpo...&postcount=989
Quote:

Originally Posted by comp_noob (Post 1359359)
by the way, is there any way to check the available api reference from the sourcemod? like check what scripting api is available for alien swarm in the sourcemod files?

In general, anything not in a game-specific extension should work with the exception that some things in SDK Tools will not. (or at least not without tinkering as some functions you will want to use on the marine and not the player).

Alien Swarm has the extra exception that no current menu implementation works. A while ago, I was messing with the possibility of implementation menus using hud messages, resulting in menus displaying similarly to AMXX's as this would have given an on-screen menu to game's that didn't support the radio menu (HL2DM and now Alien Swarm where where vgui menu is also busted). At one point, it was partially working, but there were a couple bugs. I later accidentally even broke what I had and never got back to finishing it. If there's enough interest, I might look at it again.

psychonic 11-29-2010 10:02

Re: [Alien Swarm] Finding current equipped weapon name
 
Quote:

Originally Posted by comp_noob (Post 1359216)
so there isn't any way to actually get the currently equipped weapon on the marine? i've seen from some other pages that there is a GetMarine() to get the actual controlled marine by the player, because the player isn't moving at all.. as taken from here:
From the Valve Wiki:
"Unlike most Source engine games, the player in Alien Swarm is an invisible
commander entity. It does not move. If the player is currently controlling a
marine, then calling the GetMarine() method on the player will return it."

More followup...

Since I'm nice (sometimes) and this will eventually be needed anyway, here is a plugin library to provide natives for these. Just do "#include <swarmtools>". I can/will also add natives to replicate any sdktools_functions natives that require a client index but need to be executed on a marine. Just let me know what doesn't work directly with a marine index.

This is completely untested as I don't have the desire or time to do so right now, but if you can confirm that it works, I'll post it in the New Plugins section (or fix it first).

Code:
/**  * Gets the marine entity controlled by the given player  *  * @param client        Client index  * @return              Marine entity index or -1 for none or not found  * @error               Invalid client index  */ native Swarm_GetMarine(client); /**  * Gets the client index controlling given marine  *  * @param marine        Marine entity index  * @return              Client index of controller or -1 for none or not found  * @error               Invalid marine index  */ native Swarm_GetClientOfMarine(marine);

This requires SDK Tools and SDK Hooks. I will post a temporary build of SDK Hooks 1.3 shortly that will work on Alien Swarm.

Edit: attachments removed, go here https://forums.alliedmods.net/showthread.php?t=144324

comp_noob 11-29-2010 10:56

Re: [Alien Swarm] Finding current equipped weapon name
 
Quote:

Originally Posted by psychonic (Post 1359533)
More followup...

Since I'm nice (sometimes) and this will eventually be needed anyway, here is a plugin library to provide natives for these. Just do "#include <swarmtools>". I can/will also add natives to replicate any sdktools_functions natives that require a client index but need to be executed on a marine. Just let me know what doesn't work directly with a marine index.

This is completely untested as I don't have the desire or time to do so right now, but if you can confirm that it works, I'll post it in the New Plugins section (or fix it first).

Code:
/**
* Gets the marine entity controlled by the given player
*
* @param client Client index
* @return Marine entity index or -1 for none or not found
* @error Invalid client index
*/
native Swarm_GetMarine(client);

/**
* Gets the client index controlling given marine
*
* @param marine Marine entity index
* @return Client index of controller or -1 for none or not found
* @error Invalid marine index
*/
native Swarm_GetClientOfMarine(marine);



This requires SDK Tools and SDK Hooks. I will post a temporary build of SDK Hooks 1.3 shortly that will work on Alien Swarm.

Thanks! i will gladly try it out for you... but about sdk hooks... :cry:

psychonic 11-29-2010 11:58

Re: [Alien Swarm] Finding current equipped weapon name
 
1 Attachment(s)
Quote:

Originally Posted by psychonic (Post 1359533)
I will post a temporary build of SDK Hooks 1.3 shortly that will work on Alien Swarm.

I would have had this a bit sooner but it required actual code changes and cleanup in addition to the expected project changes.

Full sdkhooks source is also in the zip since I had to make edits specifically for AS. You should just need the dll and the gamedata file in /extensions and /gamedata respectively.


All times are GMT -4. The time now is 15:22.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.