Forum

> > CS2D > Scripts > Call a function from an if entity
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Call a function from an if entity

3 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Call a function from an if entity

Mami Tomoe
User Off Offline

Zitieren
Hi guys, today I have a problem but first let me claim this:
I know 0% about this entity and I never used it, also I searched for a solution but found none (maybe searched for the wrong thing...).

How can I call a function from an if entity?

at, mapname.lua:
1
2
3
function fn()
     msg("test")
end

How to call fn() from the if entity? I don't want the function to be in the if statement I just want to call it.

alt Re: Call a function from an if entity

GeoB99
Moderator Off Offline

Zitieren
You could also use
dofile
to call the script (NOTE: it will trigger every function if you have multiple routines). The syntax has to be in this way:
1
dofile('LuaPath')

alt Re: Call a function from an if entity

Mami Tomoe
User Off Offline

Zitieren
user HPB hat geschrieben
What? Do you mean cs2d entity trigger_if? Simply write
fn()
on the text box field. The function will called by cs2d entity trigger_if when it's triggered. Don't worry with the
if
statement.


Thanks it worked and that's what I figured out that to use the trigger I need to return true on the function
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht