Hi people,
I Have a problem... i create the totem and the elixer..
when I do 2 clicks in totem, my player only do the action that totem's created..
But the totem is not created!
Can anyone help me?
Totem
Re: Totem
Code: Select all
use uo;
use os;
include "include/client";
include "include/attributes";
program totem(who, totem)
if(!ReserveItem(totem)) return; endif
var npctemplate := GetObjProperty(totem,"critter");
var parms := {};
parms .+ script := "tamed";
Detach();
var it := CreateNpcFromTemplate("totem", who.x -1, who.y+1, who.z, parms);
if (!it)
it := CreateNpcFromTemplate("totem", who.x +1, who.y-1, who.z, parms);
if (!it)
SendSysMessage(who,"Canceled");
return;
endif
endif
SetObjProperty( it, "summoned", 1 );
SetObjProperty( it, "animated", 1 );
SetObjProperty( it, "totem", totem.objtype );
SetObjProperty( it, "totemcolor", totem.color );
SetObjProperty( it, "master", who.serial );
SetObjProperty( it, "script", it.script );
it.setmaster( who );
it.script := "tamed";
it.name := totem.name;
it.color := CInt(GetObjProperty( totem, "critcolor" ));
if ( GetObjProperty(totem,"totemhp") )
SetHp(it, CInt(GetObjProperty(totem,"totemhp")));
endif
PlaySoundEffect( who, SFX_SPELL_DISPEL );
PlayStationaryEffect( it.x, it.y, it.z, FX_SMOKE, 0xa, 0xa );
DestroyItem(totem);
RestartScript(it);
endprogramRe: Totem
I don't see any lines that cause a player to perform an action. I gather that drinking the elixir is supposed to summon the NPC. You might try CWO's idea but put the "SendSysMessage(who,CStr(it.errortext));" just before the "PlaySoundEffect( who, SFX_SPELL_DISPEL );" statement. This way if the CreateNPCFrom Template function is returning an error you should get the errortext telling you what it is.