It is currently Fri Nov 21, 2008 9:17 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: Helping with a Shapeshifting script
PostPosted: Tue Sep 05, 2006 11:33 pm 
Offline

Joined: Sun Aug 27, 2006 6:12 pm
Posts: 14
Quote:
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


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!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 06, 2006 1:37 am 
Offline
Certified POL Expert
User avatar

Joined: Thu Feb 02, 2006 1:41 pm
Posts: 1207
Location: Southern Central USA
Try this revised version.

Code:

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.

_________________
Sincerely,
Yukiko

I know you think you understand what you thought I said but what you heard is not exactly what I meant.

Titus 2:13


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 06, 2006 2:11 am 
Offline

Joined: Sun Aug 27, 2006 6:12 pm
Posts: 14
Code:
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
   
   
endprogram


This is the revised scriptset i came up with, after trying yukiko's revised version. However none of these work and the original problem is still there. Where i can't revert back to human mode. It does go through the human if statement, and obviously something is wrong in there.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 06, 2006 3:43 am 
Offline
Certified POL Expert
User avatar

Joined: Thu Feb 02, 2006 1:41 pm
Posts: 1207
Location: Southern Central USA
I 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.

_________________
Sincerely,
Yukiko

I know you think you understand what you thought I said but what you heard is not exactly what I meant.

Titus 2:13


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 06, 2006 2:42 pm 
Offline
Certified POL Expert
User avatar

Joined: Thu Feb 02, 2006 1:41 pm
Posts: 1207
Location: Southern Central USA
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.
:P

_________________
Sincerely,
Yukiko

I know you think you understand what you thought I said but what you heard is not exactly what I meant.

Titus 2:13


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 06, 2006 2:47 pm 
Offline
POL Developer
User avatar

Joined: Sun Feb 12, 2006 9:50 pm
Posts: 836
Location: Indiana, USA
ANd it may be a really good idea, to make it just "undo" them back to human if they are already morphed, and cast it again. That is a good way to keep the info straight on them

_________________
POL Developer - The Penguin Scripter


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 06, 2006 4:37 pm 
Offline
Certified POL Expert
User avatar

Joined: Thu Feb 02, 2006 1:41 pm
Posts: 1207
Location: Southern Central USA
Yes you're right Maud. Had I given more time to the script I would have rewritten it entirely but I was trying to get it operational for them AQAP (As Quickly As Possible). Might do a revised version anyway as I am going to implement something like this on my shard *cough* when I get a chance.

:P

_________________
Sincerely,
Yukiko

I know you think you understand what you thought I said but what you heard is not exactly what I meant.

Titus 2:13


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 06, 2006 5:03 pm 
Offline
POL Developer
User avatar

Joined: Sun Feb 12, 2006 9:50 pm
Posts: 836
Location: Indiana, USA
Liar, you just want to sail the stars in malas, don't lie. :)

_________________
POL Developer - The Penguin Scripter


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 06, 2006 8:17 pm 
Offline
Certified POL Expert
User avatar

Joined: Thu Feb 02, 2006 1:41 pm
Posts: 1207
Location: Southern Central USA
Nah! I just want to stay the top poster on the Penultima OnLine Forums.

*grins*


Well, sailing the stars would be really sweet too.

*giggles*

_________________
Sincerely,
Yukiko

I know you think you understand what you thought I said but what you heard is not exactly what I meant.

Titus 2:13


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 07, 2006 2:48 am 
Offline
User avatar

Joined: Sat Feb 04, 2006 8:17 am
Posts: 147
Location: Illinois, USA
I just got back to this topic and there is already a script made for this. It was created by Mithril for Sanctuary and would need some slight modifications for what you need here.

But it appears that it is already done so good luck.

_________________
2nd place is the 1st loser.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 07, 2006 3:26 am 
Offline

Joined: Sun Aug 27, 2006 6:12 pm
Posts: 14
sorry guys, thanks for your help. But i had this solved a few hours after my last post.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 07, 2006 6:03 pm 
Offline
Certified POL Expert
User avatar

Joined: Thu Feb 02, 2006 1:41 pm
Posts: 1207
Location: Southern Central USA
That's alright. I need all the practice I can get with gumps.

_________________
Sincerely,
Yukiko

I know you think you understand what you thought I said but what you heard is not exactly what I meant.

Titus 2:13


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 07, 2006 6:29 pm 
Offline
POL Developer
User avatar

Joined: Sun Feb 12, 2006 9:50 pm
Posts: 836
Location: Indiana, USA
You post spammer! You are just trying to build your post count! I KNEW IT!

Ok, so maybe I am to, eat me :)

_________________
POL Developer - The Penguin Scripter


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl