Totem.src
Posted: Fri Apr 06, 2012 4:51 pm
Hey guys, unfortunately me again
i was wondering if i could grab some help with my totem.src script in dundee(for the craftable mounts/totems). right now the script keeps getting hung up when im double clicking an obsidian mount, it keeps saying im already mounted... this is in the "mountsteed" function where it says
The script is replying that im already mounted, but i havnt got any mounts what so ever when ive tested this script.
Heres the script ive got:
Any help is much appreciated
Code: Select all
mount.name := totem.name;
if (!EquipItem(who,mount))
SendSysMessage( who, "You cannot use that while mounted!");
return;
endifHeres the script ive got:
Code: Select all
program totem (who, totem)
if (!ReserveItem (totem))
SendSysMessage (who, "You can't use this right now.");
return;
endif
if (!totem.movable)
SendSysMessage (who, "You can't use this while its locked down!");
return;
endif
if (GetObjProperty (totem, "broken"))
SendSysMessage (who, "It seems to be broken.");
return;
endif
case ( totem.objtype )
0x2124:
0x20f6:
0x2136:
MountSteed( who, totem );
return;
0x2121:
var newtotem := CreateItemInContainer (who.backpack, 0x2124, 1);
if ( GetObjProperty (totem, "critter") == "obsidiangolem")
newtotem.name := "an obsidian golem";
newtotem.name := "an obsidian drake";
SetObjProperty (newtotem, "critter", "obsidiansteed");
SetObjProperty (newtotem, "critcolor", 2498);
newtotem.color := 2498;
newtotem.usescript := ":dundee:totem";
SetObjProperty (newtotem, "totemhp", 250);
newtotem.decay := 0;
newtotem.movable := 1;
destroyitem (totem);
return;
else
newtotem.name := "an porcelain golem";
newtotem.name := "an porcelain deamon";
SetObjProperty (newtotem, "critter", "porcelainsteed");
SetObjProperty (newtotem, "critcolor", 2044);
newtotem.color := 2044;
newtotem.usescript := ":dundee:totem";
SetObjProperty (newtotem, "totemhp", 350);
newtotem.decay := 0;
newtotem.movable := 1;
destroyitem (totem);
return;
endif
endcase
var npctemplate := GetObjProperty (totem, "critter");
if (!npctemplate)
SendSysMessage (who, "There's a problem with this totem. Contact a GM.");
return;
endif
set_critical (1);
var it := SpawnNPCAtLocation (npctemplate, who.x - 1, who.y + 1, who.z, 0, who.realm);
if (!it)
it := SpawnNPCAtLocation (npctemplate, who.x + 1, who.y + 1, who.z, 0, who.realm);
if (!it)
SendSysMessage (who, "Error creating creature - try a different location.");
return;
endif
endif
SetObjProperty (it, "totem", totem.objtype );
SetObjProperty (it, "totemcolor", totem.color );
SetObjProperty (it, "master", who.serial );
if (GetObjProperty (totem, "totemdeaths"))
SetObjProperty (it, "totemdeaths", GetObjProperty (totem, "totemdeaths"));
endif
if (GetObjProperty (totem, "ownerserial"))
SetObjProperty (it, "ownerserial", GetObjProperty (totem, "ownerserial"));
SetObjProperty (it, "ownername", GetObjProperty (totem, "ownername"));
SetObjProperty (it, "oldname", GetObjProperty (totem, "oldname"));
endif
it.setmaster (who);
it.script := "::tamed";
it.name := totem.name;
it.color := GetObjProperty (totem, "critcolor");
it.graphic := GetObjProperty (totem, "critgraphic");
if ( GetObjProperty (totem, "totemhp"))
SetVital (it, "Life", CINT (GetObjProperty (totem, "totemhp") * 100));
endif
PlaySoundEffect (who, SFX_SPELL_DISPEL);
PlayStationaryEffect (it.x, it.y, it.z, FX_SMOKE, 0xA, 0xA, 0, it.realm );
DestroyItem (totem);
RestartScript (it);
set_critical (0);
endprogram
function MountSteed( who, totem )
var mount := CreateItemAtLocation(4550, 3687, REALM_BRITANNIA , 0, 0xF021,1);
mount.color := totem.color;
setobjproperty(mount,"totem",totem.objtype);
var ownerserial := GetObjProperty(totem, "ownerserial");
if ( ownerserial )
var oldname := GetObjProperty(totem, "oldname");
var ownername := GetObjProperty(totem, "ownername");
SetObjProperty( mount, "ownerserial", ownerserial );
SetObjProperty( mount, "oldname", oldname );
SetObjProperty( mount, "ownername", ownername );
endif
// mount.graphic := 0x3ea0;
case ( totem.objtype )
0x2124:
mount.graphic := 0x3ea0;
0x20f6:
mount.graphic := 0x3ea6;
0x2136:
mount.graphic := 0x3ea4;
endcase
mount.name := totem.name;
if (GetEquipmentByLayer( who, 0x19 ))
SendSysMessage( who, "You cannot use that while mounted!");
return;
endif
PlaySoundEffect( who, SFX_SPELL_DISPEL );
PlayStationaryEffect( who.x, who.y, who.z, FX_SMOKE, 0xA, 0xA, 0, who.realm );
DestroyItem(totem);
who.hidden := 0;
endfunction
function NotYours(who,it)
var ownerserial := GetObjProperty(it, "ownerserial");
var ownername;
if (ownerserial)
ownername := GetObjProperty(it, "ownername");
else
return 0;
endif
if ( ownerserial != who.serial )
SendSysMessage (who,"You can't use that, it belongs to "+ownername );
return 1;
endif
return 0;
endfunction
Any help is much appreciated