Forum

> > Carnage Contest > Execute Script Every turn[OK!]
ForenübersichtCarnage Contest-ÜbersichtEinloggen, um zu antworten

Englisch Execute Script Every turn[OK!]

27 Antworten
Seite
Zum Anfang Vorherige 1 2 Nächste Zum Anfang

alt Execute Script Every turn[OK!]

thecode
User Off Offline

Zitieren
Hello!
In game mod, i want to do an action every player turn.
Like the deadmatch mod(water grow).
Thank you.
1× editiert, zuletzt 14.01.11 22:19:12

alt Re: Execute Script Every turn[OK!]

DC
Admin Off Offline

Zitieren
where did you put this code? you have to create an object for that.

(or to script your own game ender which will be possible in the next release)

alt Re: Execute Script Every turn[OK!]

DC
Admin Off Offline

Zitieren
oh totally forgot about game modes...

it has to be in the function called YOURGAMEMODENAME_gm_update() then.

(with YOURGAMEMODENAME = name of your game mode)

alt Re: Execute Script Every turn[OK!]

DC
Admin Off Offline

Zitieren
are you sure that you used the cc cmd getframe condition that Vectar666 mentioned? impossible that your code is executed more often than one time that way (because getframe will return each number only once since the frame is increased each update cycle)

please provide your script otherwise.

alt Re: Execute Script Every turn[OK!]

TimeQuesT
User Off Offline

Zitieren
so:
create a new file in the "scripts/lua" folder and save it under the name "mymod.lua"


Spoiler >

when you created this file and saved all you have to run the game --> host --> host--> right down corner "gamemode" click at the "+" til your name of the gamemode appears. Then start the map and you will see it works if you done everything correctly!

alt Re: Execute Script Every turn[OK!]

thecode
User Off Offline

Zitieren
TimeQuesT,thank but i know and is not my first time to script with lua.
I have try getframe but the effect do every seconde.
EDIT:
For exemple i do this:

function waterdeaad_gm_update()

if getframe()==1 then
watery(math.random(-0.01,-0.001))
end
     
end
1× editiert, zuletzt 14.01.11 18:37:34

alt Re: Execute Script Every turn[OK!]

DC
Admin Off Offline

Zitieren
are you sure that your game mode is called waterdeaad with two a?

also see cc cmd watery
the way you are using it seems pretty pointless to me (watery expects an absolute y-position for the new water level)

calling it your way will make it instantly flood the whole map. which probably makes you think that the command is called all the time. which is not the case.

alt Re: Execute Script Every turn[OK!]

DC
Admin Off Offline

Zitieren
that's impossible. I just tested it myself and it works perfectly fine if you are using the if getframe()==1 condition and the update function. it will only be executed once per turn.

you either didn't do it exactly this way or a strange super virus is messing with you! watch out!
Zum Anfang Vorherige 1 2 Nächste Zum Anfang
Einloggen, um zu antwortenCarnage Contest-ÜbersichtForenübersicht