Please Help Support E-Mods.net by Donating

e-mods.net

  • 2017-11-19, 16:29:27
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search

News:

Looking for VTMR Modding Tutorials? Check out the Open Nod Development section of e-mods.net.

Author Topic: Java API Nod Engine Event Calls List  (Read 4616 times)

Javokis

  • Horses Dick
  • Member
  • *****
  • Karma: 21
  • Offline Offline
  • Posts: 2373
    • E-Mods.net
Java API Nod Engine Event Calls List
« on: 2008-07-26, 18:04:04 »

Code: [Select]

/*
Author: (Optional)

Descript: (Optional)

Feel free to use this training script for any of your projects.
*/

public class VampireProcedures extends Codex
{
//Sample module level variables:

//An integer variable
private int myValue = 0;

//A boolean variable
private boolean myBoolean = false; //true or false

public void joined(int clientGuid)
{
//Message showing this procedure when in use
CodexConsole.Print(0, 1, "joined procedure was called.");
}

public void disconnected(int clientGuid)
{
//Message showing this procedure when in use
CodexConsole.Print(0, 1, "disconnected procedure was called.");
}

public void beginscene(int clientGuid, int captureID)
{
/*
This is called each time someone enters the level.

clientGuid: The person that entered the level
captureID: The thing that is tracking this thing
*/

//All guids are merely id numbers. You have to assign the
//number to a Codex object for the game to do anything with it.
//This is how you do it:
CodexActor actor = new CodexActor(clientGuid);

//You can also use a CodexPlayer object assignment for player
//specific objects. Example of setup:
CodexPlayer player = new CodexPlayer(clientGuid);

//Only use this if you need to use CodexPlayer commands.
//Otherwise just use CodexActor.

/*
Remember - All scripts are cap sensitive. That means clientGuid is
NOT the same as CLIENTGUID or clientguid. Be sure your caps match
at all times when it comes to java scripting.
*/

//Now you can effect this actor or player with several commands.
//Example of command from the CodexActor command list:

actor.ReviveActor(1, 1);

//Then you can print a message to individual who just been revived.

CodexConsole.Print(clientGuid, 0, "You've just been revived!");

//Check your Codex Documentation from the NOD SDK for a full list
//of available commands.

//Message showing this procedure when in use
CodexConsole.Print(0, 1, "beginscene procedure was called.");
}

public void endscene(int clientGuid, int captureID, int exitNum)
{
/*
This is called whenever a player exits the level

clientGuid: The person that just exited the level
captureID: The thing that is tracking this thing
exitNum: The exit number that the player clicked on to leave.
*/

//Message showing this procedure when in use
CodexConsole.Print(0, 1, "endscene procedure was called.");
}

public void exitstatechanged()
{
//This is called when ever the CloseExit(); or OpenExit(); commands are used.

//Message showing this procedure when in use
CodexConsole.Print(0, 1, "exitstatechanged procedure was called.");
}

public void tick(float tick)
{
//Message showing this procedure when in use
CodexConsole.Print(0, 1, "tick procedure was called.");
}

public void startup(float unknown)
{
//Message showing this procedure when in use
CodexConsole.Print(0, 1, "startup procedure was called.");
}

public void shutdown(float unknown)
{
//Message showing this procedure when in use
CodexConsole.Print(0, 1, "shutdown procedure was called.");
}

public void effectstarted(int actorGuid, int effectGuid, int creatorGuid, int duration)
{
/*
This is called from the effect script that has just been added
to an actor through the actor.AddActorEffect() command.

Check CodexActor command list for more information on that command.

Also check the effects.ned file located in misc folder of Resources.nob file
for a list of effects and how scripts are applied to them.

actorGuid: The person affected by the effect
effectGuid: The guid ID of the effect itself - Never a codex object though
creatorGuid: The one designated as the creator from the actor.AddActorEffect() command.
duration: The duration in milliseconds of the effect.
*/

//Message showing this procedure when in use
CodexConsole.Print(0, 1, "effectstarted procedure was called.");
}

public void effectended(int actorGuid, int effectGuid, int creatorGuid, int reason)
{
/*
This is called when an effect ends.

actorGuid: The person affected by the effect
effectGuid: The guid ID of the effect itself
creatorGuid: The one designated as the creator from the actor.AddActorEffect() command.
reason: Never used. I tested it awhile back ago. Always equals 0 in console.

This ending is instant and will kill the script after this procedure is done
so don't bother setting any timers. Commands are limited here.
*/

//Message showing this procedure when in use
CodexConsole.Print(0, 1, "effectended procedure was called.");
}

public void created(int guid)
{
/*
Called when an object is first created.

guid: The object created.
*/

SetTimer(10);

//Message showing this procedure when in use
CodexConsole.Print(0, 1, "created procedure was called.");
}

public void destroyed(int guid, int captureID)
{
/*
Called when an object is destroyed.

This occurs when dead enemies fade away or when the ST deletes something.

guid: The object destroyed.
captureID: The thing that is tracking this thing
*/

//Message showing this procedure when in use
CodexConsole.Print(0, 1, "destroyed procedure was called.");
}

public void clicked(int guid, int clickerGuid, int captureID)
{
/*
This is called when the object is clicked

guid: The thing that was clicked
clickerGuid: The person that clicked the thing
captureID: The thing that is tracking this thing
*/

//Message showing this procedure when in use
CodexConsole.Print(0, 1, "clicked procedure was called.");
}

public void arrived(int thingGuid, int frameNum, int captureID)
{
/*
This is called when a door stops at the edge of its frame or
when an actor stops walking or running.

thingGuid: The thing or person that has reached a location
frameNum: Only checked by objects that have frames setup by embrace map editor
captureID: The thing that is tracking this thing
*/

//Message showing this procedure when in use
CodexConsole.Print(0, 1, "arrived procedure was called.");
}

public void triggered(int triggeredGUID, int triggererGUID, int triggerID, float p0, float p1, float p2, float p3, int captureID)
{
/*
This is my favorite. It does what all the others don't. See all these variables to work with?
Plenty of options! This is called when something uses a Trigger(0, 0, 0.0F, 0.0F, 0.0F, 0.0F);
command on the thing that has this procedure on it. It's very open ended.

triggeredGUID: The thing that is triggered.
triggererGUID: The thing that used the Trigger(0, 0, 0.0F, 0.0F, 0.0F, 0.0F); command on this thing.
triggerID: What ever you want it to be. Open ended input variable.
p0 - p3: What ever float value you input for the trigger command. Very open ended.
captureID: The thing that is tracking this thing

This is more for the advanced users, but anyone with an emense imagination
can come up with endless possibilities for this procedure. It's
Vampire - Redemption's best procedure.
*/

//Message showing this procedure when in use
CodexConsole.Print(0, 1, "triggered procedure was called.");
}

public boolean pickup(int itemGuid, int pickerGuid, int captureID)
{
/*
This is called when an item is picked up.

itemGuid: The item that's being picked up
pickerGuid: The person who is trying to pick the item
captureID: The thing that is tracking this thing

This procedure requires a return value (true or false).

If the value is true then the item is successfully picked up.
If the value is false then item will not pickup.
*/

//All itemGuid objects should be assigned to a CodexItem object
//Example of itemGuid application:
CodexItem item = new CodexItem(itemGuid);

//Message showing this procedure when in use
CodexConsole.Print(0, 1, "pickup procedure was called.");

//Sample return
return(true); //true or false only
}

public boolean dropped(int itemGuid, float x, float y, float z, int captureID)
{
//Message showing this procedure when in use
CodexConsole.Print(0, 1, "dropped procedure was called.");

return(true);
}

public boolean used(int itemGuid, int userGuid, int captureId)
{
//Message showing this procedure when in use
CodexConsole.Print(0, 1, "used procedure was called.");

return(true);
}

public boolean actorcanuse(int itemGuid, int wearerGuid, int captureId)
{
//Message showing this procedure when in use
CodexConsole.Print(0, 1, "actorcanuse procedure was called.");

return(true);
}

public boolean canuse(int itemGuid, int wearerGuid, int captureId)
{
//Message showing this procedure when in use
CodexConsole.Print(0, 1, "canuse procedure was called.");

return(true);
}

public void worn(int itemGuid, int wearerGuid, int captureId)
{
/*
Called whenever someone equips the item.

itemGuid: The item being worn
wearerGuid: The one who put the item on
captureId: The thing that is tracking this thing
*/

//Message showing this procedure when in use
CodexConsole.Print(0, 1, "worn procedure was called.");
}

public boolean unworn(int itemGuid, int wearerGuid, int captureId)
{
/*
Called when an item is unequipped

itemGuid: The item that was unequipped
wearerGuid: The one who is taking off the item
captureId: The thing that is tracking this thing

This is another procedure that requires a return value.

Setting the return to true allows the item to be unequipped.
Setting it to false forces the player to wear the item.
Great for cursed items!
*/

//Message showing this procedure when in use
CodexConsole.Print(0, 1, "unworn procedure was called.");

//Sample return
return(true); //true or false only
}

public void actorworn(int itemGuid, int wearerGuid, int captureID)
{
//Message showing this procedure when in use
CodexConsole.Print(0, 1, "actorworn procedure was called.");
}

public boolean actorunworn(int itemGuid, int wearerGuid, int captureId)
{
//Message showing this procedure when in use
CodexConsole.Print(0, 1, "actorunworn procedure was called.");

return(true);
}

public void touched(int guid, int toucherGuid, int captureID)
{
/*
Called by an object that has a THING_FLAG_PROXIMITYTRIGGER flag
with a PROXYRADIUS set in NOT Editor. Anyone who is
an npc or player caught within the proxy radius of an
object calls this procedure.

guid: The object that has the proxy radius set on it
toucherGuid: The npc or player who stepped within the proxy distance of the object
captureID: The thing that is tracking this thing
*/

//Message showing this procedure when in use
CodexConsole.Print(0, 1, "touched procedure was called.");
}

public void pathended(int clientGuid)
{
/*
Called when a CodexCamera.PlayPath() ends. Check CodexCamera
commands for more info as well as the NOD SDK docs under
'Creating a cutscene'

clientGuid: The player who was shown the camera path
*/

//Message showing this procedure when in use
CodexConsole.Print(0, 1, "pathended procedure was called.");
}

public void entered(int guid, int causeGUID, int captureID)
{
/*
Called when ever someone enters a Region thing. Often used
to trigger cutscenes.

guid: The region that called this procedure
causeGUID: The one who entered the region
captureID: The thing that is tracking this thing
*/

//Message showing this procedure when in use
CodexConsole.Print(0, 1, "entered procedure was called.");
}

public void exited(int guid, int causeGuid, int captureID)
{
/*
Called when ever someone exits a Region thing.

guid: The region that called this procedure
causeGUID: The one who left the region
captureID: The thing that is tracking this thing
*/


//Message showing this procedure when in use
CodexConsole.Print(0, 1, "exited procedure was called.");
}

public void convreached(int starterGuid, int curEvent, int curLine, int lineDuration, int speakerGuid)
{
/*
This is called whenever the ExecuteConversation() command is used. Check Codex for more info
on this command. This will call for each EVENT and LINE in the nco file.

starterGuid: The one designated as starterGuid in the ExecuteConversation command
curEvent: The EVENT we are currently on from the nco file.
NOTE: This a numbered event and not a named event. Numbered from 0 to (last number)
curLine: The LINE we are currently on from the nco file.
NOTE: This is numbered from 0 to (last number) in LINE order instead of named.
lineDuration: It sets a time duration (in milliseconds?) based on the length of the LINE as defined in the nvo file.
speakerGuid: The one currently speaking
*/

//Message showing this procedure when in use
CodexConsole.Print(0, 1, "convreached procedure was called.");
}

public void convended(int starterGuid,  boolean bAborted , int returnValue)
{
/*
This is called when the conversation ends.
No more EVENTS or LINES to run from the last nco file.

starterGuid: The one originally designated as starterGuid in the ExecuteConversation command.
bAborted: Checks whether the conversation was esc'ed out. true or false
returnValue: This is set based on the ANSWERRETURN value from the nco file.
*/

//Message showing this procedure when in use
CodexConsole.Print(0, 1, "convended procedure was called.");
}

public void convchosen(int starterGuid, int eventNum, int lineChosen, int lineDuration, int speakerGuid)
{
//Message showing this procedure when in use
CodexConsole.Print(0, 1, "convchosen procedure was called.");
}

public void awaken(int guid, int causeID, int captureId)
{
//Message showing this procedure when in use
CodexConsole.Print(0, 1, "awaken procedure was called.");
}

public void beginswing(int attackerGuid, int targetGuid, int speed, int captureID)
{
//Message showing this procedure when in use
CodexConsole.Print(0, 1, "beginswing procedure was called.");
}

public void videoended(int ID)
{
//Message showing this procedure when in use
CodexConsole.Print(0, 1, "videoended procedure was called.");
}

public void hit(int damagerGUID, int damagedGUID, float damageAmount, int captureID)
{
/*
Called when a MELEE attack successfully struck a target. Applied only to MELEE weapons. NOT PROJECTILES.

damagerGUID: The npc or player who attacked.
damagedGUID: The npc or player who was attacked.
damageAmount: The amount of damage the weapon intends to do. (BEFORE SOAK IS CALCULATED)
captureID: The thing that is tracking this weapon
*/

//Message showing this procedure when in use
CodexConsole.Print(0, 1, "hit procedure was called.");
}

public float damaged(int guid, int causeGuid, float damageAmount, int damageType, int captureId)
{
CodexActor actor = new CodexActor(guid);
CodexProjectile bullet = new CodexProjectile(causeGuid);
int shooterGuid = bullet.GetProjectileOwner();

if((bullet.GetProjectileFlags() & PROJ_BULLET) != 0)
{
if(actor.GetActorType() == ACTOR_TYPE_VAMPIRE)
actor.DamageActor(damageAmount, DAMAGE_TYPE_NORMAL, shooterGuid);
else
actor.DamageActor(damageAmount, DAMAGE_TYPE_LETHAL, shooterGuid);

return 0;
}

if(actor.GetActorType() == ACTOR_TYPE_VAMPIRE && damageType == 0)
damageAmount *= 0.5f;

String types[] = {"normal", "lethal", "aggravated", "electric", "fire", "sun", "faith", "cold", "poison", "disease"};

//Message showing this procedure when in use
CodexConsole.Print(0, 1, "damaged procedure was called. Amount = " + (int)damageAmount + ", Type = " + types[damageType]);

return (int)damageAmount;
}

public float soaked(int guid, int causeGUID, float damageAmount, int damageType, float soakAmount, int captureID)
{
//Message showing this procedure when in use
CodexConsole.Print(0, 1, "soaked procedure was called. Amount = " + (int)soakAmount);

return (int)soakAmount;
}

public void killed(int guid, int causeID, int captureID)
{
/*
Called when an npc or player dies or enters torpor.

guid: The one who was killed.
causeID: The one who did the kill -
NOTE: Projectiles work differently and that you'll need to get the OWNER of a projectile
to get the true killer (causeID).
captureID: The thing that is tracking this thing
*/

//Sample script for projectile kills:
//First assume the killer is an actor
CodexActor killer = new CodexActor(causeID);

//Make another Codex object for a possible projectile source
CodexProjectile bullet = new CodexProjectile(causeID);

//Now lets check to see if the  KILLER is actually a projectile
if(killer.GetThingType() == THING_TYPE_PROJECTILE)
{
//If so then change the killer to the OWNER of the projectile
killer = new CodexActor(bullet.GetProjectileOwner());

//We used the bullet object because it's setup for CodexProjectile commands.
//You can't use CodexProjectile commands on CodexActors or CodexPlayers.
}

//Print a message showing the name of the killer
if(causeID != 0)
CodexConsole.Print(0, 2, killer.GetName() + " made a kill!");

//Message showing this procedure when in use
CodexConsole.Print(0, 1, "killed procedure was called.");
}

public boolean buysellquery(boolean cansell, int itemGuid)
{
//Message showing this procedure when in use
CodexConsole.Print(0, 1, "buysellquery procedure was called.");

return(true);
}

public void buysellended(boolean bAborted)
{
//Message showing this procedure when in use
CodexConsole.Print(0, 1, "buysellended procedure was called.");
}

public void keytag(int guid, int tag, int captureID)
{
//Message showing this procedure when in use
CodexConsole.Print(0, 1, "keytag procedure was called.");
}

public void actorcast(int casterGUID, String disciplineName, int level, int castNum, int captureID)
{
//Message showing this procedure when in use
CodexConsole.Print(0, 1, "actorcast procedure was called.");
}

public void actorfeed(int actorGUID, int targetGUID, int status, int captureID)
{
//Message showing this procedure when in use
CodexConsole.Print(0, 1, "actorfeed procedure was called.");
}

public void advance(int scene, int subscene)
{
//Message showing this procedure when in use
CodexConsole.Print(0, 1, "advance procedure was called.");
}

public void stcommand(String text, int param, float arg0, float arg1, float arg2, float arg3)
{
CodexActor actor = new CodexActor(GetClassThing());

if(text.equalsIgnoreCase("type"))
actor.SetActorType(param);

//Message showing this procedure when in use
CodexConsole.Print(0, 1, "stcommand procedure was called.");
}

public void stcommand2(String text)
{
//Message showing this procedure when in use
CodexConsole.Print(0, 1, "stcommand2 procedure was called.");
}

public void weatherchange()
{
//Message showing this procedure when in use
CodexConsole.Print(0, 1, "weatherchange procedure was called.");
}

public void timer(int timerID, float arg0, float arg1, float arg2, float arg3)
{
/*
Called when a SetTimer(time in seconds); command expires.

timerID: This is set by the SetTimer command.
Example: SetTimer(1, 1); the first is the timer the second is the timerID

arg0 - arg3: Works similar to the timerID variable. Setup like so:
time   timerID  arg0 arg1 arg2 arg3
SetTimer(1, 1, 0, 1, 2, 3); Input what ever numbers you want.

This is a pretty open ended command and is commonly used in pretty much all scripts.
*/

//Message showing this procedure when in use
CodexConsole.Print(0, 1, "timer procedure was called.");
}

public void save(int flags)
{
/*
Called when someone saves the game. This is mainly used to
store custom module level variables. Look at top for example variables.

flags: A hex flag. Never seen it used.
*/

//This is how you store variables.
CodexSequence.SaveInt(myValue);
CodexSequence.SaveBoolean(myBoolean);

//Only booleans and integers are given as examples
//but the system can store other types as well.
//Check CodexSequence for more info.
}

public void restore(int flags)
{
/*
Called when someone saves the game. This is mainly used to
store custom module level variables. Look at top for example variables.

flags: A hex flag. Never seen it used.
*/

//This is how you restore variables.
myValue = CodexSequence.RestoreInt();
myBoolean = CodexSequence.RestoreBoolean();

//Only booleans and integers are given as examples
//but the system can restore other types as well.
//Check CodexSequence for more info.
}

public void restored(int flags)
{
/*
Called when the game is completely restored from a save.
Kind of a redundant command I think.

flags: A hex flag. Never seen it used.
*/

//You could use this to start a timer - some scripts that stop on
//a restored game need a special nudge to get started again.
SetTimer(1);

//Scripts that use timers tend to stop on a restored game. Even the
//lawmen who patrol Prague have to use a timer on restore to start
//moving again. So this comes in handy.
}
}


Attached to this post are my notes on the various procedures Redemption reads from java scripts into its engine events.
« Last Edit: 2010-03-10, 13:34:26 by Javokis »
Logged
"There's nothing wrong with horses dicks, there's nothing wrong with sucking horses dicks." -Signo
 

Page created in 0.066 seconds with 17 queries.