[hlcoders] grenade code
Hi, recently I had some troubles with a mod I was planning on making and eventually started thinking more and more that it was to complicated to make, during that time I got an idea for a different mod instead that would be much more simplistic and could then be expanded without looking incomplete. 2 of the people that were on my previous project also agreed it was to complicated anyway and hopped over as well. Like the first project however we still lack a coder, but the point of this message is not to recruit one though so hear me out. The mod is gonna be called FragOut! and rather then convetional weapons you get only grenades, not just the regular ones but different ones will be available on spawn or pickup as well. So codewise there's actually only 3 things to do: 1. Using the tutorial on VDC make sure there's a working teammenu and underlying team structure(I am however leaving mp_teamplay as a bool rather then forcing it to be on, so the mod can be played as deatmatch or team deathmatch) 2. Make copies of the grenades and mod the code until they have the desired effect 3. Allow to pickup primed grenade with the use key like regular items and increasing the throwing range(when pushing left mouse button) So since there isn't a huge lot to do besides these 2 things and maybe some smaller things I figured since I attempted coding before(but hated it) I could pull myself together and give it another spin though I have no intention of keeping on doing the coding work. I plan to do a bit small time code work on the grenades and hope that by then getting content out a real coder can be attracted to work for the mod. Anyway since I have really little to none experience with coding and am blindly seeking my through the code using bits of unhelpfull tutorials to get me through the darkness I still have the following 3 questions about grenade code unanswered: 1. There seems to be alot of different .h and .cpp files on grenades, such as frag.cpp weapon_grenade.cpp, grenade.cpp and so on. So now I wonder, which of these is actually the grenade you get as a weapon and can be multiplied to create multiple grenades with different effects? 2. What is the purpose of all these other grenade files? 3. I found things like damage and area of effect but I couldnt find the actual effect upon detonating(such as being instructed to do damage on detonate and show explosion effect), so where is the effect determined and what would be involved to say change it to do things like freezing players or pushing players(I know for one that there's wind entitties to use for maps, would there be any way to incorporate wind effects to push players into a grenade) Well hope you didn't find this mail to long, tried to keep it short but didn't really work out. ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
1. /game/shared/hl2mp/weapon_frag.cpp is the weapon (viewmodel) for the HL2DM frag grenade /game/server/hl2/grenade_frag.cpp is the grenade entity itself (not the weapon) 2. There are some prototype grenades, satchels, tripmines, SMG grenades, etc. There are two versions for weapons because the SDK includes the source for HL2 and HL2DM. 3. RadiusDamage is called from CBaseGrenade::Explode via CBaseGrenade::Detonate.. you'll probably want to overload Detonate to call Explode with a different damage type other than DMG_BLAST. There're lots of damage flags you can use (in sharedefs.h) but some of them don't do anything to players and you'll probably want to override the player's OnTakeDamage to handle your damage type differently than it's handled by default. Good luck.. Regards, Paul On Sun, Jul 27, 2008 at 7:56 AM, Yorg Kuijs <[EMAIL PROTECTED]> wrote: > Hi, recently I had some troubles with a mod I was planning on making and > eventually started thinking more and more that it was to complicated to > make, during that time I got an idea for a different mod instead that > would be much more simplistic and could then be expanded without looking > incomplete. > 2 of the people that were on my previous project also agreed it was to > complicated anyway and hopped over as well. > > Like the first project however we still lack a coder, but the point of > this message is not to recruit one though so hear me out. > > The mod is gonna be called FragOut! and rather then convetional weapons > you get only grenades, not just the regular ones but different ones will > be available on spawn or pickup as well. > So codewise there's actually only 3 things to do: > 1. Using the tutorial on VDC make sure there's a working teammenu and > underlying team structure(I am however leaving mp_teamplay as a bool > rather then forcing it to be on, so the mod can be played as deatmatch > or team deathmatch) > 2. Make copies of the grenades and mod the code until they have the > desired effect > 3. Allow to pickup primed grenade with the use key like regular items > and increasing the throwing range(when pushing left mouse button) > > So since there isn't a huge lot to do besides these 2 things and maybe > some smaller things I figured since I attempted coding before(but hated > it) I could pull myself together and give it another spin though I have > no intention of keeping on doing the coding work. I plan to do a bit > small time code work on the grenades and hope that by then getting > content out a real coder can be attracted to work for the mod. > > Anyway since I have really little to none experience with coding and am > blindly seeking my through the code using bits of unhelpfull tutorials > to get me through the darkness I still have the following 3 questions > about grenade code unanswered: > 1. There seems to be alot of different .h and .cpp files on grenades, > such as frag.cpp weapon_grenade.cpp, grenade.cpp and so on. So now I > wonder, which of these is actually the grenade you get as a weapon and > can be multiplied to create multiple grenades with different effects? > 2. What is the purpose of all these other grenade files? > 3. I found things like damage and area of effect but I couldnt find the > actual effect upon detonating(such as being instructed to do damage on > detonate and show explosion effect), so where is the effect determined > and what would be involved to say change it to do things like freezing > players or pushing players(I know for one that there's wind entitties to > use for maps, would there be any way to incorporate wind effects to push > players into a grenade) > > Well hope you didn't find this mail to long, tried to keep it short but > didn't really work out. > > ___ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
Nice answers, think that'll be quite helpfull thanks :) ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
Alright another question: I started on adding a new grenade, all went well, it's in game though its still using the same ammo as the regular grenade, however it will have a unique sound replacing the regular bleeps and explosion but I can't find out how to change sounds of it individually. I found the script file named weapon_sounds.txt where you can set what .wavs to use for certain situations such as exploding but this would effect all the other grenade sounds to. So my problem is finding how to make it so grenades can use different sounds for explosions and even the bleeping after its thrown. ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
I think you'll find it's defined in the weapons script file. i.e. weapon_mygrenade.txt Theres a section that defines weapon sounds and these refer to sounds defined in weapon_sounds.txt. Hope that helps. - Jed 2008/7/30 Yorg Kuijs <[EMAIL PROTECTED]>: > Alright another question: > I started on adding a new grenade, all went well, it's in game though > its still using the same ammo as the regular grenade, however it will > have a unique sound replacing the regular bleeps and explosion but I > can't find out how to change sounds of it individually. > > I found the script file named weapon_sounds.txt where you can set what > .wavs to use for certain situations such as exploding but this would > effect all the other grenade sounds to. So my problem is finding how to > make it so grenades can use different sounds for explosions and even the > bleeping after its thrown. > > ___ > To unsubscribe, edit your list preferences, or view the list archives, please > visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
nah there's only a few sounds defined there but I found what I was looking for in the code, but again if I change this it will count that for all the grenades so I want to make something like: if weapon_frag.cpp { playsound1 } if weapon_superfrag.cpp { playsound2 ] I have no idea how to do this though, basically I have different code for the weapons themselves(what you see in hand) but they all take data from basegrenade_shared.cpp and thats where I can also determine explosion sounds but I need a way to make if's for playing sound 1 for nade 1, sound 2 for nade 2, sound 3 for nade 3, etc etc. I'm new to coding so I don't know how to do this, already trying some things but doesn't work... yet ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
Are you saying you want a single greande to have different "modes" (i.e. can explode in different ways) or are you actually trying to make each grenade as a seperate weapon type? In our mod we have several types of grenades (four in fact) and these are all defined as different weapons derived from from a common base class. - Jed 2008/7/30 Yorg Kuijs <[EMAIL PROTECTED]>: > nah there's only a few sounds defined there > but I found what I was looking for in the code, but again if I change this > it will count that for all the grenades so I want to make something like: > if weapon_frag.cpp > { > playsound1 > } > > if weapon_superfrag.cpp > { > playsound2 > ] > > I have no idea how to do this though, basically I have different code for > the weapons themselves(what you see in hand) but they all take data from > basegrenade_shared.cpp and thats where I can also determine explosion sounds > but I need a way to make if's for playing sound 1 for nade 1, sound 2 for > nade 2, sound 3 for nade 3, etc etc. > I'm new to coding so I don't know how to do this, already trying some things > but doesn't work... yet > ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
Been messing around for about 2 hours now and I think I almost got it currently using this code: if ( "weapon_superfrag" ) { EmitSound( "HolyGrenade.Explode" ); } else if ( "weapon_frag" ) { EmitSound( "BaseGrenade.Explode" ); } the problem I have is though that it seems to be ignoring the if's and just plays both sounds as if no if was specified at all.. so it just plays both HolyGrenade.Explode AND BaseGrenade.Explode for both grenades when it explodes. Any idea why it's completely ignoring the ifs?(it compiles without errors so it should be accepting the ifs, cause earlier it wasnt now doing it like this it didn't produce errors) ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
Thats not going to work because your not actually testing anything. if ( "weapon_superfrag" ). if weapon_superfrag WHAT? exactly? I can't remember the exact code off my head but you need something like: if ( strcmp( this.weapon_name, "weapon_superfrag") != 0) { ... } So you'd be comparing the name of the weapon with a given string to see if they match and then do something. Note the above ISNT real code, just an example. I still think you'd be better off just overriding the function that plays the sound in each weapons own class. - Jed 2008/7/30 Yorg Kuijs <[EMAIL PROTECTED]>: > Been messing around for about 2 hours now and I think I almost got it > currently using this code: >if ( "weapon_superfrag" ) >{ >EmitSound( "HolyGrenade.Explode" ); >} >else if ( "weapon_frag" ) >{ >EmitSound( "BaseGrenade.Explode" ); >} > > > the problem I have is though that it seems to be ignoring the if's and > just plays both sounds as if no if was specified at all.. so it just > plays both HolyGrenade.Explode AND BaseGrenade.Explode for both grenades > when it explodes. Any idea why it's completely ignoring the ifs?(it > compiles without errors so it should be accepting the ifs, cause earlier > it wasnt now doing it like this it didn't produce errors) > > ___ > To unsubscribe, edit your list preferences, or view the list archives, please > visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
Yorg Kuijs wrote: > Been messing around for about 2 hours now and I think I almost got it > currently using this code: > if ( "weapon_superfrag" ) > { I hope that's not the actual code, since... if ( pointer_to_some_text_string_here ) ...will always be true since the pointer will always be non-zero. -- Jeffrey "botman" Broome ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
I'd recommend you read Bjarne Stroustrup's "The C++ Programming Language" or a similar C++ introduction if the code you have there is what you're actually using. While it is legal to test a string literal like you have, it doesn't make any sense at all. A string literal will always evaluate as true, because it's a const char* with a non-zero value, and any non-zero pointer converted to bool is true. Regards, Paul On Wed, Jul 30, 2008 at 10:40 AM, Yorg Kuijs <[EMAIL PROTECTED]> wrote: > Been messing around for about 2 hours now and I think I almost got it > currently using this code: >if ( "weapon_superfrag" ) >{ >EmitSound( "HolyGrenade.Explode" ); >} >else if ( "weapon_frag" ) >{ >EmitSound( "BaseGrenade.Explode" ); >} > > > the problem I have is though that it seems to be ignoring the if's and > just plays both sounds as if no if was specified at all.. so it just > plays both HolyGrenade.Explode AND BaseGrenade.Explode for both grenades > when it explodes. Any idea why it's completely ignoring the ifs?(it > compiles without errors so it should be accepting the ifs, cause earlier > it wasnt now doing it like this it didn't produce errors) > > ___ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
Jed schreef: > I still think you'd be better off just overriding the function that > plays the sound in each weapons own class. > > and how do I do that? There isn't a function that plays the sound in its own class, the function that plays the sound is EmitSound which is location in a function called CBaseGrenade::Explode in basegrenade_shared.cppTHAT is what causes the sound to play when the grenade explode, if the EmitSound is moved it doesnt play the sound when exploding! the BaseGrenade.Explode is what is linked to the game_sounds_weapons.txt in the scripts folder, in there you can choose what .wav files to play if I change those sounds all the grenade sounds would be that, so which is why I added EmitSound for HolyGrenade.Explode which has its own .wav and that should result in BaseGrenade having sound 1 and HolyGrenade/SuperFrag having sound 2. I believe someone mentioned the weapon scripts files to but the sounds you can choose there aren't even played.. EVER they're Special1, Single and Double, Single and Double are left with null.wav which is no sound and special has a sound but what is Special1? the sound isnt ever played when using grenades and changing the sound for it doesn't do a thing since it's an action which is never used so the only way to do it is through code and the game_sounds_weapons.txt ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
Override explode? On Wed, Jul 30, 2008 at 12:26 PM, Yorg Kuijs <[EMAIL PROTECTED]> wrote: > Jed schreef: > > I still think you'd be better off just overriding the function that > > plays the sound in each weapons own class. > > > > > and how do I do that? There isn't a function that plays the sound in its > own class, the function that plays the sound is EmitSound which is > location in a function called CBaseGrenade::Explode in > basegrenade_shared.cppTHAT is what causes the sound to play when the > grenade explode, if the EmitSound is moved it doesnt play the sound when > exploding! > > the BaseGrenade.Explode is what is linked to the game_sounds_weapons.txt > in the scripts folder, in there you can choose what .wav files to play > if I change those sounds all the grenade sounds would be that, so which > is why I added EmitSound for HolyGrenade.Explode which has its own .wav > and that should result in BaseGrenade having sound 1 and > HolyGrenade/SuperFrag having sound 2. > > I believe someone mentioned the weapon scripts files to but the sounds > you can choose there aren't even played.. EVER they're Special1, Single > and Double, Single and Double are left with null.wav which is no sound > and special has a sound but what is Special1? the sound isnt ever played > when using grenades and changing the sound for it doesn't do a thing > since it's an action which is never used so the only way to do it is > through code and the game_sounds_weapons.txt > > ___ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > -- -Tony ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
Or make an actual function inside the base grenade class like so: virtual void PlayExplosionSound() {}; then inside Explode() replace the lines that play the sound with PlayExplosionSound(); and then derive it in your subclasses to actually play the sounds. On Wed, Jul 30, 2008 at 12:33 PM, Tony omega Sergi <[EMAIL PROTECTED]>wrote: > Override explode? > > > ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
Tony "omega" Sergi schreef: > and then derive it in your subclasses to actually play the sounds. > think I followed most of what you said except this. What does it mean? Also base grenade class is basegrenade_shared.cpp ? sounds like that wouldn't fix it? ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
Well I've been it at for a few more hours and still no luck, I was thinking however how it may eventually prove to be faster and easier to do it in the script file(game_sounds_weapons.txt) and somehow decide sounds by checking what weapon_name.txt script is loaded. Ehm here an example of what I want(I know that the way I put it probably doesn't work, just an example of what I *want *to achieve: "BaseExplosionEffect.Sound" { "channel""CHAN_STATIC" "volume""1.0" "soundlevel""SNDLVL_140dB" "pitch""PITCH_NORM" if weapon_frag.txt { "rndwave" { "wave""^weapons/explode3.wav" "wave""^weapons/explode4.wav" "wave""^weapons/explode5.wav" } } else if weapon_superfrag.txt { "wave "^weapons/holyexplode.wav } } like I said that's probably not gonna work but maybe anyone with some experienced with scripts can tell me if what I'm trying is possible at all using scripts like this and if so can explain how to do it or maybe link to a tutorial.. in the meantime I'll be looking for tutorials myself. ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
What you after lives in this class; CBasePlayer::OnDamagedByExplosion That lives in player.cpp - i dont know what its like in ob, as i have not migrated my code to that yet. Adam Owner Nigredo Studios http://www.nigredostudios.com --- On Fri, 8/1/08, Yorg Kuijs <[EMAIL PROTECTED]> wrote: > From: Yorg Kuijs <[EMAIL PROTECTED]> > Subject: Re: [hlcoders] grenade code > To: "Discussion of Half-Life Programming" > Date: Friday, August 1, 2008, 12:31 AM > Well I've been it at for a few more hours and still no > luck, I was > thinking however how it may eventually prove to be faster > and easier to > do it in the script file(game_sounds_weapons.txt) and > somehow decide > sounds by checking what weapon_name.txt script is loaded. > Ehm here an example of what I want(I know that the way I > put it probably > doesn't work, just an example of what I *want *to > achieve: > > "BaseExplosionEffect.Sound" > { > "channel""CHAN_STATIC" > "volume""1.0" > "soundlevel""SNDLVL_140dB" > "pitch""PITCH_NORM" > > if weapon_frag.txt > { > "rndwave" > { > "wave" > "^weapons/explode3.wav" > "wave" > "^weapons/explode4.wav" > "wave" > "^weapons/explode5.wav" > } > } > else if weapon_superfrag.txt > { > "wave "^weapons/holyexplode.wav > } > } > > like I said that's probably not gonna work but maybe > anyone with some > experienced with scripts can tell me if what I'm trying > is possible at > all using scripts like this and if so can explain how to do > it or maybe > link to a tutorial.. > in the meantime I'll be looking for tutorials myself. > > ___ > To unsubscribe, edit your list preferences, or view the > list archives, please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
I'm pretty sure that "if" is not supported by weapon "scripts" as they aren't really scripts but rather data definition formats. Could you give us the code you have so far, the SuperFrag/HolyGrenade .cpp and .h? On Fri, Aug 1, 2008 at 12:31 AM, Yorg Kuijs <[EMAIL PROTECTED]> wrote: > Well I've been it at for a few more hours and still no luck, I was > thinking however how it may eventually prove to be faster and easier to > do it in the script file(game_sounds_weapons.txt) and somehow decide > sounds by checking what weapon_name.txt script is loaded. > Ehm here an example of what I want(I know that the way I put it probably > doesn't work, just an example of what I *want *to achieve: > > "BaseExplosionEffect.Sound" > { >"channel""CHAN_STATIC" >"volume""1.0" >"soundlevel""SNDLVL_140dB" >"pitch""PITCH_NORM" > >if weapon_frag.txt >{ >"rndwave" >{ >"wave""^weapons/explode3.wav" >"wave""^weapons/explode4.wav" >"wave""^weapons/explode5.wav" >} >} >else if weapon_superfrag.txt >{ >"wave "^weapons/holyexplode.wav >} > } > > like I said that's probably not gonna work but maybe anyone with some > experienced with scripts can tell me if what I'm trying is possible at > all using scripts like this and if so can explain how to do it or maybe > link to a tutorial.. > in the meantime I'll be looking for tutorials myself. > > ___ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > -- Programmer for Resistance and Liberation www.resistanceandliberation.com Programmer for Red Tribe www.redtribe.com ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
You are going to have to edit the explosion effect itself which is client side. Ill give you the location but actually getting your own sound to play is going to require some skill on your part, that being, you will need to create a new variable in that explosion FX so you can if statement your sound. The effect dispatch on the server sends the required data to the client to create the effect. The sound is played in the client cpp fx_explosion, here is the function. void C_BaseExplosionEffect::PlaySound( void ) { if ( m_fFlags & TE_EXPLFLAG_NOSOUND ) return; CLocalPlayerFilter filter; C_BaseEntity::EmitSound( filter, SOUND_FROM_WORLD, "BaseExplosionEffect.Sound", &m_vecOrigin ); } Have fun :p On Thu, Jul 31, 2008 at 2:50 PM, Jonathan Murphy <[EMAIL PROTECTED]>wrote: > I'm pretty sure that "if" is not supported by weapon "scripts" as they > aren't really scripts but rather data definition formats. > > Could you give us the code you have so far, the SuperFrag/HolyGrenade .cpp > and .h? > > On Fri, Aug 1, 2008 at 12:31 AM, Yorg Kuijs <[EMAIL PROTECTED]> wrote: > > > Well I've been it at for a few more hours and still no luck, I was > > thinking however how it may eventually prove to be faster and easier to > > do it in the script file(game_sounds_weapons.txt) and somehow decide > > sounds by checking what weapon_name.txt script is loaded. > > Ehm here an example of what I want(I know that the way I put it probably > > doesn't work, just an example of what I *want *to achieve: > > > > "BaseExplosionEffect.Sound" > > { > >"channel""CHAN_STATIC" > >"volume""1.0" > >"soundlevel""SNDLVL_140dB" > >"pitch""PITCH_NORM" > > > >if weapon_frag.txt > >{ > >"rndwave" > >{ > >"wave""^weapons/explode3.wav" > >"wave""^weapons/explode4.wav" > >"wave""^weapons/explode5.wav" > >} > >} > >else if weapon_superfrag.txt > >{ > >"wave "^weapons/holyexplode.wav > >} > > } > > > > like I said that's probably not gonna work but maybe anyone with some > > experienced with scripts can tell me if what I'm trying is possible at > > all using scripts like this and if so can explain how to do it or maybe > > link to a tutorial.. > > in the meantime I'll be looking for tutorials myself. > > > > ___ > > To unsubscribe, edit your list preferences, or view the list archives, > > please visit: > > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > > > > > -- > Programmer for Resistance and Liberation > www.resistanceandliberation.com > Programmer for Red Tribe > www.redtribe.com > ___ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > -- ~Ryan ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
I think I'm just gonna leave explosion as is for a while, changed my focus on the bleeping of the grenade before it explodes I found already how to change it but my sound cant play correctly because its about 5 seconds long and it tries to bleep after less then a second again so the soundfile cant play. However what I noticed is that the same/roughly the same bleeping sound is made right after the grenade is thrown. So what I want to do is leave the bleeping for my holygrenade with a null.wav, which I already did so the quick bleeps are gone, now I want the replace the first starting bleep with my holycountdown sound which sound then play correctly. However! I can't find what causes it to play that first bleep I searched around with the search function in the code, looked around some area's where it should be like in functions determining what to do when grenade is thrown but nothing is there relating to that first bleep sound! anybody have an idea where to find the location it starts that first bleep sound right after the throw? ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
Здраствуйте товарищ Yorg! File grenade_frag.cpp void CGrenadeFrag::Spawn( void ) { Precache( ); SetModel( GRENADE_MODEL ); if( GetOwnerEntity() && GetOwnerEntity()->IsPlayer() ) { m_flDamage = sk_plr_dmg_fraggrenade.GetFloat(); m_DmgRadius = sk_fraggrenade_radius.GetFloat(); } else { m_flDamage = sk_npc_dmg_fraggrenade.GetFloat(); m_DmgRadius = sk_fraggrenade_radius.GetFloat(); } m_takedamage= DAMAGE_YES; m_iHealth = 1; SetSize( -Vector(4,4,4), Vector(4,4,4) ); SetCollisionGroup( COLLISION_GROUP_WEAPON ); CreateVPhysics(); CreateEffects(); BlipSound();// first bleep!!! m_flNextBlipTime = gpGlobals->curtime + FRAG_GRENADE_BLIP_FREQUENCY; AddSolidFlags( FSOLID_NOT_STANDABLE ); m_combineSpawned= false; m_punted= false; BaseClass::Spawn(); } Friday, August 1, 2008, 5:13:52 PM, you wrote: YK> I think I'm just gonna leave explosion as is for a while, changed my YK> focus on the bleeping of the grenade before it explodes YK> I found already how to change it but my sound cant play correctly YK> because its about 5 seconds long and it tries to bleep after less then a YK> second again so the soundfile cant play. However what I noticed is that YK> the same/roughly the same bleeping sound is made right after the grenade YK> is thrown. YK> So what I want to do is leave the bleeping for my holygrenade with a YK> null.wav, which I already did so the quick bleeps are gone, now I want YK> the replace the first starting bleep with my holycountdown sound which YK> sound then play correctly. YK> However! I can't find what causes it to play that first bleep YK> I searched around with the search function in the code, looked around YK> some area's where it should be like in functions determining what to do YK> when grenade is thrown but nothing is there relating to that first bleep YK> sound! YK> anybody have an idea where to find the location it starts that first YK> bleep sound right after the throw? YK> ___ YK> To unsubscribe, edit your list preferences, or view the list archives, please visit: YK> http://list.valvesoftware.com/mailman/listinfo/hlcoders -- Ну все привет! Обращайтесь в любое время дня и ночи! Но не удивляйтеть, если я потребую за это ВАШУ ДУШУ! BEaSTmailto:[EMAIL PROTECTED] ICQ 254471767 ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
hey BEaST, that sounds like it but the thing is that's the sound I set to null.wav and it doesn't play the bleeps anymore except the first bleep so isn't it strange that it's still emitting that first bleep, that's why I think the first bleep is created somewhere else.. yet this does sound right but it should have silenced the first bleep as well. ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
ok so another solution I thought of would be to remove all the lines of code for next bleeptime and bleep frequence as I don't want that(this code:) m_flNextBlipTime = gpGlobals->curtime + FRAG_GRENADE_BLIP_FREQUENCY; funny thing now is that it seems stuck in between wanting to play the default blip sound(even though it should be my name sound: holycountdown) but then it only plays it half(the sound starts then cuts of in a few milliseconds before end) or it doesn't play it all. The sound its supposed to play right after the throw(instead of the bleep) is the holycountdown but it plays that sound AFTER the grenade explodes(so you first hear the explosion then it starts counting down-.-) anyway bit of code: voidBlipSound() { EmitSound( "HolyGrenade.HolyCountdown" ); } that was orignally EmitSound( "Grenade.Blip" ) and blipsound is what starts the sound (see the code that BEaST mailed) also some additional info that may be handy: I copied grenade_frag.cpp and the header file and named them grenade_superfrag.cpp and grenade_superfrag.h , for my weapon_superfrag.cpp I changed the include to grenade_superfrag.h and renamed classes and functions to match. is it possible grenade_superfrag changed sound is conflicting with another file such as basegrenade_shared.h? ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
just mailing this so you know: I fixed the bleeping and the sound is now properly playing, turns out I needed to change npc_grenade_frag to npc_supergrenade_frag, most likely that was still trying to somehow load the sound from grenade_frag.cpp causing a conflict but changing it to be superfrag fixed that. ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
Alright back with a new problem, been working on a grenade that explodes on impact and used so far molotov or rpg code(tried both) but haven't been able to get it work yet, all I got to work is that it explodes on physic entities, npcs and players but other then that it just bounces off anything else then lies on the floor floating or in the ground. Now I remember more then a month back someone on this list posed a question about impact grenades and I believed he also later stated the solution he found for it, if anyone can help me find that post that would be great, I have been manually scanning over thread names for past 3 months, but if its there its not under a name that will make it easy to find. I believe the list also has a search function but I can't find it.. ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
http://www.mail-archive.com/hlcoders@list.valvesoftware.com/ but impact grenades should be peanuts. Check out void CBaseGrenadeProjectile::ResolveFlyCollisionCustom( trace_t &trace, Vector &vecVelocity ) hth > Alright back with a new problem, > been working on a grenade that explodes on impact and used so far > molotov or rpg code(tried both) but haven't been able to get it work > yet, all I got to work is that it explodes on physic entities, npcs and > players but other then that it just bounces off anything else then lies > on the floor floating or in the ground. > > Now I remember more then a month back someone on this list posed a > question about impact grenades and I believed he also later stated the > solution he found for it, if anyone can help me find that post that > would be great, I have been manually scanning over thread names for past > 3 months, but if its there its not under a name that will make it easy > to find. > > I believe the list also has a search function but I can't find it.. > > ___ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
Maarten De Meyer schreef: > but impact grenades should be peanuts. Check out > > void CBaseGrenadeProjectile::ResolveFlyCollisionCustom( trace_t &trace, > Vector &vecVelocity ) > > > hth > > didnt notice there was a basegrenadeprojecile yet! gonna check that out for sure tommorow! thanks :) ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
Yeah the impact grenade base is what the SMG grenade launcher uses if that's of any help. I used it as a base for a artillery shell projectile I made for a cannon once. I think the only thing I had to change in the touch code was to make it discreetly vanish rather than explode when it hit the skybox. - Jed 2008/8/20 Yorg Kuijs <[EMAIL PROTECTED]>: > Maarten De Meyer schreef: >> but impact grenades should be peanuts. Check out >> >> void CBaseGrenadeProjectile::ResolveFlyCollisionCustom( trace_t &trace, >> Vector &vecVelocity ) >> >> >> hth >> >> > didnt notice there was a basegrenadeprojecile yet! gonna check that out > for sure tommorow! thanks :) > > ___ > To unsubscribe, edit your list preferences, or view the list archives, please > visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
still haven't got it working the base projectile grenade was useless, it wasnt even included in the project and seems part of the sdk code? or whatever.. more usefull seems all the code I can gather from bugbait, rpg and basegrenade_shared together like that I have the following code in my grenade_melon.cpp (copied off grenade_frag.cpp) in Datadesc: DEFINE_ENTITYFUNC( ExplodeTouch ), related code in Spawn: (unrelated stuff above) // Explode on contact SetTouch( &CGrenadeMelon::ExplodeTouch ); SetSize( -Vector(6,6,6), Vector(6,6,6) ); CreateVPhysics(); CreateEffects(); BlipSound(); AddSolidFlags( FSOLID_NOT_STANDABLE ); m_combineSpawned= false; BaseClass::Spawn(); } and for the actual touch: void CGrenadeMelon::ExplodeTouch( CBaseEntity *pOther ) { trace_ttr; VectortraceDir = GetAbsVelocity(); // Don't hit triggers or water Assert( pOther ); if ( pOther->IsSolidFlagSet(FSOLID_TRIGGER|FSOLID_VOLUME_CONTENTS) && pOther->GetCollisionGroup() != COLLISION_GROUP_WEAPON ) return; VectorNormalize( traceDir ); UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() + traceDir * 64, MASK_SHOT, this, COLLISION_GROUP_NONE, &tr ); if( tr.fraction == 1.0 || !(tr.surface.flags & SURF_SKY) ) { Explode( &tr, DMG_BLAST ); } } the DelayThink orignally in the grenade_ code is removed as explode touch does that now. ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
probably cause you're using a hl2 mod or something, I have a from scratch mod ( ep1 based ), and my code uses base projectile grenades :) > still haven't got it working > the base projectile grenade was useless, it wasnt even included in the > project and seems part of the sdk code? or whatever.. ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
yeah EP1 half life 2 multiplayer mod:) anyway anything you see wrong with the code? I know the touch function and all works, but only seem to get it to work for players, npcs and physic props, so anything else thats also solid isnt counted somehow.. which is strange, im thinking something else might be sabotaging.. thinking that cause I saw grenadethrown.cpp code but as far as I can tell nothing actually uses that code, and even removed everything that was in the spawn function and didnt affect a thing, so I don't think its actually used, but maybe something else is messing with my code or my code isnt right, but I pieced that together from rpg, bugbait and basegrenade code so that code *should *be set to go Maarten De Meyer schreef: > probably cause you're using a hl2 mod or something, I have a from scratch > mod ( ep1 based ), and my code uses base projectile grenades :) > > >> still haven't got it working >> the base projectile grenade was useless, it wasnt even included in the >> project and seems part of the sdk code? or whatever.. >> > > > > ___ > To unsubscribe, edit your list preferences, or view the list archives, please > visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > No virus found in this incoming message. > Checked by AVG - http://www.avg.com > Version: 8.0.138 / Virus Database: 270.6.6/1626 - Release Date: 21-8-2008 > 18:54 > > > > ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
ok been trying out more stuff and found the culprit: it's: bool CGrenadeMelon::CreateVPhysics() { // Create the object in the physics system VPhysicsInitNormal( SOLID_BBOX, 0, false ); return true; } if I would remove this then melon explodes when it touches something BUT it just drops to the ground like a brick and so can't be thrown anymore, been trying to find a workaround but can't really find it. argument for solid_bbox is good afaik, so it's either has to do with the false/true values I think, but changing them didnt seem to change anything.. AT ALL. so any advice on what to do? ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
Add this line. It will get vphysics to generate touch functions for the grenade. > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Yorg Kuijs > Sent: Sunday, August 24, 2008 9:09 AM > To: Discussion of Half-Life Programming > Subject: Re: [hlcoders] grenade code > > ok been trying out more stuff and found the culprit: > it's: > > bool CGrenadeMelon::CreateVPhysics() > { > // Create the object in the physics system > VPhysicsInitNormal( SOLID_BBOX, 0, false ); VPhysicsGetObject()->SetCallbackFlags( VPhysicsGetObject()->GetCallbackFlags() | CALLBACK_GLOBAL_TOUCH | CALLBACK_GLOBAL_TOUCH_STATIC ); > return true; > } > > if I would remove this then melon explodes when it touches > something BUT it just drops to the ground like a brick and so > can't be thrown anymore, been trying to find a workaround but > can't really find it. > argument for solid_bbox is good afaik, so it's either has to > do with the false/true values I think, but changing them > didnt seem to change anything.. AT ALL. > > so any advice on what to do? > > ___ > To unsubscribe, edit your list preferences, or view the list > archives, please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
GREAT, that did it :) thank you very much! seems to work fine now gonna test it to more extent tommorow! again many thanks :D Jay Stelly schreef: > Add this line. It will get vphysics to generate touch functions for the > grenade. > > ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
so moved on and now trying to prevent people from throwing the grenade DURING the ready animation, for standard hl2 grenades the pin is pulled when you draw the grenade and you can throw it without even fully raising your arm. In my mod the pins gonna be pulled at the actual animation when you press lmb or rmb, I've been looking at the actual draw code but it seems I can't use that to get the same effect for the actual animation just before the throw. Also tried taking a look at bugbait, I think there's a small delay before you can squeeze again with bugbait so I though I might be able to use that somehow, but no luck on that either. So wondering if anyone else know some unused grenade like weapons that may have an example of this? ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
updating this found where I could probably do what I wanna do, but inexperienced as I am and without examples I have no idea how to do it let's take a look if( m_fDrawbackFinished ) { CBasePlayer *pOwner = ToBasePlayer( GetOwner() ); if (pOwner) { switch( m_AttackPaused ) { case GRENADE_PAUSED_PRIMARY: if( !(pOwner->m_nButtons & IN_ATTACK) ) { SendWeaponAnim( ACT_VM_THROW ); m_fDrawbackFinished = false; } break; case GRENADE_PAUSED_SECONDARY: if( !(pOwner->m_nButtons & IN_ATTACK2) ) { SendWeaponAnim( ACT_VM_THROW ); m_fDrawbackFinished = false; } break; default: break; } } } now at both grenade paused primary and secondary the same animation is used and its just the same attack, there's no alternate attack so I just made it the same rather then pushing the secondary button and nothing happens. I think code I would need to add would probably be specifically placed in here: { SendWeaponAnim( ACT_VM_THROW ); m_fDrawbackFinished = false; } but don't know what exactly, basically just something that PREVENTS throwing the grenade while the animation is playing, so throwing disabled until the actual ready throw animation is done(I think its ACT_VM_PULLBACK_HIGH which is placed in the functions PrimaryAttack and SecondaryAttack) once the animation is done it can still be held paused for as long as the player wants like the standard grenades. > so moved on and now trying to prevent people from throwing the grenade > DURING the ready animation, for standard hl2 grenades the pin is pulled > when you draw the grenade and you can throw it without even fully > raising your arm. > In my mod the pins gonna be pulled at the actual animation when you > press lmb or rmb, I've been looking at the actual draw code but it seems > I can't use that to get the same effect for the actual animation just > before the throw. > > Also tried taking a look at bugbait, I think there's a small delay > before you can squeeze again with bugbait so I though I might be able to > use that somehow, but no luck on that either. > > So wondering if anyone else know some unused grenade like weapons that > may have an example of this? > > ___ > To unsubscribe, edit your list preferences, or view the list archives, please > visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > No virus found in this incoming message. > Checked by AVG - http://www.avg.com > Version: 8.0.138 / Virus Database: 270.6.7/1632 - Release Date: 25-8-2008 7:05 > > > > ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
ok back again and found out a bit more I'm thinking I was initially wrong when I thought only NPC's use Events but I think its actually so that Activities are linked to Events and in the events the coder can then specifiy specific code stuff that a modeller can't do with it. so I think I have to be here: case EVENT_WEAPON_SEQUENCE_FINISHED: m_fDrawbackFinished = true; break; in the qc file its determined what event is linked to the activity(the animation name that the code uses to find the animation name from the model files) event 3900 is EVENT_WEAPON_SEQUENCE_FINISHED as seen above and is this as Nauz specified in the qc file 1) $sequence drawbackhigh "watermelon_drawhigh" activity ACT_VM_PULLBACK_HIGH 1 fps 24 { frames 0 35 } { event 3900 4 } so animation name = watermelon_drawhigh but the activity is called ACT_VM_PULLBACK_HIGH(which is what the code uses) and it uses the event 3900 which is EVENT_WEAPON_SEQUENCE_FINISHED so it seems that as soon as animation drawhigh starts it counts the grenade ready to throw(cause it then reads DrawBackFinished = true which means its ready to throw, therefore you can throw the grenade because it doesnt tell it to wait for the end of the animation! so now I need a way to tell it in the code to say: HEY WAIT UNTIL IT ENDS then DrawbackFinished = true rather then hey animation starts, drawbackfinished = true oh lol you can throw now even though you havent pulled the pin yet .. yeah im rambling. but I think i'm close now! just have no idea how to tell it to wait for the end of the animation.. ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
I haven't followed the discussion from the beginning, so I don't know where you are in the code, but you seem to be talking about grenades, so typically if you want to wait until the end of an animation you do sth like: SetWeaponIdleTime( gpGlobals->curtime + SequenceDuration() ); or m_fNextTimeToDoWhateverYouWant = gpGlobals->curtime + SequenceDuration(); SequenceDuration() gives you the duration of the current selected animation, so call this after you just set that animation. hth > ok back again and found out a bit more > I'm thinking I was initially wrong when I thought only NPC's use Events > but I think its actually so that Activities are linked to Events and in > the events the coder can then specifiy specific code stuff that a > modeller can't do with it. > > so I think I have to be here: > case EVENT_WEAPON_SEQUENCE_FINISHED: > m_fDrawbackFinished = true; > break; > > in the qc file its determined what event is linked to the activity(the > animation name that the code uses to find the animation name from the > model files) > > event 3900 is EVENT_WEAPON_SEQUENCE_FINISHED as seen above and is this > as Nauz specified in the qc file > > 1) $sequence drawbackhigh "watermelon_drawhigh" activity > ACT_VM_PULLBACK_HIGH 1 fps 24 { frames 0 35 } { event 3900 4 } > > so animation name = watermelon_drawhigh but the activity is called > ACT_VM_PULLBACK_HIGH(which is what the code uses) and it uses the event > 3900 which is EVENT_WEAPON_SEQUENCE_FINISHED > > so it seems that as soon as animation drawhigh starts it counts the > grenade ready to throw(cause it then reads DrawBackFinished = true which > means its ready to throw, therefore you can throw the grenade because it > doesnt tell it to wait for the end of the animation! > > so now I need a way to tell it in the code to say: HEY WAIT UNTIL IT > ENDS then DrawbackFinished = true > rather then hey animation starts, drawbackfinished = true oh lol you can > throw now even though you havent pulled the pin yet .. > > yeah im rambling. but I think i'm close now! just have no idea how to > tell it to wait for the end of the animation.. > ___ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
well been mucking around with the example you gave have this now: case EVENT_WEAPON_SEQUENCE_FINISHED: if ( gpGlobals->curtime > m_flTimeWeaponIdle ) { m_fDrawbackFinished = true; } break; and in PrimaryAttack(): m_flTimeWeaponIdle = gpGlobals->curtime + SequenceDuration(); instead of m_flTimeWeaponIdle = FLT_MAX; as far as I can tell that should do it as well? not so sure about the curtime > m_fllTimeWeaponIdle though.. seems like that says if current time has passed weapon idle time then drawbackfinished = true .. but it doesn't work, any idea if I'm doing it right? ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
{ event 3900 4 } The number after the event number is the frame when the event should be fired. It looks like the last frame in your animation is 35 so write: { event 3900 35 } -- Tim Baker -- > ok back again and found out a bit more > I'm thinking I was initially wrong when I thought only NPC's use Events > but I think its actually so that Activities are linked to Events and in > the events the coder can then specifiy specific code stuff that a > modeller can't do with it. > > so I think I have to be here: > case EVENT_WEAPON_SEQUENCE_FINISHED: > m_fDrawbackFinished = true; > break; > > in the qc file its determined what event is linked to the activity(the > animation name that the code uses to find the animation name from the > model files) > > event 3900 is EVENT_WEAPON_SEQUENCE_FINISHED as seen above and is this > as Nauz specified in the qc file > > 1) $sequence drawbackhigh "watermelon_drawhigh" activity > ACT_VM_PULLBACK_HIGH 1 fps 24 { frames 0 35 } { event 3900 4 } > > so animation name = watermelon_drawhigh but the activity is called > ACT_VM_PULLBACK_HIGH(which is what the code uses) and it uses the event > 3900 which is EVENT_WEAPON_SEQUENCE_FINISHED > > so it seems that as soon as animation drawhigh starts it counts the > grenade ready to throw(cause it then reads DrawBackFinished = true which > means its ready to throw, therefore you can throw the grenade because it > doesnt tell it to wait for the end of the animation! > > so now I need a way to tell it in the code to say: HEY WAIT UNTIL IT > ENDS then DrawbackFinished = true > rather then hey animation starts, drawbackfinished = true oh lol you can > throw now even though you havent pulled the pin yet .. > > yeah im rambling. but I think i'm close now! just have no idea how to > tell it to wait for the end of the animation.. > ___ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
ohhh me and my modeller were already wondering what 4 ment! we'll give it a shot! thanks! ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
well he tried it and it worked so thanks! spent several days on this and now it turns out his fault :P I believe its time to give him a spanking.. nah kidding many thanks though :) ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
hey List, back again with another problem now trying to start off the detonation off grenades when the pull is pinned through events, I first tested it by starting the countdown sound in the event and that worked, doing the timer proves more troublesome. I'm currently working in weapon_superfrag.cpp which is very similar to the regular weapon_frag.cpp I declared it in the public of the class among : #ifndef CLIENT_DLL void Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatCharacter *pOperator ); voidSetTimer( float detonateDelay, float warnDelay ); #endif HandleAnimEvent is for the events, I've added the SetTimer which correctly sees it as coming from CGrenadeSuperFrag from grenade_superfrag.cpp in the event itself I have placed: SetTimer( GRENADE_TIMER, GRENADE_TIMER - 1.5f ); the first GRENADE_TIMER is the time until detonate and the second one is AI warn time(which doesnt really matter since its a multiplayer mod with no npc's but this is default stuff basically) but I get the following error: error LNK2019: unresolved external symbol "public: void __thiscall CWeaponSuperFrag::SetTimer(float,float)" ([EMAIL PROTECTED]@@[EMAIL PROTECTED]) referenced in function "public: virtual void __thiscall CWeaponSuperFrag::Operator_HandleAnimEvent(struct animevent_t *,class CBaseCombatCharacter *)" ([EMAIL PROTECTED]@@UAEXPAUanimevent_t@@PAVCBaseCombatCharacter@@@Z) weapon_superfrag.obj if I remember well it has something to do with doing something wrong with including or declaring something or whatever but I have no idea what hehe soo any wise advice/help would be appreciated. ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
If you are declaring SetTimer in the class def, are you actually providing a body for that method? Yorg Kuijs wrote: > hey List, > > back again with another problem > now trying to start off the detonation off grenades when the pull is > pinned through events, I first tested it by starting the countdown sound > in the event and that worked, doing the timer proves more troublesome. > > I'm currently working in weapon_superfrag.cpp which is very similar to > the regular weapon_frag.cpp > I declared it in the public of the class among : > #ifndef CLIENT_DLL > void Operator_HandleAnimEvent( animevent_t *pEvent, > CBaseCombatCharacter *pOperator ); > voidSetTimer( float detonateDelay, float warnDelay ); > #endif > > HandleAnimEvent is for the events, I've added the SetTimer which > correctly sees it as coming from CGrenadeSuperFrag from > grenade_superfrag.cpp > > in the event itself I have placed: > SetTimer( GRENADE_TIMER, GRENADE_TIMER - 1.5f ); > > the first GRENADE_TIMER is the time until detonate and the second one is > AI warn time(which doesnt really matter since its a multiplayer mod with > no npc's but this is default stuff basically) > > but I get the following error: > error LNK2019: unresolved external symbol "public: void __thiscall > CWeaponSuperFrag::SetTimer(float,float)" > ([EMAIL PROTECTED]@@[EMAIL PROTECTED]) referenced in function "public: > virtual void __thiscall > CWeaponSuperFrag::Operator_HandleAnimEvent(struct animevent_t *,class > CBaseCombatCharacter *)" > ([EMAIL PROTECTED]@@UAEXPAUanimevent_t@@PAVCBaseCombatCharacter@@@Z) > weapon_superfrag.obj > > if I remember well it has something to do with doing something wrong > with including or declaring something or whatever but I have no idea > what hehe soo any wise advice/help would be appreciated. > > ___ > To unsubscribe, edit your list preferences, or view the list archives, please > visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
Body as in a function? in that case no if not I don't know what you mean ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
In the headers you declare functions. (head) intMyFunction(int AValue, char* A_Pointer); In a .cpp file you define the functions (bodies) intMyFunction(int AValue, char* A_Pointer) { if (A_Pointer) { return AValue/7; } return 0; } When you call a function from another function, but the first function has no body (no execuable code is written!) you get a linking error like the one you got. Have you written the code for SetTimer(); ? If not, do so. Otherwise the error is because you declared the calling spec or something nasty wrong. - Original Message - From: "Yorg Kuijs" <[EMAIL PROTECTED]> To: "Discussion of Half-Life Programming" Sent: Sunday, September 21, 2008 6:48 PM Subject: Re: [hlcoders] grenade code > Body as in a function? > in that case no > > if not I don't know what you mean > > ___ > To unsubscribe, edit your list preferences, or view the list archives, please > visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
ah wait it wasn't loading the SetTimer from GrenadeSuperFrag but from WeaponSuperFrag so hence it indeed didn't have a body, grenade_superfrag.h is included, anyway I can use the SetTimer from GrenadeSuperFrag in WeaponSuperFrag? I tried CGrenadeSuperFrag::SetTimer but says its not a class or namespace. ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
Perhaps you haven't defined CGrenadeSuperFrag and it really is called C_GrenadeSuperFrag or GrenadeSuperFrag? - Original Message - From: "Yorg Kuijs" <[EMAIL PROTECTED]> To: "Discussion of Half-Life Programming" Sent: Sunday, September 21, 2008 8:43 PM Subject: Re: [hlcoders] grenade code > ah wait it wasn't loading the SetTimer from GrenadeSuperFrag but from > WeaponSuperFrag so hence it indeed didn't have a body, > grenade_superfrag.h is included, anyway I can use the SetTimer from > GrenadeSuperFrag in WeaponSuperFrag? I tried CGrenadeSuperFrag::SetTimer > but says its not a class or namespace. > > ___ > To unsubscribe, edit your list preferences, or view the list archives, please > visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
it is defined and none of that even works would be better if I could mail the files to someone? ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
alright I think I fixed the previous problems but can't really test it yet. Right now in weapon_superfrag it does SetTimer bla bla bla and what is actually that timer is named m_flThrowTime in grenade_superfrag.cpp it uses m_flDetonateTime now what I need to make is m_flDetonateTime = m_flThrowTime so that it basically keeps counting from the timer that started before grenade was thrown(otherwise it would reset the timer when you throw it) I know weapon_superfrag can load things from grenade_superfrag because the header file is included, how would I handle this reversed? weapon_superfrag does NOT have a header file, also the m_flThrowTime is actually declared in weapon_basehlmpcombatweapon(or something like it) ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
Weapon_superfrag can't load things simply 'because the header is included'. In order to do things from weapon_grenade, weapon_superfrag needs to be a CHILD of weapon_grenade. For customizations, you then override functions with the same name, by adding the overriding functions into superfrag. If you want to make weapon_superfrag do something different from the normal one, you override the function you need to change so that it does the same code with different options. This is inheritance. -Tony -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Yorg Kuijs Sent: September-26-08 9:19 AM To: Discussion of Half-Life Programming Subject: Re: [hlcoders] grenade code alright I think I fixed the previous problems but can't really test it yet. Right now in weapon_superfrag it does SetTimer bla bla bla and what is actually that timer is named m_flThrowTime in grenade_superfrag.cpp it uses m_flDetonateTime now what I need to make is m_flDetonateTime = m_flThrowTime so that it basically keeps counting from the timer that started before grenade was thrown(otherwise it would reset the timer when you throw it) I know weapon_superfrag can load things from grenade_superfrag because the header file is included, how would I handle this reversed? weapon_superfrag does NOT have a header file, also the m_flThrowTime is actually declared in weapon_basehlmpcombatweapon(or something like it) ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
nevermind that, the earlier code of the timer starting in weapon_superfrag isn't working and been working on fixing that. I now have the following code in weapon_superfrag.cpp in(mind you that I put it in this event just for testing purposes): case EVENT_WEAPON_SEQUENCE_FINISHED: SetTimer( GRENADE_TIMER ); break; then on to the code in SetTimer: void CWeaponSuperFrag::SetTimer( float ThrowDelay ) { m_flThrowTime = gpGlobals->curtime + ThrowDelay; if( gpGlobals->curtime > m_flThrowTime ) { ThrowAfterDelay(); } } then the last function that is gonna eventually force a throw(right now I just want it to do what the EVENT normally does, to decide if the grenade is ready to throw or not, again for testing purposes): void CWeaponSuperFrag::ThrowAfterDelay() { m_fDrawbackFinished = true; } but in game the grenade just stays as DrawbackFinished = false and never moves to true. so any idea where it's going wrong? Tony Sergi schreef: > Weapon_superfrag can't load things simply 'because the header is > included'. In order to do things from weapon_grenade, weapon_superfrag > needs to be a CHILD of weapon_grenade. For customizations, you then > override functions with the same name, by adding the overriding > functions into superfrag. > > If you want to make weapon_superfrag do something different from the > normal one, you override the function you need to change so that it does > the same code with different options. This is inheritance. > > -Tony > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Yorg Kuijs > Sent: September-26-08 9:19 AM > To: Discussion of Half-Life Programming > Subject: Re: [hlcoders] grenade code > > alright I think I fixed the previous problems > but can't really test it yet. > Right now in weapon_superfrag it does SetTimer bla bla bla and what is > actually that timer is named m_flThrowTime > > in grenade_superfrag.cpp it uses m_flDetonateTime now what I need to > make is m_flDetonateTime = m_flThrowTime > so that it basically keeps counting from the timer that started before > grenade was thrown(otherwise it would reset the timer when you throw it) > > I know weapon_superfrag can load things from grenade_superfrag because > the header file is included, how would I handle this reversed? > weapon_superfrag does NOT have a header file, also the m_flThrowTime is > actually declared in weapon_basehlmpcombatweapon(or something like it) > > > > ___ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > ___ > To unsubscribe, edit your list preferences, or view the list archives, please > visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > > > No virus found in this incoming message. > Checked by AVG - http://www.avg.com > Version: 8.0.169 / Virus Database: 270.7.3/1693 - Release Date: 26-9-2008 7:35 > > ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] grenade code
hey List, me again. Got the grenade timer started on event and also have it forcing you to throw at detonate time. Timer continues on in the entity so that works now to. One problem left: Sometimes if I hold a grenade for a short time, then throw it, then press throw button again at exactly the same time that my grenade is playing the ready animation and the dropped grenade explodes, then the grenade being readied explodes as well. Though that shouldn't be possible it could also be it's somehow creating a second explosion at the thrower's location. Either way I'm not sure what's doing this Haven't ever used the debugger yet, will it help to use debugging? Also if anyone might have a clue but needs to see the code I'll be willing to send it. ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders