Page 1 of 1

Sound when casting a spell?

Posted: March 31st, 2012, 11:25 am
by kddekadenz
I'm quite confused:
I want to add a custom sound when casting a spell, but I don't know how to do this.
Please answer as fast as possible.

Re: Sound when casting a spell?

Posted: March 31st, 2012, 8:21 pm
by Hirato
I assume you want help with the RPG...

What I've done is more of a hack. I'm not sure how to approach doing it properly so that method has been there for a while...
So keep in mind this may change in the future!

Basically, the items in question as well as the attacker receive an "attacksound" signal when they attack.
So just invoke the sounds there using r_sound.

Code: Select all

r_script_signal "attacksound" [
    r_setref reference_to_optional_entity actor
    r_sound "path/to/sound" reference_to_optional_entity
]
Just let the player play a few grunts if you want and give the weapon's use a swish or something.

Re: Sound when casting a spell?

Posted: April 7th, 2012, 1:56 pm
by kddekadenz
Hirato wrote:I assume you want help with the RPG... [...]

Code: Select all

r_script_signal "attacksound" [
    r_setref reference_to_optional_entity actor
    r_sound "path/to/sound" reference_to_optional_entity
]
[...]
Yes, forgot to mention it :)
I do not understand the 'reference_to_optional_entity' part.
If I have a item with the id 8 as reference, how this part should be like?

Re: Sound when casting a spell?

Posted: April 7th, 2012, 4:50 pm
by Sircameron

Code: Select all

 setref ENT_ITEM 8 actor
just a guess, but maybe that might bring you to the correct way if i am wrong

Re: Sound when casting a spell?

Posted: April 7th, 2012, 8:24 pm
by Hirato
kddekadenz wrote:
Hirato wrote:I assume you want help with the RPG... [...]

Code: Select all

r_script_signal "attacksound" [
    r_setref reference_to_optional_entity actor
    r_sound "path/to/sound" reference_to_optional_entity
]
[...]
Yes, forgot to mention it :)
I do not understand the 'reference_to_optional_entity' part.
If I have a item with the id 8 as reference, how this part should be like?
It gives the sound a source, which means it will provide some vague sense of direction and distance.
You could just write it as follows: r_sound "path/to/sound" actor
but I used that r_setref there to explain it a bit better

Re: Sound when casting a spell?

Posted: April 8th, 2012, 11:55 am
by kddekadenz
Hirato wrote:It gives the sound a source, which means it will provide some vague sense of direction and distance.
You could just write it as follows: r_sound "path/to/sound" actor
but I used that r_setref there to explain it a bit better
So I could make the sound follow something?

Re: Sound when casting a spell?

Posted: April 13th, 2012, 11:11 am
by kddekadenz
Can I get the wielded item(s) of a actor? Or at least of the player?

Offtopic: PAS needs a better documentation - I think I will improve it when I have time

Re: Sound when casting a spell?

Posted: April 13th, 2012, 12:45 pm
by Sircameron
Found getequip() in the rpgscript.ccp so it should be possible. I'll play around with it tonight after work. I dont know if it references a certain slot or what at this point.. Hope that helps
***Edit***
sorry i'm stumped 2.5 hrs and ive got nothing.. Not even an idea on how you could do this. Other than if you could get the weapons to set a specific variable when equipped, then ref that number for your sound in a list.. Goodluck

Re: Sound when casting a spell?

Posted: April 14th, 2012, 11:52 am
by kddekadenz
Thank you for trying :)

Good idea to browse the source code. I will try to find a solution.