Forum

> > Carnage Contest > Execute Script Every turn[OK!]
Forums overviewCarnage Contest overviewLog in to reply

English Execute Script Every turn[OK!]

27 replies
Page
To the start Previous 1 2 Next To the start

old Execute Script Every turn[OK!]

thecode
User Off Offline

Quote
Hello!
In game mod, i want to do an action every player turn.
Like the deadmatch mod(water grow).
Thank you.
edited 1×, last 14.01.11 10:19:12 pm

old Re: Execute Script Every turn[OK!]

DC
Admin On Online

Quote
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)

old Re: Execute Script Every turn[OK!]

DC
Admin On Online

Quote
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)

old Re: Execute Script Every turn[OK!]

DC
Admin On Online

Quote
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.

old Re: Execute Script Every turn[OK!]

TimeQuesT
User Off Offline

Quote
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!

old Re: Execute Script Every turn[OK!]

thecode
User Off Offline

Quote
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
edited 1×, last 14.01.11 06:37:34 pm

old Re: Execute Script Every turn[OK!]

DC
Admin On Online

Quote
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.

old Re: Execute Script Every turn[OK!]

DC
Admin On Online

Quote
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!
To the start Previous 1 2 Next To the start
Log in to replyCarnage Contest overviewForums overview