Script Events User-Friendly List: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
Below is a list of common and useful Script Events for editing, in a little user-friendlier format than the Doom3 list here [http://www.modwiki.net/wiki/Script_events_%28Doom_3%29]. However it doesn't list all events and all details, so refer to the Doom3 list for more details. ( | Below is a list of common and useful Script Events for editing, in a little user-friendlier format than the Doom3 list here [http://www.modwiki.net/wiki/Script_events_%28Doom_3%29]. However it doesn't list all events and all details, so refer to the Doom3 list for more details. (This list is only for the most common & useful events for map editing IMO.) | ||
Note: Arrow-brackets like <this> means to put the name or number you want in this slot; things in parentheses mean the event wants arguments to run; X is an arbitrary variable with the datatype in front of it. | Note: Arrow-brackets like <this> means to put the name or number you want in this slot; things in parentheses mean the event wants arguments to run; X is an arbitrary variable with the datatype in front of it. |
Revision as of 04:06, 3 February 2012
Below is a list of common and useful Script Events for editing, in a little user-friendlier format than the Doom3 list here [1]. However it doesn't list all events and all details, so refer to the Doom3 list for more details. (This list is only for the most common & useful events for map editing IMO.)
Note: Arrow-brackets like <this> means to put the name or number you want in this slot; things in parentheses mean the event wants arguments to run; X is an arbitrary variable with the datatype in front of it.
Some useful system commands are:
"sys.FadeIn(<color>, " and "sys.FadeOut(<color>, " (fade screen in/out to/from RGB color. '0 0 0' is black), "string X = sys.getCvar(<cvar>);" (gives the script a cvar value), "entity X = sys.getEntity("<entity-id>");" (returns the name of the entity & now you can act on X as if it's the entity itself, which it is.) "float X = sys.getTime();" (returns the game-time at that moment. Useful for timing events.) "sys.setCamera($<camera>);" (switch view to custom camera, for cinematic or periscope, etc), "sys.setCvar(<cvar>,<value>);" (to set a Cvar by hand), "sys.trigger($<item>);" (triggers an item) "sys.wait(" (pauses the script before continuing, useful for timing events) "sys.print ("Message " + variable + "\n");" or sys.println("msg"); (Prints console msg, for debugging.) "entity X = sys.spawn("atdm:<item>");" (spawn a thing called X, place it with X.setOrigin(<vector>);) "thread <scriptobject>();" (calls a new script thread to start up) "sys.threadname( "killme" );" and "sys.killthread( "killme" );" (kills the thread if it's not otherwise ending; don't let them run forever if possible. Scripts sap processing).
Useful entity commands are:
"$<item>.activate($player1);", (activate an item) "frob_item($<item>);", (frob an item) "<datatype> X = $<item>.Get<datatype>Key("<property>");" (returns the value of a spawnarg, Watch that the data-types match: vector, float, int, entity.), "string X = $<item>.getKey("<property>");. (The generic getKey that returns the value as a string), "string X = $<item>.getName();", "vector X = $<item>.getOrigin();", "entity X = $<item>.getTarget(n);" (n=the target number), "vector X = $<item>.getAngles();" (returns the angle a thing is facing) "vector X = $<item>.getAngularVelocity();" (returns its spin) "vector X = $<item>.getLinearVelocity();" (returns its velocity) "$<item>.remove();", (removes entity from game) "$<item>.setKey("<property>",<value>);" (sets the value of a spawnarg property. Note that many spawnargs only activate at spawntime, not when they're changed.) "$<item>.setModel("models/Model.lwo");" (gives the entity a new model) "$<item>.setSkin("skins/SkinName");" (gives it a new skin) "$<item>.setAngles('<vector>');" (positions the thing at the angle you want) "$<item>.setAngularVelocity('<vector>');" (gives the thing a spin) "$<item>.setLinearVelocity('<vector>');" (gives the thing a shove) "$<item>.setOrigin('<vector>');" (places or teleports entity to 'X Y Z'). "$<item>.setName("yoMamma");" (renames the entity). "$<item>.setFrobable(n);" (n=0 makes it unfrobable, n=1 makes it frobable) "$<item>.becomeNonSolid();" (make an object non-solid)
Commands on specific objects (doors, lights, forcefield, inventory)
$<Door1>.Lock(); and $<Door1>.Unlock();. $<item>.Open(); and $<item>.Close(); (Used for doors & buttons) float X = $<door>.isLocked(); and float X = $<door>.isOpen(); (returns true if so) $<light>.Off(); and $<light>.On(); (turn a light on or off) $<light>.FadeInLight( and $<light>.FadeOutLight( (fade the light in/out) $<forcefield>.Toggle(); (toggles a forcefield on and off.) $player1.addInvItem(inv_item); and $player1.replaceInvItem(oldItem, newItem); (For inventory.) (note: If <newItem> is the $null_entity, <oldItem> is just removed from inventory.) For example, to remove a key from inventory: $player1.replaceInvItem ($key1, $null_entity);
Functions for moving objects around
$<item>.move (<direction>, <units>); (moves the thing, like an elevator. see: [2] for details. Set sounds, speed or time, accel, and decel in advance, see below. Also see moveSound, moveTo, moveToPos, stopMoving, isMoving) $<item>.rotate ('<vector rotate-axis>'); (makes the thing continuously spin on axis, Also see: rotateDownTo, rotateOnce, rotateTo, rotateUpTo, stopRotating, isRotating for variations) $<item>.speed (<float speed>); (sets the speed the thing moves, also see: accelSound, accelTime, accelTo, decelSound, decelTime, decelTo, time for more control)
Common and useful AI commands are (I don't know if TDM AI respect all these. Expert opinion please?):
"float X = $<AIname/player1>.getHealth();" (returns AI/player health) "$<AI/player1>.setHealth(<health>);" (set AI/player health) "$<AI>.disableClip();" (disable clip so he can go through stuff like a ghost(?). enableClip puts it back) (There's also enableGravity/disableGravity and enableAFPush/disableAFPush where AF is articulated figure.) "$<AI>.kill();" (kill the bastard) "$<AI>.lookAt(<entity>);" (make the AI look at a thing) "$<AI>.turnTo('<vector>');" (turn the AI to a direction) "$<AI>.turnToEntity(<entity>);" (turn AI to a thing, there's also "FaceEnemy" and "FaceEntity") "$<AI>.moveTo<X>(<entity or vector>);" (where X is "enemy", "entity", or "position") "$<AI>.setEnemy(<entity>);" (Sets the enemy. There's also getEnemy.) "$<AI>.stopThinking();" (stops the AI's thinking and puts him in wait mode; not sure how to start it again).