Raised This Month: $51 Target: $400
 12% 

[TF2] Problem using TF2Items to give a player a spellbook


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Requiesta
Senior Member
Join Date: May 2012
Location: Texas
Old 12-16-2013 , 16:42   [TF2] Problem using TF2Items to give a player a spellbook
Reply With Quote #1

I originally posted this in the scripting forums of sourcemod but realized that it's far more appropriate here since I use tf2items stocks to create the effect. What I'm trying to do is force equip a spell magazine so that players can actually enjoy a mod that I've been developing since halloween (which obviously revolves around spells). Unfortunately I thought I had figured out how to make it work but I was wrong.

PHP Code:
stock forceSpellbook(client)
{
    if(
returnMagazine(client) == -1)
    {
        new 
Handle:hWeapon TF2Items_CreateItem(OVERRIDE_ALL|FORCE_GENERATION);
        
TF2Items_SetClassname(hWeapon"tf_weapon_spellbook");
        
TF2Items_SetItemIndex(hWeapon1070);
        
TF2Items_SetLevel(hWeapon100);
        
TF2Items_SetQuality(hWeapon6);
        
TF2Items_SetNumAttributes(hWeapon1);
        
TF2Items_SetAttribute(hWeapon05470.5);

        new 
entity TF2Items_GiveNamedItem(clienthWeapon);
        
CloseHandle(hWeapon);
        
EquipPlayerWeapon(cliententity);
        return 
entity;
    }
    else 
        return 
returnMagazine(client);

What seems to be occuring is that the player equips the spellbook and is able to gain spells for it but they don't have the ability to cast them. Am I doing something wrong?
__________________
YouTuber, Modder, Accountant, and somehow I still enjoy programming after all that.

Check out my YouTube Channel.
Requiesta is offline
Oshizu
Veteran Member
Join Date: Nov 2012
Location: Warsaw
Old 12-16-2013 , 16:55   Re: [TF2] Problem using TF2Items to give a player a spellbook
Reply With Quote #2

Maybe try to enable Halloween Mode on server
__________________
...
Oshizu is offline
Requiesta
Senior Member
Join Date: May 2012
Location: Texas
Old 12-16-2013 , 17:04   Re: [TF2] Problem using TF2Items to give a player a spellbook
Reply With Quote #3

It is enabled, we use the force holiday plugin to enable constant full moon/halloween/all the other goodies.
__________________
YouTuber, Modder, Accountant, and somehow I still enjoy programming after all that.

Check out my YouTube Channel.
Requiesta is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 12-17-2013 , 08:51   Re: [TF2] Problem using TF2Items to give a player a spellbook
Reply With Quote #4

Quote:
Originally Posted by Requiesta View Post
It is enabled, we use the force holiday plugin to enable constant full moon/halloween/all the other goodies.
try tf_forced_holiday 2 in server.cfg?
WildCard65 is offline
Requiesta
Senior Member
Join Date: May 2012
Location: Texas
Old 12-17-2013 , 10:46   Re: [TF2] Problem using TF2Items to give a player a spellbook
Reply With Quote #5

Tried it, no dice :/
__________________
YouTuber, Modder, Accountant, and somehow I still enjoy programming after all that.

Check out my YouTube Channel.
Requiesta is offline
Requiesta
Senior Member
Join Date: May 2012
Location: Texas
Old 12-18-2013 , 03:22   Re: [TF2] Problem using TF2Items to give a player a spellbook
Reply With Quote #6

Nevermind everyone problem solved. Typing use tf_weapon_spellbook into the console produced results showing that the entity does exist and is owned by the player (and such) but for whatever reason valve won't let you activate it with the action key.

So on that note any way to hook the action key (whether there's something in the slot or not) so I can alter its effects to use the spellbook ?
__________________
YouTuber, Modder, Accountant, and somehow I still enjoy programming after all that.

Check out my YouTube Channel.
Requiesta is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 12-20-2013 , 08:28   Re: [TF2] Problem using TF2Items to give a player a spellbook
Reply With Quote #7

It workd fine when I tried it, but each class handles that item a bit differently. Look through the netprops and make sure it's setting them up appropriately. It may just not be resetting some.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:56.


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