I would want to ensure creating a game variable (same value for everyone but random per game session) before gadgets and unitdefs(post) load so i can use it there and rely on it being initialized already. If possible i would even have loading screens based on that value. Any suggestions?
Joined: 22 Feb 2006, 01:02 Location: cheap kitchen
not sure what you mean.. in function gadget:GetInfo() you have the layer= <some number> thing, which defines order in which wupgets are loaded. So you can one have load first, then the others all after that one.
Quote:
a game variable (same value for everyone but random per game session)
I want to have a random (but same for everyone, also in replays) variable(like a special game mode) and based on that change stuff like -unit stats(this game all tank have double HP, or now you can also build experimental unit xyz which is added to this units build list) -enable certain gadgets(i.e. alternative victory condition) -change the spawned units at game start.(like start with not only a headquarter but also some tanks this time)
ideally I would like to show the currently active "special feature/game mode" while the game loads or in a popup window at game start (like zk does for commander selection)
Joined: 22 Feb 2006, 01:02 Location: cheap kitchen
math.random() will do fine in synced part. (not sure if it needs to be seeded somehow)
hm. it comes down to two things: 1) stuff you can do with normal gadgets: eg en/disableing certain gadgets or spawning different startunits. To some extend you can change attributes of units, eg there is Spring.SetUnitMaxHealth (needs some scripting since it is per unitID, but nothing impossible hard) so some things do not _post.
2) stuff you can only do in bla_post.lua: eg changing the movement class of a unit.
I think there is no way to pass stuff from unitdef_post to ingame lua, except for the unitdefs themselves. But imo forget about doing much dynamic stuff in _post and use gadgets for everything. For the things listed you do not need _post, though editing buildlist is a bit tricky. (can not really edit the buildlist but only hide the buttons and block the unit creation)
I want to have a random (but same for everyone, also in replays) variable(like a special game mode) and based on that change stuff like -unit stats(this game all tank have double HP, or now you can also build experimental unit xyz which is added to this units build list) -enable certain gadgets(i.e. alternative victory condition) -change the spawned units at game start.(like start with not only a headquarter but also some tanks this time)
ideally I would like to show the currently active "special feature/game mode" while the game loads or in a popup window at game start (like zk does for commander selection)
1) Randomize the unit stats in unitdefspost. 2) Make a central gadget with low layer that controls victory conditions. Use setgamrulesparam in it and other gadgets will function by checking getgamerulesparam. 3) This gadet will also check unitdefs to see what happened in step 1. 4) It can spawn start units as you please. 5) Make a widget that reads getgamerulesparam and displays a window of information.
Users browsing this forum: Google [Bot] and 1 guest
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum