Skip to content

Commit

Permalink
MonsterSpawnAlert
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikk155 committed Jun 11, 2024
1 parent 193ef4d commit 2b83139
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 1 deletion.
27 changes: 27 additions & 0 deletions .github/workflows/squadmaker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: AFKManager

on:
push:
branches:
- main
paths:
- '.github/workflows/squadmaker.yml'
- 'src/utils/*'
- 'src/squadmaker/*'

jobs:
build:
name: Build
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Installing Python
run: |
pip install --upgrade pip
pip install -r requirements.txt
- name: Release
env:
TOKEN: ${{ secrets.TOKEN }}
BOT: ${{ secrets.BOT }}
run: python3 build.py squadmaker true true
11 changes: 11 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ <h1 pkvd="map_scripts"></h1>
<tr>
<th pkvd="name"></th>
<th pkvd="Description"></th>
<th pkvd="Type"></th>
<th pkvd="Download"></th>
<th pkvd="CreditScriptIdea"></th>
<th pkvd="Metamod"></th>
Expand All @@ -219,11 +220,21 @@ <h1 pkvd="map_scripts"></h1>
<tr>
<th><a href = "#mapscript_SwapWeapons">SwapWeapons</a></th>
<th pkvd="SwapWeapons_Description"></th>
<th pkvd="gamemode"></th>
<th><a href = "https://github.com/Mikk155/Sven-Co-op/releases/tag/SwapWeapons" target="_blank">Github</a></th>
<th></th>
<th></th>
</tr>

<tr>
<th>MonsterSpawnAlert</th>
<th pkvd="MonsterSpawnAlert_Description"></th>
<th pkvd="Squadmakerfn"></th>
<th><a href = "https://github.com/Mikk155/Sven-Co-op/releases/tag/squadmaker" target="_blank">Github</a></th>
<th></th>
<th></th>
</tr>

</table>
</section>

Expand Down
8 changes: 7 additions & 1 deletion docs/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
"Key": "Key",
"Value": "Value",
"Type": "Type",
"CustomEntity": "Custom Entity",
"Squadmakerfn": "squadmaker Function",
"trigger_scriptfnth": "trigger_script Think Function",
"trigger_scriptfnus": "trigger_script Use Function",
"gamemode": "Game mode",
"AdminLevel": "Admin Level",
"None": "None",
"Administrator": "Administrator",
Expand Down Expand Up @@ -118,7 +123,8 @@
"SwapWeapons_Classes": "List of weapon classes",
"SwapWeapons_ClassesMap": "Same as \"Classes\" but overrides it completelly if the current map name is this class name",
"SwapWeapons_Classnames": "classname of weapons that can not be equiped at the same time",

"MonsterSpawnAlert_Description": "Makes the spawned monster be aware of position and target a random player",

"TranslatedBy": ""
}
}
28 changes: 28 additions & 0 deletions src/squadmaker/MonsterSpawnAlert.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
void MonsterSpawnAlert( CBaseMonster@ pSquadmaker, CBaseEntity@ pMonster )
{
if( pMonster is null || !pMonster.IsMonster() )
return;

CBaseMonster@ monster = cast<CBaseMonster@>( pMonster );

if( monster is null )
return;

array<int> index;

for( int i = 1; i <= g_Engine.maxClients; i++ )
{
CBasePlayer@ pPlayer = g_PlayerFuncs.FindPlayerByIndex( i );

if( pPlayer !is null && pPlayer.IsConnected() && pPlayer.IsAlive() )
index.insertLast(i);
}

if( index.length() > 0 )
{
CBasePlayer@ pPlayer = g_PlayerFuncs.FindPlayerByIndex( index[ Math.RandomLong( 0, index.length() - 1 ) ] );

if( pPlayer !is null )
monster.PushEnemy( pPlayer, pPlayer.pev.origin );
}
}
9 changes: 9 additions & 0 deletions src/squadmaker/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<details><summary>latest 11/06/24</summary><p>

First released MonsterSpawnAlert

Call "MonsterSpawnAlert" in your squadmaker's "AngelScript Function Name" to make a monster target to a random player

---

</p></details>
2 changes: 2 additions & 0 deletions src/squadmaker/squadmaker.res
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"path" "scripts/maps/yourmodfolder/"
"squadmaker/MonsterSpawnAlert.as"

0 comments on commit 2b83139

Please sign in to comment.