Page 1 of 1

I few easy modifications. Please check inside

Posted: Fri May 12, 2006 11:32 am
by Damien
Hello!
I've been watching this topic:
http://forums.polserver.com/viewtopic.php?t=201

and I checked at the script and changed it to my x1y1x2y2 in that zone i want it to be noloot.

Everything ecompiles and so on BUT it dont work...

So i wonder if someone see anything that need a modification.

Here it is:

Code: Select all

use uo; 


program noloot( who, corpse, item ) 

var serial := cint(GetObjProperty(corpse, "serial")); 
var komp := getobjproperty(corpse, "npctemplate"); 

if( serial == who.serial ) 
        return 1;    

elseif(komp)
        return ; 

elseif(corpse.x >= 5390 && corpse.y >= 1262 && corpse.x<=5376 && corpse.y<=1279 )
        
        SendSysMessage(who, "Restricted Area! Can't loot!",3,40); 
        return 0; 
else 


return 1; 
endif 


endprogram

And in Config/Itemdesc :

Code: Select all

Container 0x2006
{
    Name                Corpse
    Gump                0x0009
    MinX                20
    MaxX                80
    MinY                85
    MaxY                165
    ControlScript       corpseControl
    RequiresAttention   0
    DecayOnMultis       1
    SaveOnExit          0
    CanRemoveScript     ::noloot 
}
I can't find anything wrong ;(

It makes other people be able to loot my corpse and this message:
SendSysMessage(who, "Restricted Area! Can't loot!",3,40);
Won't show up.
Is the x and y location wrong?
Please Help me!

Code: Select all

Thanks.

Posted: Fri May 12, 2006 11:46 am
by qrak
try:

Code: Select all

use uo; 


program noloot( who, corpse, item ) 

var serial := cint(GetObjProperty(corpse, "serial")); 
var komp := getobjproperty(corpse, "npctemplate"); 

if( serial == who.serial ) 
        return 1;    

elseif(komp) 
        return ; 

elseif(CheckNoLootZone(corpse) == "noloot") 
        
        SendSysMessage(who, "Restricted Area! Can't loot!",3,40); 
        return 0; 
else 


return 1; 
endif

endprogram

function CheckNoLootZone(corpse)

if(corpse.x >= 5390 && corpse.y >= 1262 && corpse.x<=5376 && corpse.y<=1279) // replace x, y with your own coordinates
return "noloot";
else 
return 0;
endif

endfunction



Posted: Fri May 12, 2006 12:04 pm
by Damien
Nothing happends, still same problem, everybody can loot.

Is the X and Y wrong? i have no clue ;D

And only urself should be able to loot your own corpse, Not other people.

Posted: Fri May 12, 2006 1:50 pm
by Zacharias
the corps-coordinates are wrong:

Code: Select all

elseif(corpse.x >= 5390 && corpse.y >= 1262 && corpse.x<=5376 && corpse.y<=1279 ) 
corpse.x >= 5390
(bigger then 5390)
AND
corpse.x<=5376
(smaller then 5376)


there is no number which can be smaller then 5376 and bigger then 5390 at the same time.


correct code:

Code: Select all

elseif(corpse.x >= 5376 && corpse.y >= 1262 && corpse.x<=5390 && corpse.y<=1279 ) 
you have to switch the numbers.

on the other hand you set corpse.y correct. :)

Posted: Fri May 12, 2006 11:48 pm
by Damien
Wow thanks it works!

Posted: Sun May 14, 2006 7:18 am
by Damien
Ahh just another question :)

If i want 2 zones to be nolootzones how should i write?

This is the one i got now for one nolootzone:

Code: Select all

function CheckNoLootZone(corpse) 

if(corpse.x >= 5376 && corpse.y >= 1262 && corpse.x<=5390 && corpse.y<=1279 ) // replace x, y with your own coordinates 
return "noloot"; 
else 
return 0; 
endif 

endfunction 
Should i do like this? :

Code: Select all

function CheckNoLootZone(corpse) 

if(corpse.x >= 5376 && corpse.y >= 1262 && corpse.x<=5390 && corpse.y<=1279 ) // replace x, y with your own coordinates 
else
if(corpse.x >= 5132 && corpse.y >= 1409 && corpse.x<=5379 && corpse.y<=1494 ) // replace x, y with your own coordinates 
return "noloot"; 
else 
return 0; 
endif 

endfunction 
Btw those x,x and y,y i put on the second cordinate lines dont work;(
and i dont know why, If you see something that is wrong please tell me :)

Posted: Sun May 14, 2006 8:15 am
by CWO
You could do


if ( (coords within zone 1) || (coords within zone 2) )

Posted: Sun May 14, 2006 8:56 am
by Damien
Damien wrote:

Code: Select all

function CheckNoLootZone(corpse) 

if(corpse.x >= 5376 && corpse.y >= 1262 && corpse.x<=5390 && corpse.y<=1279 ) || (corpse.x >= 5132 && corpse.y >= 1409 && corpse.x<=5379 && corpse.y<=1494 )
return "noloot"; 
else 
return 0; 
endif 

endfunction 
Like that? you notice anything wrong at the cordinations? the second one because it dont work ;(