EntityPlus: testing botspawn deathtarget, and target_speaker

Discussion for Level editing, modeling, programming, or any of the other technical aspects of Quake
Post Reply
deqer
Posts: 298
Joined: Mon Dec 28, 2009 6:30 pm

EntityPlus: testing botspawn deathtarget, and target_speaker

Post by deqer »

Nevermind. I was not on g_gametype 8.

And I was told it's a known issue that cannot be done easily to stop a looped sound once it's been started.
User avatar
Eraser
Posts: 19177
Joined: Fri Dec 01, 2000 8:00 am

Re: EntityPlus: testing botspawn deathtarget, and target_speaker

Post by Eraser »

Not in vQ3 no, but you can in Entity Plus :)
deqer
Posts: 298
Joined: Mon Dec 28, 2009 6:30 pm

Re: EntityPlus: testing botspawn deathtarget, and target_speaker

Post by deqer »

ok, I give up. I need someone to show me how to do this.

how to trigger a target_speaker to play looped(i can already do this part), and be able to trigger it off again(this part doesn't work).

trigger ON works, but I can't trigger it OFF afterwards. I read your PM, but I still don't understand.
deqer
Posts: 298
Joined: Mon Dec 28, 2009 6:30 pm

Re: EntityPlus: testing botspawn deathtarget, and target_speaker

Post by deqer »

How it plays out is:
- Button triggers target_speakers (sound plays and loops) and botspawn and func_door(wait -2)
- Bot dies and it's deathtarget will target the same func_door(via "targetname"), and the same target_speakers(via "targetname2") (to turn off sound)

But, there's an issue:

1) The deathtarget did not execute the targetname2 of the target_speakers to turn off the sounds. The sounds did not turn off.

http://www.bport.ca/temp/krep01.zip (.pk3/.bsp)

---

This is what I have:

The Button:
// wait -2 = does not return.
{
"classname" "func_button"
"target" "room1"
"wait" "-2"
{ ... }
}

The Door
// spawnflags 1 = starts open.
{
"classname" "func_door"
"targetname" "room1door"
"targetname2" "room1"
"spawnflags" "1"
{ ... }
}

The Bot:
{
"classname" "target_botspawn"
"deathtarget" "room1door"
"targetname" "room1"
}

The Speakers:
// spawnflags 2 = looped_off
{
"classname" "target_speaker"
"targetname" "room1"
"targetname2" "room1door"
"spawnflags" "2"
"noise" "sound/krep01/combat_2_loop.wav"
}
// Speaker #2
{
"classname" "target_speaker"
"targetname" "room1"
"targetname2" "room1door"
"noise" "sound/krep01/combat_2_loop.wav"
"spawnflags" "2"
}
// Speaker #3
{
"classname" "target_speaker"
"targetname" "room1"
"targetname2" "room1door"
"spawnflags" "2"
"noise" "sound/krep01/combat_2_loop.wav"
}
// Speaker #4
{
"classname" "target_speaker"
"targetname" "room1"
"targetname2" "room1door"
"noise" "sound/krep01/combat_2_loop.wav"
"spawnflags" "2"
}
User avatar
Eraser
Posts: 19177
Joined: Fri Dec 01, 2000 8:00 am

Re: EntityPlus: testing botspawn deathtarget, and target_speaker

Post by Eraser »

First of all, are you running EntityPlus v0.8.1 and not still 0.8? You can see this in the readme.txt or the version history.txt.

If you are, then it should just be a case of having a trigger_multiple (or something that triggers other entities) target the target_speaker, set the speaker's LOOPED_ON or LOOPED_OFF spawnflag, set its noise key and when you run through the trigger_multiple, the target_speaker should be toggled on or off.

If you aren't running v0.8.1 then download that from the entityplus project website because versions prior to that still relied on the standard vanilla Quake 3 code which indeed does have the behavior you describe due to a bug.

edit:
hadn't seen that you posted the .map code yet. I'll take a look at it.
User avatar
Eraser
Posts: 19177
Joined: Fri Dec 01, 2000 8:00 am

Re: EntityPlus: testing botspawn deathtarget, and target_speaker

Post by Eraser »

Ahh, you've run into a bug (or rather, an oversight). The "deathtarget" key only triggers entities with a similar "targetname" key and not those with a similar "targetname2" key. This is an error and I will correct it. For now you could try swapping all the targetname and targetname2 values on the speakers.
deqer
Posts: 298
Joined: Mon Dec 28, 2009 6:30 pm

Re: EntityPlus: testing botspawn deathtarget, and target_speaker

Post by deqer »

Eraser wrote:Ahh, you've run into a bug (or rather, an oversight). The "deathtarget" key only triggers entities with a similar "targetname" key and not those with a similar "targetname2" key. This is an error and I will correct it. For now you could try swapping all the targetname and targetname2 values on the speakers.
I see.

I did not know it was specific like that; that "targetname2" can only work from a "target2" and not "target" or "target3", etc. etc.
Eraser wrote:This is an error and I will correct it.
Is it really an error though?

From what I've learned recently, I would now say that technically "deathtarget" should target a specific targetname--just like the "target" and "target2" do.), therefore the deathtarget's targetname would perhaps be called something like "deathtargetname" for example. Right?

From a programming perspective, perhaps it's easier for you to link "deathtarget" to "targetname" or "targetname2" on a mass scale for many entities, rather adding a new key "deathtargetname" on a mass scale to many entities. I'm not sure.
deqer wrote:---
With my recent understanding of all this, I attempted to fix my issue. I changed my target_speakers and botspawn targets/targetnames, etc.

It worked--the music and the door were triggered again. But, an error happened where the target_botspawn would target itself. Error screen/console message: "WARNING: Entity used itself."

Here is what I have now:
The Button:
// wait -2 = does not return.
{
"classname" "func_button"
"target" "room1"
"wait" "-2"
{ ... }
}

The Door
// spawnflags 1 = starts open.
{
"classname" "func_door"
"targetname" "room1"
"spawnflags" "1"
{ ... }
}

The Bot:
{
"classname" "target_botspawn"
"deathtarget" "room1"
"targetname" "room1"
}

The Speakers:
// spawnflags 2 = looped_off
{
"classname" "target_speaker"
"targetname" "room1"
"spawnflags" "2"
"noise" "sound/krep01/combat_2_loop.wav"
}

I was lucky that the bot did not execute itself again after it dies. So, I do indeed understand that the logic I used is kind of wrong, where I set target and targetname to the same value, on target_botspawn.

I feel as though I need a deathtarget2 for trigger_botspawn. Yes, yes, can I have deathtarget2/deathtargetname2 for all entities? :D
deqer wrote:---
So, I tried changing it around a bit in order to avoid that conflict "Entity used itself.", but then I ran into another issue where target2/targetname2 does not work from func_button to target_speaker

Here is what it looks like:
The Button:
// wait -2 = does not return.
{
"classname" "func_button"
"target" "room1"
"target2" "room1door"
"wait" "-2"
{ ... }
}

The Door
// spawnflags 1 = starts open.
{
"classname" "func_door"
"targetname" "room1"
"targetname2" "room1door"
"spawnflags" "1"
{ ... }
}

The Bot:
{
"classname" "target_botspawn"
"deathtarget" "room1"
"targetname2" "room1door"
}

The Speakers:
// spawnflags 2 = looped_off
{
"classname" "target_speaker"
"targetname" "room1"
"targetname2" "room1door"
"spawnflags" "2"
"noise" "sound/krep01/combat_2_loop.wav"
}

The func_button "target2" did not trigger the target_speaker, or func_door. it did (worked correctly) the trigger_botspawn though.

The trigger_botspawn "deathtarget" worked correctly for the target_speaker, and func_door. But, since the "target2" did not work initially, then the music and door were opposite sync (music turned on; door opened, instead of closing, etc.), blah blah.

So, it seems that "targetname2" does not work at all, for target_speaker for example. Is that another bug?
deqer wrote:---
TLDR:
The button will trigger the bot, and music. But, killing the bot must trigger the music again, therefore we need some target/target2 functionality--associated with deathtarget functionality.

Assuming my correct understanding of the standard convention used, then I recommend that we add "deathtargetname" to all entities, and associate "deathtargetname" with "deathtarget" only. "deathtarget" must not target "targetname" or "targetname2", because that becomes complex in programming/logic for some scenarios.

I request a "deathtarget"/"deathtargetname2" system on all entities, so that I can trigger the same music (to stop it) again but not trigger the same bot again because the same targetname is being used for the bot and the music.

---
Last edited by deqer on Sun Aug 28, 2011 3:43 am, edited 2 times in total.
deqer
Posts: 298
Joined: Mon Dec 28, 2009 6:30 pm

FIXED: EntityPlus: botspawn deathtarget, and target_speaker

Post by deqer »

Okay,

I fixed it. I gave the trigger_botspawn it's own unique name for targetting, and I used target #2 for it.

Code:
The Button:
// wait -2 = does not return.
{
"classname" "func_button"
"target" "room1"
"target2" "room1bot"
"wait" "-2"
{ ... }
}

The Bot:
// (removed "targetname" "room1")
{
"classname" "target_botspawn"
"deathtarget" "room1"
"targetname2" "room1bot"
}

So, this works because I think trigger_botspawn has support for "targetname2" as opposed to target_speaker (mentioned earlier above)
deqer
Posts: 298
Joined: Mon Dec 28, 2009 6:30 pm

Re: EntityPlus: trigger_relay count

Post by deqer »

So, I fixed it (above), but furthermore to what happens when bot dies, I wanted to play a combat_won sound well at the same time the combat_loop music ends.

When trying to use target_logic, I could not do it because the botspawn's deathtarget was the same value as the combat_loop music's targetname; it was a conflict.

So, I looked and found out about trigger_relay. With trigger_relay, I could set the targetname to the same as everything else and simply use a "count" of "2"

This worked. The trigger_relay executed/targetted a different target_speaker to play combat_won sound after it was triggered "2" times (by the button target, and by the deathtarget).

I felt cool afterwards, so I decided to share this with you.
User avatar
Eraser
Posts: 19177
Joined: Fri Dec 01, 2000 8:00 am

Re: EntityPlus: testing botspawn deathtarget, and target_speaker

Post by Eraser »

Good that it worked out in the end, but your assumptions regarding target/target2/targetname/targetname2/deathtarget are wrong. target, target2 and deathtarget aren't directly linked to targetname or targetname2.

For instance if you have a trigger with target "blah", then it'll trigger all entities that have either its targetname or its targetname2 set to "blah".
In case of a target_botspawn, if you set its deathtarget to "mybot" then all entities with either a targetname of "mybot" or a targetname2 of "mybot" will be activated by the bot's death.

Not sure what you've been doing with the targetnames. All I meant to say is that you should swap the values for "targetname" and "targetname2" on your target_speaker entities. When the next release of the mod is out, this problem will be fixed and it won't matter if you use targetname or targetname2 on your target_speakers.
Post Reply