News:

One Minute Game Review by The Happy Friar: https://ugetube.com/@OneMinteGameReviews
Also on Rumble: https://rumble.com/c/c-1115371

idTech 4 (aka Doom 3 tech) Discord Server! https://discord.gg/9wtCGHa

Main Menu

Multiple running script

Started by bitterman, January 25, 2018, 10:04:18 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bitterman

Let trigger_multiply call a script which begin some actions with some entity.

What happen if the player still stand in trigger zone?
Is this script will be started again?
But if entity is already in action? Is script must set some flag and prevent multiply instances?

Is there a native flags/commands like "isTriggered" etc?

Thanks.

Snehk

I think that trigger_multiple won't trigger again until player leaves it and then walks on/touches it again. I might be wrong though, and in such case it would re-trigger after the set delay is over.

bitterman

Thanks, Snehk

I make a script with one line

sys.println( "trigger" );

If player standing in trigger zone this message send to console at intervals approx. one second.

There is a "wait" k/v for trigger and it can give behavior which you describe above.

So, must be other solution.



bitterman

It's works fine with trigger_once but only one time.

Don't know how to reset trigger_once.

motorsep

trigger_multiple triggers several things all at once

The Happy Friar

def file also says it is a repeatable trigger.  trigger_multiple & once both are the same spawnclass & the def for trigger_once defaults a wait of "-1" which means only trigger once.  So it's just a def that defaults to triggering once but can be used multiple times.

bitterman

#6
Thanks!

Now I'm going deeper and trying to use trigger_multiple which running once and then retriggered via script.

Related question - can I set any custom spawnArgs in entity on the map (and use it in script via 'getKey') or they are predefined? Is there any restrictions?

Thanks!

The Happy Friar

You can set any spawnargs you want to the entity & only the recognizable ones will be used by the game.  So, if you have a trigger with the spawnarg "stupid 1" & used "getkey" on "stupid" it should result in 1. 

I haven't tested this in a while but I want to say I've done it before to store values in entities.

bitterman

#8
Good naming, thanks ;)

********* upd

I'm look at Trigger.cpp and looks like trigger just removed if 'wait' <= 0 or reset after waiting if 'wait' > 0 (0.5 by default).

I don't see any other way to control trigger's reset. It works like 'pew-pew-pew' ))


The Happy Friar

Well, normally triggers activate something, use a script that every X seconds checks for a condition & when the condition is met, activate whatever the trigger would.  If you want multiple things activated at once have the script call a trigger_relay.

Should work.

bitterman

#10
This is what I trying to achieve:

When the player step into trigger zone around an interactive object this trigger shows a label on the top of this object (ent.show()).

This part works fine for me.

Then player goes out of trigger zone (ent.hide()). This is works too.

But then player back into trigger zone. Here is the problem: if it trigger_once then it already removed after fired.
If it trigger_multiple then label will blink when player stay still into zone.

In fact I trying to get inactivate triggger and retrigger it at the end of script (if player leave trigger zone then retrigger for next case).

Sorry for wall of text )

The Happy Friar

instead of a trigger you could use a check in a script to check player distance to a location.  If/then to decide how to handle it.

Or have a check to see if the object is already showing, maybe with storing a key/val in the player entity.  If showing then it skips most of the script again (again, if/then statement).

bitterman

#12
Then it should be like:

alreadyShown = label.getKey("alreadyShown");
...
if (!alreadyShown) { label.show(); }


Looks nice.

************** upd

There is a native flag:
if ( isHidden ) { label.show( ); }