Page 1 of 1
Totem
Posted: Wed Aug 20, 2008 12:20 pm
by lokaum
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?
Re: Totem
Posted: Wed Aug 20, 2008 12:28 pm
by ncrsn
To help you, most of us need to see the totem script. If you can show it to us it'd make things so much easier.
Re: Totem
Posted: Wed Aug 20, 2008 12:40 pm
by lokaum
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);
endprogram
All things are OK... but it doesn't work =/
Re: Totem
Posted: Thu Aug 21, 2008 12:14 am
by CWO
if the NPC isn't created, where you have
SendSysMessage(who,"Canceled");
change it to
SendSysMessage(who,CStr(it.errortext));
it will tell you why the creation failed.
Re: Totem
Posted: Fri Aug 22, 2008 7:29 am
by lokaum
The problem is, the script Totem.src don't be executed!
The player only do the action and the effect dispel is showed, because the message Canceled don't be showed...
And now?
Re: Totem
Posted: Sat Aug 23, 2008 1:37 am
by Yukiko
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.
Re: Totem
Posted: Mon Aug 25, 2008 2:16 pm
by lokaum
I Found the problem!!
The NPC template "humuc" did'nt work... but now i fixed it!!
Thanks!!