Re: Dynamic Script Usage
Another example what dynamic scipting can do! The GIF below shows an accelerated minimap (about 15 minutes). Does anyone notice anything unusual?

Another example what dynamic scipting can do! The GIF below shows an accelerated minimap (about 15 minutes). Does anyone notice anything unusual?
Posts: 3822
Joined: 16 Sep 2007, 22:00
KaM Skill Level: Skilled
ICQ: 269127056
Website: http://lewin.hodgman.id.au
Yahoo Messenger: lewinlewinhodgman
Location: Australia
QUESTION 1
I'm experimenting with custom sounds now, specifically the PlayWAVAtLocation. It says that only mono sounds are supported. However, stereo works just fine, although it is not projected on the left or right channel. Mono sounds are projected left or right, but they are extremely low in volume. I've tried if the volume parameter (0.0 - 1.0) was maybe to 100 but that doesn't work either. Setting different sample rates (22.500 or 44.100 hertz) or bit depths (8 or 16 bit) has no influence as well.
How can I increase the volume of these mono sounds? Currently they are just not loud enough, so I am forced to use a stereo sound. But then I loose the left-right projection. The sound I have is normalized to about 0.0 dB (maximum volume before clipping).
QUESTION 2
Suppose a multiplayer setting of team 1 = player 1-4, and team 2 = player 5-8. If I use FogCoverCircle or FogRevealCircle to change the fog for player 1, and PlayerShareFog(player1, player 2-4) = true (which is the default setting I believe), is the fog for player 2, 3 and 4 automatically updated?
QUESTION 3
Posed earlier: is there a way to remove or kill animals?
Only mono sounds can be played at a position on the map, this is an OpenAL limitation, which makes sense when you think about it: if you wanted stereo you could place two sounds next to each other with a small gap (otherwise how does it know how far apart the channels should be?)
The volume gets reduced a bit for sounds that are positioned on the map, because the OpenAL listener is a small distance away from it (non-positional sounds are played right in the listener's ears). But all KaM positional sounds have this limitation and they're loud enough, so maybe you can increase the volume of the WAV further?
Posts: 3822
Joined: 16 Sep 2007, 22:00
KaM Skill Level: Skilled
ICQ: 269127056
Website: http://lewin.hodgman.id.au
Yahoo Messenger: lewinlewinhodgman
Location: Australia
I just checked the source code, it turns out that death sounds play at volume 4.0 (but the max you can use from the script is 1.0). We'll unlock this for the next release because as you've found positional sounds need to be boosted. Thanks for your help
Castle Guard Swordsman
Posts: 1912
Joined: 03 Oct 2008, 22:00
KaM Skill Level: Skilled
Location: "Pawel95" on Youtube.com
Maybe it is wise to still set a maximum because otherwise you might end up getting super loud sounds.
Procedure CheckSchools;
var
PlayerWalker, HouseArray, HouseWalker, ThisSchool: integer;
begin
for PlayerWalker := PLAYER_2 to PLAYER_4 do begin // go through player 2, 3 and 4
HouseArray := States.PlayerGetAllHouses(PlayerWalker); // store all the houses of the player into HouseArray
for Housewalker := 0 to length(HouseArray) -1) //go through all houses in HouseArray
if States.HouseType(HouseArray[HouseWalker]) = SCHOOL then begin // check if the housetype is a school
ThisSchool := States.HouseArray[HouseWalker]; //store the school id into ThisSchool. Not necessary btw, you could also put this in the next line directly.
if States.HouseResourceAmount(ThisSchool, GOLD) >= 5 then begin // you asked for more than 4, but I made more or equal than 5 of it :-)
// FANCY STUFF HERE!
end;
end;
end;
end;
end;
Hi Islar, I'm not sure in what context you are going to use this. For simplicity, I assume you do this for single player and you are player 1. You want to know things about schools from player 2, 3 and 4. Gold comes into the schools the normal way To make your script easy to read, define some global constants first:
Now we need to make some sort of thing that checks the schools. We create a new procedure for that. In that procedure we need to ask:
- how many buildings do player 2-4 actually have?
- which of those are schools?
- how much gold does each school have?
- do something if there is more than 4 gold in it
Below is a procedure example that does this.
Finally, you only need to decide how often you want to check the schools and put it into OnTick. In the example below it is once every 2 seconds.
- Code:
Procedure CheckSchools; var PlayerWalker, HouseArray, HouseWalker, ThisSchool: integer; begin for PlayerWalker := PLAYER_2 to PLAYER_4 do begin // go through player 2, 3 and 4 HouseArray := States.PlayerGetAllHouses(PlayerWalker); // store all the houses of the player into HouseArray for Housewalker := 0 to length(HouseArray) -1) //go through all houses in HouseArray if States.HouseType(HouseArray[HouseWalker]) = SCHOOL then begin // check if the housetype is a school ThisSchool := States.HouseArray[HouseWalker]; //store the school id into ThisSchool. Not necessary btw, you could also put this in the next line directly. if States.HouseResourceAmount(ThisSchool, GOLD) >= 5 then begin // you asked for more than 4, but I made more or equal than 5 of it :-) // FANCY STUFF HERE! end; end; end; end; end;
I haven't tested the code examples above, but that's the general idea. Good luck! Note this is just one possible example!
Posts: 3822
Joined: 16 Sep 2007, 22:00
KaM Skill Level: Skilled
ICQ: 269127056
Website: http://lewin.hodgman.id.au
Yahoo Messenger: lewinlewinhodgman
Location: Australia
2 BUGS:
1- if I put a corn field on some tile, both IsFieldAt and IsWineFieldAt return false
2- if I put a wine field on some tile, both IsFieldAt and IsWineFieldAt return true
Hehe...did you first make IsWineFieldAt and later copied that code for IsFieldAt, Lewin? Guess you forget to update some parameter to make IsFieldAt respond to corn fields instead of winefields, right?
Users browsing this forum: No registered users and 8 guests
Powered by phpBB® Forum Software © phpBB Group Designed by ST Software |
![]() |