Home   Help Search Login Register  

Author Topic: grenade  (Read 1946 times)

0 Members and 1 Guest are viewing this topic.

Offline 456820

  • Contributing Member
  • **
grenade
« on: 28 Oct 2005, 22:25:17 »
okay ive got some addon which in it makes a unit when thrown a grenade shout "Grenade" or "Fire in the hole" or something like that
but for some reason it aint working

i run the script from an event handler fired, it detects wheat weapon fired if a grenade runs 2 scripts one is my grenade script the other makes the grenade wait a few seconds before explosding
the first script the one that makes the grenade wait works its allways activated when i want it to
but my script isnt its on the end of the same line seperated with a ' ; ' which should work right ?

in my script i have this

Code: [Select]
_shooter = _this select 0

if (100 > random 100) then {goto "shout"}
EXIT

#shout
if (50 > random 100) then {_shooter say "gren1"} else {_shooter say "gren2"}
~1
_nade = nearestobject [_shooter,_ammotype]
~0.2
EXIT

i have [_man] thingy which should be in the script above named _shooter
then i want it to make a random chance which is now a 100 for test purposes, then it gives two sound files for the unit to say

the thing is i dont hear anything, but the grenade still waits before exploding
i have declared the sounds in the config.cpp which is in the addon

am i mising something
i get no errors but no sound either ? all i want is basically the unit to shout grenade when he throws a grenade if some one can make a script which would defianatley work please post it here and guidance of how to run it
im a total noob for addon scripting any script i try to do for an addon have either failed or i couldnt be bothered finishing it off

thanks

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:grenade
« Reply #1 on: 29 Oct 2005, 00:03:05 »
You could post the config entries of yours (the sounds part) because looking quickly at your sript there's really nothing wrong with it...
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline 456820

  • Contributing Member
  • **
Re:grenade
« Reply #2 on: 29 Oct 2005, 10:08:08 »
Code: [Select]
class CfgSounds
{
   class Gren1
   {
      name = "Gren1";
      sound[]={"\effects\sound\Gren1.ogg", db+50, 1.0};
      titles[] ={};
   };
   class Gren2
   {
      name = "Gren2";
      sound[]={"\effects\sound\Gren2.ogg", db+50, 1.0};
      titles[] ={};
   };
};

there you go thats how i did the sounds
by anychance do i need to use a path name in the script to call the sound
like
_shooter say "\effects\sound\gren1"
like that but htta shouldnt be needed becuase the sounds have been defined the the config ?

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:grenade
« Reply #3 on: 29 Oct 2005, 10:53:50 »
Hmm...

You could try to debug the script by checking with hint format or similar if the _shooter variable is valid..

The sounds should work just fine like that, I have used a bit similar stuff myself...

Annoying :-\


In any case, you should tag the adons you make according to the OFPEC Tag system, if you are going to release the addon publicly...
Using a tag of your own greatly deminishes the changes of variable/class name/etc. conflicts...
Just a pointer :)
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:grenade
« Reply #4 on: 29 Oct 2005, 13:43:48 »
Did you try to display just a simple "gren1" or "gren2" on screen
instead of playing the sound? That way you could debug wether
the sound is just not playing or the script lines don't get used.

Do the to sounds work anyway - are they available?

Try to play the sounds from a trigger's onAct field or from within any script you want.

Also try adding them through description.ext to a mission and test
them out.

Quote
im a total noob for addon scripting any script i try to do for an addon have either failed or i couldnt be bothered finishing it off

just for info: adding a sound by description.ext is already making
addons - it's the same, just temporary because it works only in
the mission - but it's an addon
Same goes for any external script - it's an addon - so don't say
you ain't got experience or success with addon making   ;)

Quote
_nade = nearestobject [_shooter,_ammotype]
~0.2
EXIT

Just out of curiosity - what you need this line for?
I asume the script is not finished yet, or you just posted
a shorter version, else this _nade = line would be rather useless.

~S~ CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Offline 456820

  • Contributing Member
  • **
Re:grenade
« Reply #5 on: 30 Oct 2005, 12:53:56 »
ahh forgot to take it out it was used before i edited that script slightly it was originally in my mission where it had a nother part to it which needed that line but i got rid of that extra part
the sounds work i use them in my missions
i dont have a stringtable with them cause i dont want any text just the sound being played
ill use some hints see if it is actually working