PDA

View Full Version : just a AI-code question


alysia
19.12.2006, 18:58
this is just something for fun but it doesn't work...

it should be on a summon (with a skill button) that recalls the target (npc or player) to the summon position (like porta in cruma tower)

but the problem is that the part here doesn't work I always get a server error

NPCINSTANTTELEPORT cannot find NPC



here the part for the teleport


push_event // myself
push_const 704
add
fetch_i
push_event // myself
push_const 704
add
fetch_i // master
push_const 552
add
fetch_i // target_id
push_const 444
add
fetch_i4
push_event // myself
push_const 704
add
fetch_i
push_event // myself
push_const 704
add
fetch_i // sm
push_const 544
add
fetch_i // x
push_const 8
add
fetch_d
func_call 184615005 // func[FloatToInt]
shift_sp -1
push_event // myself
push_const 704
add
fetch_i
push_event // myself
push_const 704
add
fetch_i // sm
push_const 544
add
fetch_i // y
push_const 16
add
fetch_d
func_call 184615005 // func[FloatToInt]
shift_sp -1
push_event // myself
push_const 704
add
fetch_i
push_event // myself
push_const 704
add
fetch_i // sm
push_const 544
add
fetch_i // z
push_const 24
add
fetch_d
func_call 184615005 // func[FloatToInt]
shift_sp -1
func_call 184811596 // func[InstantTeleport]
shift_sp -4
shift_sp -1




thx for help

hr
19.12.2006, 21:01
imho instead of "myself.master.target_id" try "myself->GetCreatureFromIndex(myself.master.target_id)"

alysia
02.01.2007, 16:42
happy new year :)

ok i tried a diffrent method but still the same error



here the code


push_event // i0
push_const 260
add
push_reg_sp
fetch_i
push_event // myself
push_const 704
add
fetch_i // master
push_const 552
add
fetch_i // target_index
push_const 440
add
fetch_i4
assign4
shift_sp -1
push_event // i0
push_const 260
add
fetch_i4
push_const 0
less_equal
branch_false L122101
L122100
exit_handler
L122101
push_event // c0
push_const 344
add
push_reg_sp
fetch_i
push_event // myself
push_const 704
add
fetch_i
push_event // i0
push_const 260
add
fetch_i4
func_call 184614954 // func[GetCreatureFromIndex]
shift_sp -1
assign
shift_sp -1
push_event // c0
push_const 344
add
fetch_i
branch_false L122103
L122102
L122105
push_event // myself
push_const 704
add
fetch_i
push_event // myself
push_const 704
add
fetch_i // master
push_const 552
add
fetch_i // target_id
push_const 444
add
fetch_i4
push_parameter x_loc
push_parameter y_loc
push_parameter z_loc
func_call 184811596 // func[InstantTeleport]
shift_sp -7
shift_sp -1



but still a server-error: NpcInstantTeleport cannot find npc

m4rk
02.01.2007, 16:51
try to decompile it with sauron decompiler and check if the result is coherent.

alysia
02.01.2007, 18:56
hmm.... i get only this


class recall : (null)
{
parameter:
int DDMagic = 311297;
int PhysicalSpecial = 311297;
int SkillCastingTime = 2000;
int x_loc = 113658;
int y_loc = 15289;
int z_loc = 10080;

handler:
EventHandler CREATED()
{
i0 = myself.master.target_index;
if( i0 <= 0 )
{



no more :D

m4rk
02.01.2007, 20:06
I think the code you give must be in
MENU_SELECTED handler and not in CREATED

anyway there seems to be an error in your code, i'll read through it better later.

humordwarf
03.01.2007, 09:32
hmm.... i get only this


class recall : (null)
{
parameter:
int DDMagic = 311297;
int PhysicalSpecial = 311297;
int SkillCastingTime = 2000;
int x_loc = 113658;
int y_loc = 15289;
int z_loc = 10080;

handler:
EventHandler CREATED()
{
i0 = myself.master.target_index;
if( i0 <= 0 )
{



no more :D


your code:

i0=myself.master.target_index;
if (i0 <= 0) {
return;
}
c0=myself.GetCreatureFromIndex(i0);
if (c0) {
myself.InstantTeleport(myself.master.target_id, x_loc, y_loc, z_loc);
}


declaration: void InstantTeleport(CSharedCreatureData, int, int, int);
change it maybe to "myself.InstantTeleport(c0, x_loc, y_loc, z_loc);" ?