Home   Help Search Login Register  

Author Topic: i cant get my head around this  (Read 768 times)

0 Members and 1 Guest are viewing this topic.

Offline 456820

  • Contributing Member
  • **
i cant get my head around this
« on: 26 Jul 2005, 20:49:44 »
ive got some problem ive got these sound files they all play right, but thats not the problem
i want one sound to play by using playsound "sound name" - works fine
but ive got a load of these files corossponding with
Quote
ENEMY TANK
ENEMY INFANTRY
ENEMY APC
ENEMY MACHINE GUN EMPLACEMENT
ENEMY SNIPER
ENEMY OFFICER
ENEMY SPETZ NATZ

aswell as

Quote
north
north east
east
south east
south west
west
north west

aswell as aload of distances what one of my scripts do is find the
distance
type of unit
compass direction

these can all vary so i want to use variables to get what sound to play corresponding to what it equals ive seen this done before but i cant get my head around it for some reason
theres a script from the ed depot here it is

in that look for artillery_clickTarget
that does what im looking for but i cant get my head around how to get this to work
so im looking for a sligh push in the right direction
ive tried lots of times but i always get something like
sound not found
error in array etc etc

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:i cant get my head around this
« Reply #1 on: 26 Jul 2005, 21:17:22 »
seems like all it does is make an array of the sound names and decides which one to play.

so you need an array of enemy types -

Code: [Select]
en_type = ["ENEMY TANK","ENEMY INFANTRY","ENEMY APC","ENEMY MACHINE GUN EMPLACEMENT","ENEMY SNIPER","ENEMY OFFICER","ENEMY SPETZ NATZ"]

you need an array of distances and compass directions just like the one above.

then you need some complex 'if/then' statements to decide which ones you need, then you use

Code: [Select]
say_type = en_type select whichever
playsound say_type

say_distance = en_dist select whichever
playsound say_distance

say_direction = en_dir select whichever
playsound say_direction

untested, but that seems like how the example you gave does it.
« Last Edit: 26 Jul 2005, 21:18:26 by bedges »

Offline 456820

  • Contributing Member
  • **
Re:i cant get my head around this
« Reply #2 on: 27 Jul 2005, 08:12:34 »
ill have a go with that i did actually relise last night i could do something like
? _type == "Tank" : _sound == "Enemytank"
? _type == "infantry" : _sound == "Infantry"

something like that i could do it thatway but it would be a bit long cause ive got over 30 sounds due to all the distances

but ill have a go your way as well

thanks

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:i cant get my head around this
« Reply #3 on: 27 Jul 2005, 23:39:48 »
umm... didn't this already get answered in your other thread when i told you that that was how it was done in the other script...
 it will get a bit longwinded...
perhaps you could use an extra array and a loop
have an array of every type that you look  for, in the same order as the sounds for the types

_i = 0
#loop
?_type == (_type_array select _i):goto "next"
_i = _i + 1
goto "loop"

#next
_type_sound = (_type_sound_array select _i)

blah blah blah blah.....

Offline 456820

  • Contributing Member
  • **
Re:i cant get my head around this
« Reply #4 on: 28 Jul 2005, 08:30:29 »
in the other thread it kind of did i understood it but when i tried to get it to work ijust couldnt for some reason thanks for the help
ill have a go with this way