Hi! Welcome to the forum for Platinum Arts Sandbox Free 3D Game Maker. I currently have the forums locked as I am attempting to properly update them.

In the meantime please join the new Discord Server!

If you have any questions please e-mail me through the Platinum Arts website.

Sound when casting a spell?

Having issues not related to a specific Sandbox game mode? Get help here!
Please also read the rules for support when posting support requests.
Failure to comply with the forum rules may result in your topic being locked without resolution.
Locked
User avatar
kddekadenz
Member
Member
Posts: 423
Joined: July 17th, 2011, 11:02 am
Name: kdd
Contact:

Sound when casting a spell?

Post 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.
Kelgar is an advanced RPG beeing developed in Sandbox
Hirato
Developer
Developer
Posts: 689
Joined: May 30th, 2009, 1:23 pm
IRC Username: hirato

Re: Sound when casting a spell?

Post 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.
This is not a url, clicking it is pointless
User avatar
kddekadenz
Member
Member
Posts: 423
Joined: July 17th, 2011, 11:02 am
Name: kdd
Contact:

Re: Sound when casting a spell?

Post 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?
Kelgar is an advanced RPG beeing developed in Sandbox
User avatar
Sircameron
Member
Member
Posts: 62
Joined: March 6th, 2012, 9:13 pm
Name: Cameron
Location: Indiana

Re: Sound when casting a spell?

Post 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
Hirato
Developer
Developer
Posts: 689
Joined: May 30th, 2009, 1:23 pm
IRC Username: hirato

Re: Sound when casting a spell?

Post 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
This is not a url, clicking it is pointless
User avatar
kddekadenz
Member
Member
Posts: 423
Joined: July 17th, 2011, 11:02 am
Name: kdd
Contact:

Re: Sound when casting a spell?

Post 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?
Kelgar is an advanced RPG beeing developed in Sandbox
User avatar
kddekadenz
Member
Member
Posts: 423
Joined: July 17th, 2011, 11:02 am
Name: kdd
Contact:

Re: Sound when casting a spell?

Post 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
Kelgar is an advanced RPG beeing developed in Sandbox
User avatar
Sircameron
Member
Member
Posts: 62
Joined: March 6th, 2012, 9:13 pm
Name: Cameron
Location: Indiana

Re: Sound when casting a spell?

Post 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
User avatar
kddekadenz
Member
Member
Posts: 423
Joined: July 17th, 2011, 11:02 am
Name: kdd
Contact:

Re: Sound when casting a spell?

Post by kddekadenz »

Thank you for trying :)

Good idea to browse the source code. I will try to find a solution.
Kelgar is an advanced RPG beeing developed in Sandbox
Locked