- Create the effect file inside the
effectsfolder.- I recommend using the
EFFECTID_EFFECTNAME.spformat (with the effect ID following the last effect's), such as256_COOLEFFECT.
- I recommend using the
- Inside the
header.incfile, create any global variables and include the libraries or files that you may need.- Include the effect file you just created.
- Declare your desired effect inside the
Effectenum just beforeEFFECT_MAXCOUNT.- You don't need to write the ID next to the effect, but it can help with readability.
- Go inside
utilsand find the fileset_effect.sp. - After the last effect, create a case matching yours.
- You will need to set all function pointers (see all in
header.inc: RoundEventFunc). If you don't need one (e.g. for hitting a player), set it toINVALID_FUNCTION.- Naming convention for the methods:
Event_EventName_ID_EffectName; - If you don't yet know what you'll need, set everything to
INVALID_FUNCTIONand add it later.RoundStartshould always be present.
- Naming convention for the methods:
- You can add conditions to your effects. Example code:
if(activePlayers < 3) { // If true, effect shouldn't appear unless forced. if(isForced && !g_isForcedRandom) { // Do not change PrintToChatAll("\x07B143F1[Roundabout]\x01 Hyperheal effect was forced, but its conditions were not met. \x07FB524FUnwanted effects may occur.\x01"); } else { PrintToServer("[Roundabout] Hyperheal effect condition not met, reshuffled."); setEffect(effectIndex); return; } } // Function pointers g_OnRoundStartFuncPtr = Event_RoundStart_23_Hyperheal; g_OnRoundEndFuncPtr = Event_RoundEnd_23_Hyperheal; g_OnPlayerUpdateFuncPtr = Event_PlayerUpdate_23_Hyperheal; g_OnPlayerHitFuncPtr = INVALID_FUNCTION; g_OnPlayerDeathFuncPtr = INVALID_FUNCTION;
- You will need to set all function pointers (see all in
-
You can copy-paste code from one of the already existing effects to get a headstart.
-
RoundStartis the only necessary component for an effect.- It presents the effect details to the players, as well as initialize any variables.
- You will need to create the description for your effect inside
utils/show_effect_description.spfollowing the same structure as the others. - Example code inside
show_effect_description:PrintCenterTextAll("Perfect Math Class"); ShowHintToAllClients("Perfect Math Class\n\nYou will sometimes receive a math question. Answer within 8 seconds or die.");
- Example code inside the effect file itself (-1 can be replaced with effect ID):
ShowCurrentEffectDescriptionToAll(-1);
-
RoundEndshould do the opposite ofRoundStart, which means it may unset any variables, remove the effects from the players, as well as kill any ongoing Timers. -
PlayerUpdateoccurs when a player changes its loadout in spawn or changes classes. The player may be able to bypass an effect by doing these actions, so this is sometimes needed. -
PlayerHitoccurs when a player hits another. -
PlayerDeathoccurs when a player kills another. -
You can add other listeners either directly as a function pointer or as a HookEvent that would get unhooked at the end of the round. If you only need the hook for 1 effect, the latter is better.
- Use
!roundabout_force <effect_id>to test your effect.- Make sure to watch out for errors in the server console.
- Also make sure to test your effect with other effects using
!roundabout_force count <n>- If your effect restricts classes, include it in
lists/multieffect_mutually_exclusive.sp - If your effect is way too fragile, include it in
lists/multieffect_exclude.sp
- If your effect restricts classes, include it in