Basically the script does everything but turn the shapeshifted player back into human form. I've been messing withthis script for days and now i have hit a wall. Help please!use uo;
use os;
include ":System:Include/Client";
program DotCommand( who)
var i;
var graphic, color;
// var splitText := array;
var shapeChanger;
var changeGraphic;
var normalGraphic;
var critterGraphic;
var humanGraphic;
var normalColor;
var critterColor;
var changeColor;
// var objtype;
shapeChanger := GetObjProperty( who, TGTOPT_NOCHECK_LOS );
if (GetObjProperty( who, "SubRaceName" ) == "Cat")
graphic := 0xC9 ;
color := 1113 ;
SendSysMessage( who, "You morph into a feline" );
elseif (GetObjProperty( who, "SubRaceName" ) == "Wolf")
graphic := 0xE1 ;
color := 1100 ;
SendSysMessage( who, "You morph into a wolf" );
elseif (GetObjProperty( who, "SubRaceName" ) == "Dragon")
graphic := 0x3B ;
color := 1128 ;
SendSysMessage( who, "You morph into a dragon" );
else return;
endif
SetObjProperty( shapeChanger, "normalgraphic", shapeChanger.graphic );
SetObjProperty( shapeChanger, "crittergraphic", graphic );
SetObjProperty( shapeChanger, "skincolor", shapeChanger.color );
SetObjProperty( who, "crittercolor", color );
normalGraphic := GetObjProperty( who, "normalgraphic" ) ;
critterGraphic := GetObjProperty( who, "crittergraphic" );
normalColor := GetObjProperty( who, "skincolor" );
critterColor := GetObjProperty( who, "critterColor" );
if ( who.graphic == critterGraphic );
changeGraphic := normalGraphic;
changeColor := normalColor;
who.color := changeColor;
who.graphic := changeGraphic;
SendSysMessage( who, "You morph into a human" );
else
changeGraphic := critterGraphic;
changeColor := critterColor;
who.graphic := changeGraphic;
who.color := changeColor;
SendSysMessage( who, "You morph into a animal" );
endif
endprogram
Helping with a Shapeshifting script
Helping with a Shapeshifting script
Try this revised version.
You were setting the normal graphic to the users current graphic upon entering the script. Which if they were already morphed just kept them morphed. Plus you have some references to the var "shapeChanger" instead of "who" in some of your objectproperty function calls.
Not sure what this line at the beginning was for either "shapeChanger := GetObjProperty( who, TGTOPT_NOCHECK_LOS )".
Anyway, I think it works now.
Oh and try to use tabs when creating source code. It makes it so much more readable. Also the code button works better for posting source code than the quote button.
Code: Select all
use uo;
use os;
include ":System:Include/Client";
program DotCommand( who)
var i;
var graphic, color;
// var splitText := array;
var shapeChanger;
var changeGraphic;
var normalGraphic;
var critterGraphic;
var humanGraphic;
var normalColor;
var critterColor;
var changeColor;
// var objtype;
// shapeChanger := GetObjProperty( who, TGTOPT_NOCHECK_LOS );
if (GetObjProperty( who, "SubRaceName" ) == "Cat")
graphic := 0xC9 ;
color := 1113 ;
SendSysMessage( who, "You morph into a feline" );
elseif (GetObjProperty( who, "SubRaceName" ) == "Wolf")
graphic := 0xE1 ;
color := 1100 ;
SendSysMessage( who, "You morph into a wolf" );
elseif (GetObjProperty( who, "SubRaceName" ) == "Dragon")
graphic := 0x3B ;
color := 1128 ;
SendSysMessage( who, "You morph into a dragon" );
else
return;
endif
if (!GetObjProperty ( who, "crittergraphic"))
SetObjProperty( who, "normalgraphic", who.graphic );
SetObjProperty( who, "crittergraphic", graphic);
SetObjProperty( who, "skincolor", who.color );
SetObjProperty( who, "crittercolor", color );
endif
normalGraphic := CInt(GetObjProperty( who, "normalgraphic") ) ;
critterGraphic := CInt(GetObjProperty( who, "crittergraphic" ));
normalColor := GetObjProperty( who, "skincolor" );
critterColor := GetObjProperty( who, "critterColor" );
if ( who.graphic == critterGraphic );
changeGraphic := normalGraphic;
changeColor := normalColor;
who.color := changeColor;
who.graphic := changeGraphic;
EraseObjProperty( who, "normalgraphic");
EraseObjProperty( who, "crittergraphic");
EraseObjProperty( who, "skincolor");
EraseObjProperty( who, "crittercolor");
SendSysMessage( who, "You morph into a human" );
else
changeGraphic := critterGraphic;
changeColor := critterColor;
who.graphic := changeGraphic;
who.color := changeColor;
SendSysMessage( who, "You morph into a animal" );
endif
endprogram
You were setting the normal graphic to the users current graphic upon entering the script. Which if they were already morphed just kept them morphed. Plus you have some references to the var "shapeChanger" instead of "who" in some of your objectproperty function calls.
Not sure what this line at the beginning was for either "shapeChanger := GetObjProperty( who, TGTOPT_NOCHECK_LOS )".
Anyway, I think it works now.
Oh and try to use tabs when creating source code. It makes it so much more readable. Also the code button works better for posting source code than the quote button.
Code: Select all
use uo;
use os;
include ":System:Include/Client";
program DotCommand( who)
var i;
var graphic, color;
var changeGraphic;
var normalGraphic;
var critterGraphic;
var normalColor;
var critterColor;
var changeColor;
if (GetObjProperty( who, "SubRaceName" ) == "Cat")
graphic := 0xC9 ;
color := 1113 ;
elseif (GetObjProperty( who, "SubRaceName" ) == "Wolf")
graphic := 0xE1 ;
color := 1100 ;
elseif (GetObjProperty( who, "SubRaceName" ) == "Dragon")
graphic := 0x3B ;
color := 1128 ;
else
return;
endif
if (!GetObjProperty ( who, "crittergraphic"))
SetObjProperty( who, "normalgraphic", who.graphic );
SetObjProperty( who, "crittergraphic", graphic);
SetObjProperty( who, "normalcolor", who.color );
SetObjProperty( who, "crittercolor", color );
endif
normalGraphic := CInt(GetObjProperty( who, "normalgraphic") ) ;
critterGraphic := CInt(GetObjProperty( who, "crittergraphic" ));
normalColor := GetObjProperty( who, "normalcolor" );
critterColor := GetObjProperty( who, "critterColor" );
if ( who.graphic == critterGraphic );
EraseObjProperty( who, "crittergraphic");
EraseObjProperty( who, "crittercolor");
changeGraphic := normalGraphic;
changeColor := normalColor;
who.color := changeColor;
who.graphic := changeGraphic;
SendSysMessage( who, "You morph into a human" );
else
changeGraphic := critterGraphic;
changeColor := critterColor;
who.graphic := changeGraphic;
who.color := changeColor;
SendSysMessage( who, "You morph into a animal" );
endif
endprogramI have tested my version with all three categories of SubRaceName and it works fine for me switching back and forth from human to critter.
The only difference between my version on my machine and the one I posted is my client.inc file's location. However I commented out the include statement for that and got a good compile. So apparently there is no need to include the client.inc anyway.
The only difference between my version on my machine and the one I posted is my client.inc file's location. However I commented out the include statement for that and got a good compile. So apparently there is no need to include the client.inc anyway.
Just a quick note:
You will have to start from a normal graphic in order for my script to work. It assumes that you are not morphed the first time you use it. So if you are testing it with a character that was morphed with your version you won't change back to human. First set your proper graphic (0x191 for female or 0x190 for male) and your proper colour. Then test my script.
Uhm...well, it was supposed to be a quick note.

You will have to start from a normal graphic in order for my script to work. It assumes that you are not morphed the first time you use it. So if you are testing it with a character that was morphed with your version you won't change back to human. First set your proper graphic (0x191 for female or 0x190 for male) and your proper colour. Then test my script.
Uhm...well, it was supposed to be a quick note.