Go Back   Savage 2: A Tortured Soul Forum > Savage 2 Modding > Documentation


Documentation Post useful tutorials and other informative material.

Thread Tools Display Modes
Old 12-06-2011, 03:44 PM   #1

rohezal's Avatar
Join Date: Mar 2008
Posts: 2,610
Thanks: 112
Thanked 136 Times in 106 Posts
Default rohezals script documentation

in general, scripts which are executed twice overwrite each others variables.
this is why you can just run one moveto script (or copy them and rename
the variables). this is (almost) how movetowalk was created.this is archieved by a lock. some script which affects only the player who execute it like holdspec. most time you see it when no index is given for a script like setangles (buildin).

walkto target id source id speed (int optional)
subscript moveToWalk
starts the movefwrd animation of source and moves it directly to target
can just move 1 object at one time. when multiple object are moved, the first object
stops after 10 milliseconds and the second one starts to move.

moveTo target id source id speed (int optional)
move an entity setposition. can go through walls etc. independent from walkto.
can handle just 1 object, until it arrives at target. other calls of the script are ignored
until it arrives.

isinregion id1 id2 radius (float)
checks if id2 is in radius of id1. can be moved. a selfwritten promity trigger.
can be used for falling rocks, moving things over bridges, cinematics etc.

a lock (set locked in gamestart to 0)

if [_locked== 1] goto Locked
set locked 1
some script stuff
set locked 0

used for cyclic waypoint moving. non cyclic / one way in tower defense.
on mapstart over writes each enemy_waypoint (number)with a script that overwrites the
ememy_target with a precomputed value.

move npcs or pets (must be changed by hand in setnpcjob / setpet)job,
of an npc with name (must be a number), to the enemy_waypoint, which was
set by the last waypoint it passed.

xchat playerid (int) lookatid(int ) topic (string)
look at position start dialog and hold spec. most time used from x(personname) for dialog.
teleports after dialog to (dialogname)_release. player. is invulnerable during dialog. vulnerable after it, even if he was invulnerable from an other source.

lookat (lookatx at project x for compatibility reason) dummyid (int)
2 subscrits one for x angel, one for y angle
look at the direction a dummy entity faces, in x and y diretcion. slow turning to the target.

popupx text string title string execute string (scriptname)
subscript popup (some interface code)
displays a popup with text and title can be empty, then diary is used as titile.
execute is the name of the script which is executed after the popup, is closed.
if execute is empty nothing is executed.

some code for interace stuff. written by pidgi modified by me.
it jumps to the @TOPIC (like merchant, its a string variable) anchor after it has inited his stuff.
its used via xchat. look at greenon, jolan for an easy example. its pretty powerful and call
itself for multi page dialogs. care with to long strings, they look ugly. the generic field,
is like popup, but its more integrated in ui. callback is the topic ( in ui) which should be displayed after generic . if call is not set generic closes the dialog after it is closed.

some interface code for popupx. if you don't want to modify it, you can just use popupx.

holdspec (clientscript)
a player can't move or look around. can click on gui. used for dialogs.

releasespec (clientscript)
release a holdspec. don't forget to use it.

playerTurnNorth, west, northwest etc. (clientscript)
turns the player slowly to north west east etc.


I love VOIP
sing: "base, base, base, base, base, base, base"

Why only 15 year old girls? Since 4 Years, damn I'm doing something wrong...

One day I will find out who is responsible for the K2 scripting "language" and the modding "support". And then...

rohezal is offline   Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT. The time now is 11:52 AM.