Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 4 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Updating script support, taking requests
Patrik Offline
Frictional Games

Posts: 127
Threads: 3
Joined: Jun 2013
Reputation: 25
#1
Updating script support, taking requests

Hello everyone!

With Amnesia: A Machine for Pigs just around the corner, it's time to update The Dark Descent so it's able to use all those new and cool assets.

While we're at it, we thought we'd turn to our awesome modding community to see if there are any script functions you feel are missing in the current version of the game.

Edit: Suggestions are now closed. A big thanks to everyone who contributed. Expect the update some time soon. Smile
(This post was last modified: 09-02-2013, 04:11 PM by Patrik.)
08-27-2013, 10:04 AM
Find
felixmole Offline
Senior Member

Posts: 482
Threads: 7
Joined: Dec 2012
Reputation: 10
#2
RE: Updating script support, taking requests

I remember that when I toyed with the Custom Story Development Kit, I was mostly experiencing problems with handling the monsters.
  • A function to give away the player's position to the monster, but without having it chase the player. Just have him look around where the player was at the moment the function was executed, just like if the player had made some noise.
  • A callback function that is called when the monster (1) searches for the player (alert) (2) chases the player (attack) (3) gives up chasing the player (idle), for example void MonsterTriggered( enum State state, const Monster & monster) (C++ syntax here; sorry have forgotten the AngelScript syntax). The level editor could just leave a blank where the developer can choose to define a callback function for a monster entity.
  • A function to force the monster to forget it was chasing the player, to use for example when it gets stuck into a wall or breakable door. Make it as though it lost track of Daniel and just go back to its route. [Note : I am not sure if this can be achieved by calling SetEnemyDisableTriggers().]
  • A function to check whether the monster can be seen/heard by the player, that could be used to force the monster to despawn without letting it finish its course.

Note: it has been a long time since I haven't touched the level editor, I have forgotten many things about it, but these are the points I (think I) can remember.
(This post was last modified: 08-27-2013, 02:50 PM by felixmole.)
08-27-2013, 10:39 AM
Find
Fatalist Offline
Member

Posts: 122
Threads: 8
Joined: Dec 2012
Reputation: 8
#3
RE: Updating script support, taking requests

Some script functions from hpl1 - ReplaceEntity, SetWideScreenActive, AttachBillboardToLight, MoveEntityToArea, SetBodyProperty (change body mass, gravity and other body setup in game)

Add function CreateEntityAtPlayer, its really missing.
And add function for change screen color with different intensity.

(This post was last modified: 08-27-2013, 01:44 PM by Fatalist.)
08-27-2013, 12:04 PM
Find
Gilligan's Hell Offline
Posting Freak

Posts: 851
Threads: 17
Joined: Feb 2012
Reputation: 36
#4
RE: Updating script support, taking requests

The monster searching the room thoroughly and checking the closets would be a nice script to be added.

could reveal some intelligence from the monster.
just an idea

The International Narcotics Traffic
08-27-2013, 12:06 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#5
RE: Updating script support, taking requests

Can you make the if-else function that the parameter could turn Integers to Bools and vice-versa?

EDIT:
And can you do a global timer which is a timer that you can only use in the Global.hps so that we don't have to do a super complex timer?

"Veni, vidi, vici."
"I came, I saw, I conquered."
(This post was last modified: 08-27-2013, 12:37 PM by PutraenusAlivius.)
08-27-2013, 12:29 PM
Find
Kreekakon Offline
Pick a god and pray!

Posts: 3,063
Threads: 70
Joined: Mar 2012
Reputation: 124
#6
RE: Updating script support, taking requests

Perhaps something that can return the exact position of certain object's positions of the map (X, Y, or Z values)?

Also maybe something similar to Actionscript 3's OnEnterFrame function which will constantly check the state of something int he map so that we wouldn't have to use a incredibly fast timer as an alternative.

[Image: Tv0YgQb.gif]
Image by BandyGrass
08-27-2013, 12:29 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#7
RE: Updating script support, taking requests

Spoiler below!

PHP Code: (Select All)
SetFallDamageActive(bool); 
A function that sets falldamage active and inactive


PHP Code: (Select All)
SetPlayerJumpHeight(float); 
Sets the jump height of the player


PHP Code: (Select All)
SetPlayerInteractionRange(float); 
Sets how far the player can reach.
(I don't know how much realism this one will add, but if it's easy to include, why not?)


And more screen effects with colors, instead of only the sepia one. Gray-tone, setting the contrast, etc.

Ability to call functions when the player presses a button on the keyboard or mouse

PHP Code: (Select All)
AddRepeater(stringasNamefloat afTimestringasFunction); 
Adds a repeater to the script that keeps calling.

asName = Name of the repeater
afTimer = Time in between repeating
asFunction = Name of the function
void MyFunc(string &in asRepeater)


PHP Code: (Select All)
StopRepeater(stringasName); 
asName = Name of the repeater


PHP Code: (Select All)
ActivateInsanityEffect(stringasEffectbool abActive); 
asEffect = Name of the insanity effect
abActive = true or false to activate or deactivate


PHP Code: (Select All)
TurnWheelToSpeed(stringasNamefloat afAccfloat afGoalSpeedint alStatebool abResetSpeed); 
Turns a wheel, like a valve, at a defined speed and direction.
asName = Internal name of wheel
afAcc = Acceleration
afGoalSpeed = Desired speed
alState = End state of wheel. 1 = Right. 0 = Middle. -1 = Left.
abResetSpeed = determines whether the speed is reset after goal speed is reached.


Also some stuff to the monsters would be cool.

PHP Code: (Select All)
ForceEnemyRun(stringasNamebool abActive); 
Forces the monster to run.

PHP Code: (Select All)
AddEnemyPatrolNodeRepeat(stringasNamestringasFirstNodeNamestringasSecondNodeNamestringasThirdNodeNamefloat afWaitTimestringasAnimation); 
Forces monster to patrol between the desired pathnodes. When reaching the first pathnode, he will wait the waittime, then continue to the second pathnode etc. If no third pathnode is specified, it will go back to the first pathnode again.

So it goes like First, Second, Third, Second, First, Second, Third etc.



Trying is the first step to success.
(This post was last modified: 08-27-2013, 03:40 PM by FlawlessHappiness.)
08-27-2013, 01:54 PM
Find
Tomato Cat Offline
Senior Member

Posts: 287
Threads: 2
Joined: Sep 2012
Reputation: 20
#8
RE: Updating script support, taking requests

How about a "MoveEntityToScriptArea" function? With parameters being said entity and script area. Or simply a "MoveEntity" function with x, y, z args?

And how about function for creating and setting a boolean value in the sense of SetLocalVarInt? This would be VERY useful.

RAISE YOUR DONGERS ヽ༼ຈل͜ຈ༽ノ
08-27-2013, 02:19 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#9
RE: Updating script support, taking requests

I got some.

Spoiler below!

Global timer parameter. Use in Global.hps only!

PHP Code: (Select All)
void AddGlobalTimer(stringasTimerfloat afTime); 
Adds a Global Timer.
asTimer - Timer name
afTime - Time in seconds

PHP Code: (Select All)
void FUNCTION(string &in asTimerfloat afTime); 
Callback.

Chain events. It causes 3 set of events happening in a chained order in one parameter. Use only three!

PHP Code: (Select All)
void ChainEvent(stringasEventOnestringasEventTwostring &asEventThreefloat afEventTime); 
Does three events in one consecutive order. Note that all three events have to be called first. It takes the Function of the event's name.

asEventOne - Event number one.
asEventTwo - Event number two.
asEventThree - Event number three.
afEventTime - Time in seconds does the time of the chain will occur.
[php]


And that's all I got. Will edit if have more.

"Veni, vidi, vici."
"I came, I saw, I conquered."
(This post was last modified: 08-27-2013, 02:26 PM by PutraenusAlivius.)
08-27-2013, 02:24 PM
Find
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#10
RE: Updating script support, taking requests

I have quite a large wishlist i'm afraid Smile

Bug fixes:
Spoiler below!
  • AddAttachedPropToProp - zPosition parameter is used for zRotation
  • AddAttachedPropToProp - Attaching a breakable entity and then breaking this entity (setPropHealth) will cause the game to crash if the base body is moved
  • Breaking a prop sometimes fails to create the broken entity (Typically only happens after a large quantity of props have been attached & removed using AddAttachedPropToProp). This seems to be really random and I dont have any way to reproduce this consistently short of attaching a bunch of props over time and breaking the base the entity while it is moving.
  • AddAttachedPropToProp crashes when attaching props with joints (e.g. doors, cupboards)
  • Return const string& rather than string& on relevant functions
  • Monsters created through CreateEntityAtArea / breakProp events are unable to follow path nodes
  • Editor: The entity editor can fail to load bodies properly when using open to load a multi-bodied prop after editing one.
  • Editor: The entity editor erroneously rejects valid animation field entries when editing animations.


New function wishlist

Math & Number functions
Spoiler below!
  • Sin/cos/tan & atan/acos/asin/atan2
  • exp,log
  • sqrt, pow
  • min,max,abs
  • PI(), E()
  • ParseInt(string), ParseFloat(string), ParseBool(string)


Entity functions
Spoiler below!


Positional
  • float[] GetEntityPosition(string entity) - Return x,y,z as float[] for position in world coords. Could also have a separate function for x/y/z.
  • float[] GetEntityRotation(...) - Get the x,y,z rotation of the entity (or could return rotation matrix / quaternion if this makes more sense).
  • float[] GetEntityScale(...)
  • SetBodyPosition, rotation & scale
  • In the case of multiple bodies use primary body or make functions operate on the body level rather than entity level.
  • Getters, setters & adders, for velocity & acceleration
  • GetEntityMass(...) so we can properly use the force commands
  • float[] GetBoundingBox(...) - return AABB of entity as float[] {x1,y1,z1,x2,y2,z2}.

Bodies
  • Methods to list the bodies of an entity
  • Methods to find the type of an entity (e.g. enemy, static_prop)
  • Adjust some body properties (e.g. mass, canAttachCharacter)
  • GetBodyDensitity() / GetBodyVolume() - return volume/density of body using the shapes.

Misc
  • Toggle if the mesh should be drawn or not without de-activating the whole entity
  • RemoveEntity(string entity)

Utility
  • string GetNearestEntityToPoint/Area(x,y,z)
  • bool EntityCollidesAt(entity1,entity2,x,y,z) - Returns true if the entity 1, when moved to position x,y,z would collide with entity 2.
  • string[] GetCollidingEntities(entity) - Return a list of all entities colliding with the given entity
  • float[][] GetContactPoints(entityA,entityB) - return a list of contact/intersection points in either world or local coords between two colliding entities. Return empty list if the entities do not collide.

Area functions
Spoiler below!
  • CreateScriptAreaAtPosition(x,y,z,xrot,yrot,zrot,xscale,yscale,zscale) - Allow us to create script areas at a position
  • CreateStickyArea, PlayerStartArea etc
  • string GetAreaType(string area) - Return type of area. E.g. "script", "start", "sticky" etc
  • Allow us to adjust parameters of sticky areas & rope areas
  • RemoveArea(string area) / RemoveEntity(string entity)

Lang Files
Spoiler below!
  • string[] getLangCategories() - Array of all lang categories
  • string[] getLangEntries(string category) - Array of all entries in a category
  • string getLangEntryText(category,entry) - Get entry specified, return empty string if no match found
  • createLangTempEntry(string category, string entry, string text) - Create a temp lang entry in given category with given name. This entry can be cleared on save.


Player
Spoiler below!
  • Getters and Setters for position of the player body
  • Get/set the camera rotation without needing to use lookat
  • Enable/Disable the night vision effect through script rather than full conversion

Input
Spoiler below!
  • GetKeyState() for a given key code, or something similar
  • Similar deal for mouse buttons


Map
Spoiler below!
  • string[] GetEntities() - Return an array of all entities in the map
  • string[] GetMatchingEntities(string entityFilter) - Return array of all entities in map matching given filter (e.g. "barrel*" can be used in the collision functions, but it would be nice to get an array of all the matches which that function makes).


Misc
Spoiler below!
  • unt8[] toByteArray(x) & fromByteArray(uint8[]) for primitive types
  • OnSave and OnLoad events so that we can save & restore global-scoped classes manually (Either through callback (e.g. lantern) or like OnEnter)
  • Perform light pre-processing of scripts (#include, #define and #ifdef) - There is an angelscript extension for this.
  • Document AddKeyPart, SetPermaDeathSound functions
  • Set/GetLocalVar support for primitive arrays
  • CallFunction(string, string[] args) - Call specified function, negating the need to use function pointers for callbacks. The string[] args can be used to get arguments of any type using GetLocalVar functions.
  • Print a message to the program log or using AddDebugMessage stream if an exception is triggered inside the script [e.g. referencing a null object or array index out of bounds] containing line number & a brief error description.
  • Regular expressions (string[] RegexGroups(...) & RegexMatches(...) )
  • string[] GetListLocalVariables<Type>() & GetListGlobalVariables<Type>()- List of all defined local/global variables of a specific type.
  • Quicksort, search & binarysearch for arrays of primitives
  • convert floats & doubles to string with fixed number of decimal places / sig. fig


Config options
Spoiler below!
  • Permit us to adjust the killplane position (default: -500y i think) in the global config
  • Permit us to disable saving in the global config


Edit: Okay that's my wall-of-functions done for now. Thanks for doing this script support update, even if you don't get round to all the stuff we come up with!
Edit 2: Added suggestion to misc regarding in-script exceptions (e.g. array index out of bounds).
Edit 3: Added a few more suggestions in utility & misc.
(This post was last modified: 08-27-2013, 10:30 PM by Apjjm.)
08-27-2013, 03:20 PM
Find




Users browsing this thread: 2 Guest(s)