Problems with my mod (HL1) Created 12 years ago2012-04-18 15:42:11 UTC by Nevermelt Nevermelt

Created 12 years ago2012-04-18 15:42:11 UTC by Nevermelt Nevermelt

Posted 12 years ago2012-04-18 15:42:11 UTC Post #305490
Hello friends!

Could you help me?

I started doing a mod of Half-Life a few days (although not knowing some programming: D) and started having some problems.
I created new weapons and their codes compiled without errors.
Then put these weapons in player.cpp to test them with impulse 101. Everything was compiled without errors, but when I entered the game and typed commands sv_cheat 1 and impulse 101 came the error: "Host_Error: PF_precache_model_I: 'models / w_dragunov.mdl' precache Can Only be done in spawn function."

WTF? what shall I did wrong?

Furthermore I would like to know how to make these weapons appear in Hammer tab entities when I build my map.

Sorry for the inconvenience, I hope you can help me.

PS:. sorry for my english
Posted 12 years ago2012-04-18 17:13:17 UTC Post #305494
Not much of a coder, but i believe that when CBaseEntity::spawn() is called you need to precache the model. (though again no idea)

Edit the .fgd that hammer uses and add the entities you want to appear in hammer for your weapons :)
rufee rufeeSledge fanboy
Posted 12 years ago2012-04-18 20:28:42 UTC Post #305506
Man...

I read my code and it is okay (I think!), maybe a "link" with another code like 'player.cpp' or 'weapon.h' isnt working, but the VB dont show me any error message...

:(

About .fgd file... i add the line in weapons area like the others weapons, but when I run the hammer the gun does not appear among the entities.

this is so frustating!

tnx for help me!
Posted 12 years ago2012-04-18 23:04:50 UTC Post #305523
there are entries in weapons.cpp (something like util_precacheother(something) where you need to add an entry for your weapon.
Furthermore I would like to know how to make these weapons appear in Hammer tab entities when I build my map.
You need to make a custom FGD for you to be able to have your custom entities appear in hammer. However, this is entirely unnecessary. Simply place a weapon_glock or something and then rename it directly to the name of the weapon you coded (weapon_dragunov or whatever you named it in the code)
Posted 12 years ago2012-04-19 03:00:15 UTC Post #305530
Check your PM Nevermelt.

As for the rest of you, a precache error like that only occurs if:
1. The model/sprite is missing.
OR
2. The path is wrong. The model/sprite is in the wrong folder or
there is a grammatical error in the path you typed.
Posted 12 years ago2012-04-19 12:22:05 UTC Post #305534
Hey guys!!!!!!

^^

Thanks for attention.

Well,last night chatting with Daubster he sends to me this link: http://articles.thewavelength.net/183/

Before this tuto I have no problems to compile the code, only in the game console, but now VB show me 15 errors:

1>------ Build started: Project: cl_dll, Configuration: Release Win32 ----
1>Linking...
1> Creating library .Release/client.lib and object .Release/client.exp
1>hl_events.obj : error LNK2019: unresolved external symbol _EV_ak47Fire referenced in function "void __cdecl Game_HookEvents(void)" (?Game_HookEvents@@YAXXZ)
1>hl_weapons.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Cak47::Spawn(void)" (?Spawn@Cak47@@UAEXXZ)
1>hl_weapons.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Cak47::Precache(void)" (?Precache@Cak47@@UAEXXZ)
1>hl_weapons.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall Cak47::AddToPlayer(class CBasePlayer *)" (?AddToPlayer@Cak47@@UAEHPAVCBasePlayer@@@Z)
1>hl_weapons.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall Cak47::GetItemInfo(struct ItemInfo *)" (?GetItemInfo@Cak47@@UAEHPAUItemInfo@@@Z)
1>hl_weapons.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall Cak47::Deploy(void)" (?Deploy@Cak47@@UAEHXZ)
1>hl_weapons.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Cak47::PrimaryAttack(void)" (?PrimaryAttack@Cak47@@UAEXXZ)
1>hl_weapons.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Cak47::SecondaryAttack(void)" (?SecondaryAttack@Cak47@@UAEXXZ)
1>hl_weapons.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Cak47::WeaponIdle(void)" (?WeaponIdle@Cak47@@UAEXXZ)
1>.Releaseclient.dll : fatal error LNK1120: 9 unresolved externals
1>Build log was saved at "file://c:UsersAna CarolinaPicturessrc_dllcl_dllReleaseBuildLog.htm"
1>cl_dll - 10 error(s), 0 warning(s)
2>------ Build started: Project: hl, Configuration: Release Win32 ----
2>Linking...
2> Creating library .Releasehl/hl.lib and object .Releasehl/hl.exp
2>ak47.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall Cak47::Deploy(void)" (?Deploy@Cak47@@UAEHXZ)
2>ak47.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Cak47::PrimaryAttack(void)" (?PrimaryAttack@Cak47@@UAEXXZ)
2>ak47.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Cak47::SecondaryAttack(void)" (?SecondaryAttack@Cak47@@UAEXXZ)
2>ak47.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Cak47::WeaponIdle(void)" (?WeaponIdle@Cak47@@UAEXXZ)
2>.Releasehl/hl.dll : fatal error LNK1120: 4 unresolved externals
2>Build log was saved at "file://c:UsersAna CarolinaPicturessrc_dlldllsReleasehlBuildLog.htm"
2>hl - 5 error(s), 0 warning(s)
Build: 0 succeeded, 2 failed, 0 up-to-date, 0 skipped
MAS QUE MERDA É ESSA? (BUT WHAT IS THIS SHIT?)
Posted 12 years ago2012-04-19 12:42:32 UTC Post #305535
will be that the problem is the version of the sdk?

Tuto : sdk 2.2
My : sdk 2.3
Posted 12 years ago2012-04-20 12:34:17 UTC Post #305553
Finally ... I GOT IT!

I used only parts of the tutorial and the rest I did it my way, I used also said what 2muchvideogames
it was doing in precache weapons.cpp. The weapon's skin appears normal, but not shoot or zooms the scope. I'll try to fix it my way ...
You must be logged in to post a response.