Topic Summary
Posted by: Duke64
« on: April 10, 2017, 09:46:47 PM »
After you unzip the "game.kpf" file use this to view and copy files to your Turok 2 directory. In your Turok 2 directory create a "scripts" folder and a "defs/actors" folder.
If we wanted to display the damage done to an enemy on the screen, the first thing we need to do is create a script for enemies. So first create a new file and call it "Enemy.txt" and place it in the scripts folder. Edit the file and create a class named Enemy and add the OnDamage callback function like so:
class Enemy : ScriptObject { kActor@ self; Enemy(kActor@ actor) { @self = actor; } void OnDamage(kDamageInfo& in dmgInfo) { Hud.AddMessage("Enemy took " + dmgInfo.hits + " damage"); } }
Now we just have to hook this script up to all the enemies in the game, but for testing let's just hook it up to the Raptoid enemy. All the definitions of everything in the game is in the folder "defs". enemies are in "defs/actors/enemies.txt"
So first let's copy the "defs/actors/enemies.txt" file that was in the game.kpf that you unzipped before, and paste that into "Turok 2 - Seeds of Evil/defs/actors/enemies.txt" Edit the file and the first entry is the Raptoid enemy. It's already defined all the properties and components needed by enemies in the game so we are going to add our custom script component class to the enemy by adding:
Begin_Component "kexScriptComponent" scriptClass "Enemy" End_Component That's all you need to do. Run the game - make sure you're in developer mode by opening the console and typing "developer 1" if you weren't you need to close and reopen the game after setting it. When a Raptoid is damaged it should display that damage text.
That is really helpful man thanks a lot. Yeah keep up the good work can't wait to see your Turok 2 mod 
Posted by: BehemothProgrammer
« on: April 10, 2017, 08:35:45 PM »
Update #2 brings a little bit of new scripting functionality mainly the new HitScan method on the WorldComponent. Finally a non hacky way to do a raycast just like Turok 1 scripting. - new Class: kClipInfo - new WorldComponent Method: void HitScan(kClipInfo&out, const kVec3&in origin, const kVec3&in targetOrigin, const uint EnumClipFlags, const float=0)
Posted by: BehemothProgrammer
« on: April 08, 2017, 09:41:48 PM »
Updated with important notes on some of the event functions sent to ScriptObject as well as a execution order of the event startup functions.
ParticleFactory - IMPORTANT: Particles are not guaranteed to spawn and may return null. Even with 100 probability set they may not spawn for unknown reasons (rare).
Posted by: Snake Plissken
« on: April 06, 2017, 01:11:21 PM »
im so sorry for flooding i just noticed i did that here ill fix it. i also added scriptClass "BrutalEnemy" to the def index for the raptoid actor, its the first one in the text document def file, not sure why i said that. i added #include "scripts/BrutalTestHook.txt" to main.txt . i created a BrutalTestHook.txt and added what you said but i named the class BrutalEnemy in BrutalTestHook.txt so it would line up with scriptClass. this is what you have said or am i incorrect? sorry thnx for the help im sure you know what im trying to do. lol your the man thnx. anyways i do all of this and. the game loads but nothing prints to screen or to the hub/cmd/ anywhere. im going to do some further testing. i know scriptclass is a param in this version of the engine for a def file but i also know what className dose. however i fear that without proper hooking i would have to rebuild more then what im out to do. im going to read over your posts again and do some more testing. thnx.
EDITED a hour or so later: oh wow ok I got it thanks. hey pretty cool when it phrazes the defs it stores the information to some extent, allowing for us to redfine another's that we can then add to the collection that is a single actor with a bunch of cool stuff now thanks, I have my understanding on how to hook to instances of actors, or an understanding, you helped and that's cool. im gonna get back to work on things, if I have a issue applying using this method under a certain circumstances ill make sure to throw my treble's past you in a post. behemoth your great thanks. ill try to get my api list compared to this one soon I feel I was incorrect about a past one I mentioned however I still see a few missing from whats been collected in this post. but back on topic: thanks again pale for the trobleshooting. even if I did flood this with comments it still really helped. I can delete some of my posts I made a bunch but idk maby someone else will see it from the way I came at it and idk maby something can help.
Posted by: Snake Plissken
« on: April 06, 2017, 12:58:25 PM »
After you unzip the "game.kpf" file use this to view and copy files to your Turok 2 directory. In your Turok 2 directory create a "scripts" folder and a "defs/actors" folder.
If we wanted to display the damage done to an enemy on the screen, the first thing we need to do is create a script for enemies. So first create a new file and call it "Enemy.txt" and place it in the scripts folder. Edit the file and create a class named Enemy and add the OnDamage callback function like so:
class Enemy : ScriptObject { kActor@ self; Enemy(kActor@ actor) { @self = actor; } void OnDamage(kDamageInfo& in dmgInfo) { Hud.AddMessage("Enemy took " + dmgInfo.hits + " damage"); } }
Now we just have to hook this script up to all the enemies in the game, but for testing let's just hook it up to the Raptoid enemy. All the definitions of everything in the game is in the folder "defs". enemies are in "defs/actors/enemies.txt"
So first let's copy the "defs/actors/enemies.txt" file that was in the game.kpf that you unzipped before, and paste that into "Turok 2 - Seeds of Evil/defs/actors/enemies.txt" Edit the file and the first entry is the Raptoid enemy. It's already defined all the properties and components needed by enemies in the game so we are going to add our custom script component class to the enemy by adding:
Begin_Component "kexScriptComponent" scriptClass "Enemy" End_Component That's all you need to do. Run the game - make sure you're in developer mode by opening the console and typing "developer 1" if you weren't you need to close and reopen the game after setting it. When a Raptoid is damaged it should display that damage text.
im still reading the posts so ill delete this if you touched on it after you stated it but in my opnion, it would be a proper way if we were to hook into the script class and not declare a new one? do we then not need to script much more stuff inorder to make things work and this stuff would have nothing to do with are orignal goal, other then it needed to be done inorder to pull it off from this prospective. anyways this is how i looked at it so i been going down this road when tryin to pull it off. testing now
Posted by: Snake Plissken
« on: April 06, 2017, 08:57:57 AM »
https://www.dropbox.com/sh/yj01yv4rsl4u6xd/AABbxi7fznHiAB0C-zzHWxlfa?dl=0
This ScriptAPI.txt file contains all the exposed functions to the scripting engine in Turok 2 as of the 2017-03-22 update.
Some small explanations on whatever I know and the rest is question marks or the same as Turok 1. Hope this helps someone. If you want to help fill out the missing parts of these please post here so I can update it. Thanks!
Also since I went and found the enemy actor types that were not defined in the scripts for some reason, heres the remaining defs: #define kActor_AI_Fireborn 203 #define kActor_AI_FleshSentinel 400 #define kActor_AI_DeathGuard 401 #define kActor_AI_LordoftheFlesh 402 #define kActor_AI_CaveSpider 503 #define kActor_AI_Nala 507 #define kActor_AI_WarClub 600 #define kActor_AI_HiveSoldier 710 #define kActor_AI_LordoftheDead 803 #define kActor_AI_SisterofDespair 804 #define kActor_AI_PrimagenTrooper 900 #define kActor_AI_BioBot 901 #define kActor_AI_PrimagenGuard 902
the Compsognathus is the same as the Leaper with different properties.
And zPlaceholder_67.particle is the annoying Deadman seeking blood projectile.
I extracted all usable functions from the compiled .exe including everything and anything that can be used in the scripts, Defs, and particle files. A few are not used in game yet. I'm going to reply with a epic thank you on this when I get home, I'll also compare it. I'm glad to see this released becuse, I know how much work it takes to a obtain the info and b organize it for placeing on display to others. Also dang saved me a few by pointing out the particle name for the dead mans blood toss. Off topic: at the moment I'm looking into hooking into all instances of the kexenemi ai component. Class kexenemyai :kexenemyai Selfy@ kexenemiai ~kexenemiai( kenemyai @selfy ) { } Void onDamage(void) { } And included at main Something or another... not at my computer at the moment.
Posted by: BehemothProgrammer
« on: April 04, 2017, 04:45:19 PM »
After you unzip the "game.kpf" file use this to view and copy files to your Turok 2 directory. In your Turok 2 directory create a "scripts" folder and a "defs/actors" folder.
If we wanted to display the damage done to an enemy on the screen, the first thing we need to do is create a script for enemies. So first create a new file and call it "Enemy.txt" and place it in the scripts folder. Edit the file and create a class named Enemy and add the OnDamage callback function like so:
class Enemy : ScriptObject { kActor@ self; Enemy(kActor@ actor) { @self = actor; } void OnDamage(kDamageInfo& in dmgInfo) { Hud.AddMessage("Enemy took " + dmgInfo.hits + " damage"); } }
Now we just have to hook this script up to all the enemies in the game, but for testing let's just hook it up to the Raptoid enemy. All the definitions of everything in the game is in the folder "defs". enemies are in "defs/actors/enemies.txt"
So first let's copy the "defs/actors/enemies.txt" file that was in the game.kpf that you unzipped before, and paste that into "Turok 2 - Seeds of Evil/defs/actors/enemies.txt" Edit the file and the first entry is the Raptoid enemy. It's already defined all the properties and components needed by enemies in the game so we are going to add our custom script component class to the enemy by adding:
Begin_Component "kexScriptComponent" scriptClass "Enemy" End_Component That's all you need to do. Run the game - make sure you're in developer mode by opening the console and typing "developer 1" if you weren't you need to close and reopen the game after setting it. When a Raptoid is damaged it should display that damage text.
Posted by: Doom Dojo
« on: April 04, 2017, 11:32:01 AM »
Hey thanks for this saves me time I don't have at all. I know how to use scripts for Doom so I'm not a noob or anything but how the heck do we call on these? I want to maybe control an enemies ondamage??
| Messages to ScriptObject //------------------------------------------------------------------------------------------------------------------------ void OnBeginLevel(void) void OnTick(void) void OnEndLevel(void) void OnSpawn(void) void OnPreDamage(kDamageInfo& in dmgInfo) void OnDamage(kDamageInfo& in dmgInfo) void OnLevelLoad(kDictMem@ pDict) void OnDeath(kDamageInfo& in dmgInfo) void OnTouch(kActor@ pInstigator) void OnTrigger(kActor@ pInstigator, const int msg) void UserEvent(const float x, const float y, const float z, const float f1, const float f2, const float f3, const float f4) //4 flag values for various uses? void OnCollide(kActor@ pCollider) void OnSerialize(kDict& out dict) void OnDeserialize(kDict& in dict) //------------------------------------------------------------------------------------------------------------------------
Posted by: Jay Doomed
« on: April 04, 2017, 10:18:59 AM »
Updated with more details on the kEnemyAIComponent and some of the missing ActorFlags. Added a link to the AngelScript docs on Arrays.
Thank you!
Posted by: BehemothProgrammer
« on: April 03, 2017, 05:15:53 PM »
Updated with more details on the kEnemyAIComponent and some of the missing ActorFlags. Added a link to the AngelScript docs on Arrays.
Posted by: Gazer
« on: March 29, 2017, 10:13:30 PM »
Yes, and it's confusing tracking shit down. I guess there's a lightmap created by a "sun" actor and vertex light added by the spot, point or box light actors. Time will unravel all things. Fine job on the scripting. I'm trying to pack up a map but the game is not recognizing it. kpf in the mods folder. I think the problem is that hubInfo.txt number.
Posted by: BehemothProgrammer
« on: March 29, 2017, 07:11:44 PM »
I don't know if this is a question or a thought, do you know where to find lighting variables for the editor? They seem random in studio and some don't have any effect.
In the properties window panel(F4) under the kexLightComponent Tab. But like most of the things in the editor (at least for now) things don't work or are missing.
Posted by: Duke64
« on: March 29, 2017, 06:43:33 PM »
Having it written out like that is pretty awesome. Nice job, subject pinned for users to find easy.
Posted by: Gazer
« on: March 29, 2017, 04:13:19 PM »
I don't know if this is a question or a thought, do you know where to find lighting variables for the editor? They seem random in studio and some don't have any effect.
Posted by: Jay Doomed
« on: March 29, 2017, 02:53:24 PM »
Dude! really this is going to save me a bit of time and digging. Thanks a lot which reminds me I still really need to dig in your Wolfenstein Turok kpf files. Madman work. Behemoth Madman 
|