PDA

View Full Version : Documentation & Tutorials discussion thread



Solokiller
31-12-2015, 06:01 PM
If you have any questions, comments or suggestions regarding documentation or tutorials, this is the place to put it.

recon224
23-01-2016, 12:14 PM
If you have any questions, comments or suggestions regarding documentation or tutorials, this is the place to put it.

I guess my question is how do you enable Angelscripts? Is it automatically enabled by default and then just adding/editing plugins is all I need to do? Or is there something else I need to do in order to run it? S

I am very unfamiliar with this sort of set up as I have only used AMX/AMXX style addons in the past.

Sorry if this is in your documentation somewhere. I went through a bunch of them and didn't seem to find an answer (unless I completely missed something). Thanks for your hard work on this.

Solokiller
23-01-2016, 12:30 PM
Angelscript is always enabled. The process of adding plugins is described here (http://forums.svencoop.com/showthread.php/42599-Documentation-Plugins).

recon224
24-01-2016, 02:03 AM
My next concern comes with my extremely low level of programming. If I read it correctly, AS is similar to C++ which I have never used before. Obviously the AS tutorials assume some level of knowledge so, then, where do you think a good place to begin is?

I am still trying to figure out the entire system and how it works. I have not made any progress trying to get the basic levels of admin working (I have no idea how to even add a client to an admin list).

Sorry for being unable to have some basic understanding. I'd love to but definitely need some entry-level documentation.

Solokiller
24-01-2016, 04:43 AM
Adding clients to the admin list is not done using Angelscript. You have to add them to your admins.txt file.
If you want to learn to use Angelscript, i suggest starting with a C++ or Java tutorial:
http://www.cplusplus.com/doc/tutorial/
https://www.codecademy.com/

KliPPy
25-01-2016, 05:06 AM
I see that enginefuncs are exposed through the g_EngineFuncs object. So calling them is possible, but are you planning on allowing hooks for these? That would be really useful.

Solokiller
25-01-2016, 05:20 AM
Why would you want hooks for them?

KliPPy
25-01-2016, 05:33 AM
My idea was to register touch with trigger_changelevel; I talked to you about that on IRC.
However, I am sure it will allow for much more and better scripts being done. A lot of people currently want their AMXX plugins to be ported to AS, and not being able to hook some engine functions isn't going to make that possible. I don't see a reason not to add these hooks, can you give me one?

Solokiller
25-01-2016, 05:50 AM
There already is a hook for map changes. A better solution would be to inform scripts of what action was taken: map restart (restart command), change level, or game end.

Kogitsune
27-01-2016, 06:57 PM
Are there / will there be more hooks? In the documentation,

Hooks::Weapon::WeaponTertiaryAttack
Hooks::Weapon::WeaponSecondaryAttack
Hooks::Weapon::WeaponPrimaryAttack
Hooks::Player::PlayerDecal
Hooks::Player::GetPlayerSpawnSpot
Hooks::Player::PlayerPostThink
Hooks::Player::PlayerPreThink
Hooks::Player::PlayerUse
Hooks::Player::PlayerKilled
Hooks::Player::PlayerCanRespawn
Hooks::Player::PlayerSpawn
Hooks::Player::ClientConnected
Hooks::Player::CanPlayerUseReservedSlot
Hooks::Player::ClientSay
Hooks::Player::ClientPutInServer
Hooks::Player::ClientDisconnect
Hooks::Game::MapChange

appears to be the full extent.

Things that I think would be incredibly useful:


void Monster::MonsterKilled( monster )
void Monster::MonsterSpawned( monster )
void Monster::MonsterHurt( monster, inflictor, attacker, dmg, type )
void Player::PlayerHurt( player, inflictor, attacker, dmg, type )
bool Player::PlayerCanBeRevived( player ) //Allow us to override Player::IsRevivable
float Player::PlayerStartRevive( target, source, time ) //Allow us to change the time
float Player::PlayerFinishRevive( target, source, time ) //Allow us to change the time

A way to control animation speed for viewmodels would be nice as well - we can crowbar faster firing by setting the next attack time, but unless I'm mistaken I don't see a way to make the animations match unless that controls it. Something similar for reloading would be nice as well.

Are we able to override engine entities with ones we define in code if we want to change the behavior of things without completing rewriting it from scratch?

Solokiller
29-01-2016, 07:27 AM
Unfortunately, hooks for monster events aren't as simple to implement as they are for players. Not all monsters call the base class methods for each event, so each override would have to call it.
Not all monsters behave the same way, like the tentacle being immortal.

We'll look into it, but it might take some time to get things set up.

Controlling animation speed is done by changing entvars_t::framerate. You can alter the viewmodel framerate by getting the player's active item:



CBasePlayer@ pPlayer = ...;

if( pPlayer.m_pActiveItem !is null )
pPlayer.m_pActiveItem.pev.framerate = <something>;


I'd advise against modifying existing weapons though.

You cannot override existing entities. Aside from the engine not allowing it, doing so could seriously break our code, and cause crashes.

S. H. Lynx
29-01-2016, 08:00 AM
Any way to hook the long jump event?

Solokiller
29-01-2016, 08:04 AM
Long jump as in when the player long jumps, or when the engine longjmps in response to errors? If it's the former, at which point and what do you want to do with it?

S. H. Lynx
29-01-2016, 08:07 AM
As in when the player long jumps (ACT_LEAP)

I want to hook the very start.

Solokiller
29-01-2016, 08:17 AM
So you just want to be notified if a player longjumps? Plugin or map script?

S. H. Lynx
29-01-2016, 08:23 AM
So you just want to be notified if a player longjumps? Plugin or map script?

Plugin, basically I want to create a cool effect for Long Jumping (sound+houndye soundwave effect).

I tried to do the same with an AMXX plugin back in 4.8, but it didn't work as expected.

nico
01-02-2016, 05:38 AM
Yea it would be nice to be a able to use stuff like "monster killed" and "player is revived".

Can be useful for kill & revive streak tracking etc.

w00tguy123
02-02-2016, 12:10 AM
Is there program or script we can use that converts generated AngelScript docs into HTML, or were the current docs made manually?

Gazyi
02-02-2016, 05:05 AM
Is there a possibility to track sequence current frame with frame number output and start model sequences from certain frame?

Solokiller
02-02-2016, 05:36 AM
w00tguy123: I'll get the internal program used for generating HTML ready for release.

Gazyi: entvars_t::frame.

wolf-3d
02-02-2016, 08:54 AM
Is there a possibility to track sequence current frame with frame number output and start model sequences from certain frame?

As per SoloKiller, but just remember "start model sequences from certain frame" may be overridden/glitched by the Games own AI. (Not sure if you are writing your own AI or trying to modify existing NPC's AI.)

JonnyBoy0719
02-02-2016, 10:55 AM
Are there / will there be more hooks? In the documentation,

Hooks::Weapon::WeaponTertiaryAttack
Hooks::Weapon::WeaponSecondaryAttack
Hooks::Weapon::WeaponPrimaryAttack
Hooks::Player::PlayerDecal
Hooks::Player::GetPlayerSpawnSpot
Hooks::Player::PlayerPostThink
Hooks::Player::PlayerPreThink
Hooks::Player::PlayerUse
Hooks::Player::PlayerKilled
Hooks::Player::PlayerCanRespawn
Hooks::Player::PlayerSpawn
Hooks::Player::ClientConnected
Hooks::Player::CanPlayerUseReservedSlot
Hooks::Player::ClientSay
Hooks::Player::ClientPutInServer
Hooks::Player::ClientDisconnect
Hooks::Game::MapChange

appears to be the full extent.

Things that I think would be incredibly useful:


void Monster::MonsterKilled( monster )
void Monster::MonsterSpawned( monster )
void Monster::MonsterHurt( monster, inflictor, attacker, dmg, type )
void Player::PlayerHurt( player, inflictor, attacker, dmg, type )
bool Player::PlayerCanBeRevived( player ) //Allow us to override Player::IsRevivable
float Player::PlayerStartRevive( target, source, time ) //Allow us to change the time
float Player::PlayerFinishRevive( target, source, time ) //Allow us to change the time

A way to control animation speed for viewmodels would be nice as well - we can crowbar faster firing by setting the next attack time, but unless I'm mistaken I don't see a way to make the animations match unless that controls it. Something similar for reloading would be nice as well.

Are we able to override engine entities with ones we define in code if we want to change the behavior of things without completing rewriting it from scratch?

A hook, or a void for PlayerHurt would be super useful.

And I hope there will be a tutorial soon about creating a functional NPC, really interested on how to make one. :)

Gazyi
02-02-2016, 11:10 AM
As per SoloKiller, but just remember "start model sequences from certain frame" may be overridden/glitched by the Games own AI. (Not sure if you are writing your own AI or trying to modify existing NPC's AI.)
I want to use it for generic animated model, not for NPC. I want to make timer with model. It will have 1 fps sequences showing how much time left, but I want to stop it in random time, then start again from stop point.(Make it works like timers in Payday).

Solokiller
02-02-2016, 11:22 AM
In that case i think you mean sequence, not frame. entvars_t::sequence is what you want.

kungfulon
06-02-2016, 12:26 PM
Is there any way to prevent a hooked function from running (like MRES_SUPERCEDE)?

Solokiller
07-02-2016, 07:39 AM
If the hook supports it, it will provide a means to do so.

JJJohan
11-02-2016, 10:29 PM
Is there a current ETA for SQL/SQLite/Some other DB support for AngelScript? I realise new features aren't a priority and don't expect it "soon", but is it fair to assume it's not too far along the roadmap somewhere?

w00tguy123
13-04-2016, 11:55 AM
You can try your luck at copy-pasting code from the SDK and other scripters (AMX is very similar). Just search google for things like "hlsdk crossbow" and you'll get a good github page to steal from. Compiler errors won't make any sense to you at first, but lots of common problems have been solved in these forums so you can search through those threads for help.

Definitely read through all of Solokiller's guides and most of the AngelScript language docs (linked in his guide) before doing anything. If you are keen enough you may get far.

Maestro Fénix
14-04-2016, 09:57 AM
It always depends on how good are you at learning and what you wanna to do. For example I learnt to "code in C++" thanks to the almost classic "Your first mod on Source" tutorial (https://developer.valvesoftware.com/wiki/My_First_Mod).

But yea, while AngelScript resembles C++, you can try first learn easier programming languages like Javascript, so you get the programming logic and other basics. At the end of the day, once you learn to code in one language, you know all of them. Only have to learn the specific sintaxis.

Maestro Fénix
28-05-2016, 01:04 PM
Seeing that the Documentation Index (http://samvanheer.github.io/SC_Angelscript/docs/) has been updated, can be added to it a search function, so we can see quickly where a function belongs to and their info?

Or at least, a downloadble version for these with an irregular internet connection (so I can seek them in local)?

Solokiller
28-05-2016, 01:10 PM
The documentation that i uploaded is the same as you can download here: http://forums.svencoop.com/showthread.php/42883-Documentation-API-Documentation

I'll see if i can get Jekyll up and running on the Github website, then i can perhaps program in a search feature to scan all of the HTML files.