OnPCDieEvent: - Monster Only?

Total

New member
Messages
14
Points
0
Hello,

I'm creating a system where if a player dies, they are auto hidden and must find the spot they died on to carry on.

World of Warcraft Style.

Is it possible to determine how you have been killed?

I only want this to trigger if killed by a monster and not trigger if they was killed by another player in PvP, BG, WoE etc

OnPCDieEvent:
 
This is for any death isn't it? if their another trigger to use?
 
i was thinking of using something like;
 
OnPCDieEvent:
            if map="pvp1,pvp2,woe1,woe2" end;
            <else script here>
 
Would this work?

 
Thanks in advanced.
 
Last edited by a moderator:
All I can think about is using atcommand "@hide" set the player status like "IsHidden" to true/false, they die on a certain cell (save using getmapxy upon OnPcDieEvent of death coordinates) auto raise them and warp them to a different spot where they'd have to find that cell to get rid of the IsHidden status. Also you'll need OnPCLogoutEvent/OnPCLoginEvent or something similar if they logout / login to maybe set their hidden status back to 0? the problem I see is atcommand "@hide" effect will have been taken off automatically if dc/relog anyway.

I know there was something like @monsterignore or some kind of command that basically made monsters ignore you and you couldn't attack the monsters either... if you had that mod you could even save there "IsHidden" status when they login and set them back to being hidden incase of internet interruption

 
Last edited by a moderator:
Hello,

I'm creating a system where if a player dies, they are auto hidden and must find the spot they died on to carry on.

World of Warcraft Style.

Is it possible to determine how you have been killed?




I tried to figure out and write it, so here's the outcome (this is based on @Aeromesi's idea *thanks to him*):

- script Support#1 FAKE_NPC,{
OnCheckHide:
while(CheckHide){
getmapxy(.@m$, .@mx, .@my, UNITTYPE_PC);
if (map$ == .@m$ && mapx == .@mx && mapy == .@my){
map$ = "";
mapx = 0;
mapy = 0;
CheckHide = 0;
atcommand "@hide";
message strcharinfo(0), "You are resurrected!";
specialeffect2 226;
specialeffect2 18;
detachrid;
end;

}
sleep2 500;
}
end;

OnPCDieEvent:
getmapxy(.@m$, .@mx, .@my, UNITTYPE_PC);
map$ = .@m$; mapx = .@mx; mapy = .@my;
// dispbottom "Map = "+map$+" X = "+mapx+" Y = "+mapy+"."; // DEBUG PURPOSE.
CheckHide = 1;
sleep2 1000;
atcommand "@raise";
atcommand "@hide";
attachrid(getcharid(3,strcharinfo(0)));
warp map$,0,0;
callsub OnCheckHide;
end;

OnPCLoginEvent:
if (!CheckHide) end;
atcommand "@hide";
attachrid(getcharid(3,strcharinfo(0)));
callsub OnCheckHide;
end;
}


Note: 

* I made it looped to determine the player state, WARNING: this might cause lag.

* Players can attack mobs, players and can even use skills while on hide status since I executed "atcommand @hide", you can fix that by source modding if Im not mistaken.

* THIS IS JUST AN IDEA.

Well then, good luck! 
default_wink.png


 
Last edited by a moderator:
Hello,

I'm creating a system where if a player dies, they are auto hidden and must find the spot they died on to carry on.

World of Warcraft Style.

Is it possible to determine how you have been killed?




I tried to figure out and write it, so here's the outcome (this is based on @Aeromesi's idea *thanks to him*):

- script Support#1 FAKE_NPC,{
OnCheckHide:
while(CheckHide){
getmapxy(.@m$, .@mx, .@my, UNITTYPE_PC);
if (map$ == .@m$ && mapx == .@mx && mapy == .@my){
map$ = "";
mapx = 0;
mapy = 0;
CheckHide = 0;
atcommand "@hide";
message strcharinfo(0), "You are resurrected!";
specialeffect2 226;
specialeffect2 18;
detachrid;
end;

}
sleep2 500;
}
end;

OnPCDieEvent:
getmapxy(.@m$, .@mx, .@my, UNITTYPE_PC);
map$ = .@m$; mapx = .@mx; mapy = .@my;
// dispbottom "Map = "+map$+" X = "+mapx+" Y = "+mapy+"."; // DEBUG PURPOSE.
CheckHide = 1;
sleep2 1000;
atcommand "@raise";
atcommand "@hide";
attachrid(getcharid(3,strcharinfo(0)));
warp map$,0,0;
callsub OnCheckHide;
end;

OnPCLoginEvent:
if (!CheckHide) end;
atcommand "@hide";
attachrid(getcharid(3,strcharinfo(0)));
callsub OnCheckHide;
end;
}


Note: 

* I made it looped to determine the player state, WARNING: this might cause lag.

* Players can attack mobs, players and can even use skills while on hide status since I executed "atcommand @hide", you can fix that by source modding if Im not mistaken.

* THIS IS JUST AN IDEA.

Well then, good luck! 
default_wink.png
Glad I could help. I would have coded it but last night I wasn't in the right frame of mind. Lol Happy new years!

 
@Legend

Nice script. But, as you said, it can create some problems.
You can add this to the while loop to prevent the attack and skills under hide exploit:

if(!getstatus(SC_WEIGHTOVER90))
    sc_start SC_WEIGHTOVER90,600000,0,1000000,SCFLAG_NOAVOID|SCFLAG_FIXEDTICK|SCFLAG_FIXEDRATESCFLAG_NOICON;



Edit: Some of the message dissapeared... well, I also made the obvious comment of the sc_end and said about using viewpoint.

 
Last edited by a moderator:
How about this one?

// =============================
- script Support#1 FAKE_NPC,{
OnInit:
setarray .perm$[0],
"disable_skill_usage",
"disable_exp",
"disable_store",
"disable_pickup",
"disable_pvp",
"disable_pvm";
.prms = getarraysize(.perm$);
end;

OnCheckHide:
while(CheckHide){
getmapxy(.@m$, .@mx, .@my, UNITTYPE_PC);
if (map$ == .@m$ && mapx == .@mx && mapy == .@my){
map$ = "";
mapx = 0;
mapy = 0;
CheckHide = 0;
atcommand "@hide";
copyarray .@prm$[0], .perm$[0],.prms;
for (.@a = 0; .@a < getarraysize(.@prm$); ++.@a){
atcommand "@rmvperm "+.@prm$[.@a];
}
message strcharinfo(0), "You are resurrected!";
specialeffect2 226;
specialeffect2 18;
detachrid;
end;

}
sleep2 500;
}
end;

OnPCDieEvent:
if (getunittype(killerrid) != UNITTYPE_MOB) end;
getmapxy(.@m$, .@mx, .@my, UNITTYPE_PC);
map$ = .@m$; mapx = .@mx; mapy = .@my;
// dispbottom "Map = "+map$+" X = "+mapx+" Y = "+mapy+"."; // FOR DEBUG PURPOSE.
CheckHide = 1;
sleep2 1000;
atcommand "@raise";
atcommand "@hide";
copyarray .@prm$[0], .perm$[0],.prms;
for (.@a = 0; .@a < getarraysize(.@prm$); ++.@a){
atcommand "@addperm "+.@prm$[.@a];
}
attachrid(getcharid(3,strcharinfo(0)));
warp map$,0,0;
callsub OnCheckHide;
end;

OnPCLoginEvent:
if (!CheckHide) end;
atcommand "@hide";
copyarray .@prm$[0], .perm$[0],.prms;
for (.@a = 0; .@a < getarraysize(.@prm$); ++.@a){
atcommand "@addperm "+.@prm$[.@a];
}
attachrid(getcharid(3,strcharinfo(0)));
callsub OnCheckHide;
end;
}


*thanks to n0tttt*

@n0tttt nice trick you got there about making its Weight >= 90%
default_no1.gif
 but I can't make use of that status SC_WEIGHTOVER90, it seems it doesn't work properly (bug i guess?). Uh, status icon showed up but when the player started to attack monsters, the icon got removed. 

So, instead of adding status on them, I do atcommand "@addperm" & "@rmvperm" for their restrictions while on CheckHide status.

@Aeromesi That's okay 
default_smile.png
 Happy new year to you!

@ts I suggest you to do some source modding or better use plugins for those atcommands for a cleaner & safer script.

 
Back
Top