.com.unity Forums
  The Official e-Store of Shrapnel Games

This Month's Specials

Bronze- Save $10.00
winSPMBT: Main Battle Tank- Save $5.00


Go Back   .com.unity Forums > Shrapnel Community > Space Empires: IV & V > SEV Modders Knowledge Base

Thread Tools Display Modes
Old November 6th, 2006, 09:11 PM

Phoenix-D Phoenix-D is offline
National Security Advisor
Join Date: Nov 2000
Posts: 5,085
Thanks: 0
Thanked 0 Times in 0 Posts
Phoenix-D is on a distinguished road
Default 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?

I am not senile. I just talk to myself because the rest of you don't provide adequate conversation.
Reply With Quote
Old November 6th, 2006, 09:19 PM
Fyron's Avatar

Fyron Fyron is offline
Shrapnel Fanatic
Join Date: Jul 2001
Location: Southern CA, USA
Posts: 18,394
Thanks: 0
Thanked 12 Times in 10 Posts
Fyron is an unknown quantity at this point
Default Re: Event and Intel scripts

Looks fairly straightforward:

  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
set event_happened := FALSE
if (chance <= 5) then
set event_happened := TRUE
if (chance <= 10) then
set event_happened := TRUE
if (chance <= 25) then
set event_happened := TRUE

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.
It's not whether you win or lose that counts: it's how much pain you inflict along the way.
--- SpaceEmpires.net --- RSS --- SEnet ModWorks --- SEIV Modding 101 Tutorial
--- Join us in the #SpaceEmpires IRC channel on the Freenode IRC network.
--- Due to restrictively low sig limits, you must visit this link to view the rest of my signature.
Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump

All times are GMT -4. The time now is 06:22 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2022, Shrapnel Games, Inc. - All Rights Reserved.