![]() |
Event and Intel scripts
I can sort of figure out the AI scripts, but the Event script is driving me batty.
I'm trying to make a fairly simple change- I want an event to fire every turn. Any ideas on -how- to do that? |
Re: Event and Intel scripts
Looks fairly straightforward:
<font class="small">Code:</font><hr /><pre> set event_freq := Sys_Game_Settings_Get_External_Events_Frequency() set lng_Event_Severity := Sys_Game_Settings_Get_External_Events_Severity() set chance := Sys_Get_Random_Long(1, 100) case event_freq EVENT_FREQUENCY_NONE: set event_happened := FALSE EVENT_FREQUENCY_LOW: if (chance <= 5) then set event_happened := TRUE endif EVENT_FREQUENCY_MEDIUM: if (chance <= 10) then set event_happened := TRUE endif EVENT_FREQUENCY_HIGH: if (chance <= 25) then set event_happened := TRUE endif endcase</pre><hr /> A number between 1 and 100 is generated, then you go into this case statement based on the frequency used in game setup. In the particular frequency that the game is using, you compare your random number to some chance threshold to see if an event occurs. On low frequency, you have a 5% chance each turn. On high, you have a 25% chance. Set "chance <= 25" line to "chance <= 100" if you want 1 event per turn with high frequency game setting. |
All times are GMT -4. The time now is 12:08 PM. |
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.