Jump to content
  • 0

Need help with script (if and else)


TiMz

Question


  • Group:  Members
  • Topic Count:  51
  • Topics Per Day:  0.01
  • Content Count:  192
  • Reputation:   9
  • Joined:  05/08/13
  • Last Seen:  

Script only reads the if and not the else part. Which part is written badly?

OnPCDieEvent:
	getmapxy .@map$,.@x,.@y,0;
		if ( getgroupid() > 3 || killedrid == getcharid(3)) end;
		else (.@map$ == "arena") {
		announce rid2name(killerrid)+" wins against "+strcharinfo(0)+" at pvp!",bc_all;
		warp "prontera",155,180; end;

		}	
	end;
}
Link to comment
Share on other sites

9 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  949
  • Reputation:   174
  • Joined:  06/12/12
  • Last Seen:  

Mind explaining the output that you want?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  127
  • Topics Per Day:  0.03
  • Content Count:  1445
  • Reputation:   163
  • Joined:  08/17/13
  • Last Seen:  

 

Script only reads the if and not the else part. Which part is written badly?

OnPCDieEvent:
	getmapxy .@map$,.@x,.@y,0;
		if ( getgroupid() > 3 || killedrid == getcharid(3)) end;
		else (.@map$ == "arena") {
		announce rid2name(killerrid)+" wins against "+strcharinfo(0)+" at pvp!",bc_all;
		warp "prontera",155,180; end;

		}	
	end;
}

 

shouldn't be like?

OnPCDieEvent:
getmapxy .@map$,.@x,.@y,0;
if ( getgroupid() > 3 || killedrid == getcharid(3)){
end;
}	
else (.@map$ == "arena") {
announce rid2name(killerrid)+" wins against "+strcharinfo(0)+" at pvp!",bc_all;
warp "prontera",155,180;
end;
}

what is supposed to be after this?

getmapxy .@map$,.@x,.@y,0;

if ( getgroupid() > 3 || killedrid == getcharid(3))

 

and then after this?

(.@map$ == "arena") {

announce rid2name(killerrid)+" wins against "+strcharinfo(0)+" at pvp!",bc_all;

warp "prontera",155,180;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

lol you both ...

 

-	script	kjdfkjsdf	-1,{
OnPCDieEvent:
	if ( strcharinfo(3) != "arena" || getgroupid() > 3 ) end;
	if ( killerrid )
		announce rid2name( killerrid )+" wins against "+ strcharinfo(0), bc_all;
	// sure .. you need to warp player out even if he suicide
	warp "prontera",155,180;
	end;
}
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  127
  • Topics Per Day:  0.03
  • Content Count:  1445
  • Reputation:   163
  • Joined:  08/17/13
  • Last Seen:  

oh lol sorry 

 

still trying to figure out how some scripts work (the order) 

 

i was confused of what he wanted @_@ sorry again lol

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  51
  • Topics Per Day:  0.01
  • Content Count:  192
  • Reputation:   9
  • Joined:  05/08/13
  • Last Seen:  

Mind explaining the output that you want?

 

Basically the broadcast should happen only in the specific map when one player is killed and shouldn't broadcast when using @die.

Edited by Isaiah
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  949
  • Reputation:   174
  • Joined:  06/12/12
  • Last Seen:  

Try this?

OnPCDieEvent:
if(strcharinfo(3) == "arena" && getgroupid() < 3 && killerrid != getcharid(0)) {
       announce rid2name(killerrid)+" wins against "+strcharinfo(0),bc_all;
}
end;
Edited by sandbox
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

Might wanna test AnnieRuru approach? 

 

 

 

Try this?

OnPCDieEvent:
if(strcharinfo(3) == "arena" && getgroupid() < 3 && killerrid != getcharid(0)) {
       announce rid2name(killerrid)+" wins against "+strcharinfo(0),bc_all;
}
end;

killerrid is set as account id not character id  ( getcharid(3) not getcharid(0) ) 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  949
  • Reputation:   174
  • Joined:  06/12/12
  • Last Seen:  

Really!? Then my whole life has been a lie :(

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  127
  • Topics Per Day:  0.03
  • Content Count:  1445
  • Reputation:   163
  • Joined:  08/17/13
  • Last Seen:  

huh there are more pvp npcs that do that but it's only for pvp rooms, so want the braodcast work on different maps o:?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...