replacing functions
(now we replace a already existing function)
a) replacing an npcs functions
(note that -HolyAddHere is an existant weapon that i have got on my char )
<script of any npc>
PHP Code:
//#CLIENTSIDE
function onCreated()
{
("-HolyAddHere").cTest = function()
{
player.chat = "a";
};
("-HolyAddHere").callFunction( "cTest" );
}
<script of -HolyAddHere>
PHP Code:
//#CLIENTSIDE
public function callFunction( funcN )
{
(@ funcN)();
}
function cTest()
{
player.chat = "b";
}
works with servside npcs too
b) replacing a standard graal function
k, lets say if you do setani( "meh", "" ); the player will say "meh"... impossible? nooo
<script of some npc>
PHP Code:
//#CLIENTSIDE
function onCreated()
{
this.setani = function( ani, aniparams )
{
player.chat = ani;
};
setani( "meh", "" );
}
or from servside:
<script of some npcs>
PHP Code:
function onCreated()
{
this.sendtorc = function( msg )
{
echo( "NPC-Serv wants to say:" @ msg );
};
sendtorc( "meh" );
}