Jump to content
  • 0
Lord Ganja

Script is triggered twice, WHY?

Question

Can anyone test this script and see if you experience what im experiencing..

Coz the OnPCDieEvent is always triggered twice.. Idk why. I already checked if I might have duplicates of the script on other files but there's none.

So I was wondering why is it triggered twice? Help will always be appreciated. Thanks in advance.

 

Here's the script:

OnPCDieEvent:	if( strcharinfo(3) == "guild_vs1" && ) {		@dead_pts += 1;			if ( @dead_pts == 1 ) {			message strcharinfo(0), "Reviving. . . . . . .";			sleep2 3000;			atcommand "@alive";			message strcharinfo(0), "1 more life left.";			end;		}		if ( @dead_pts >= 2 ) {			@dead_pts = 0;			message strcharinfo(0), "Sorry, but you failed the quest. Better luck next time!";			sleep2 5000;				warp "SavePoint",0,0;			end;		}	}	end;

 

Here's the result:

post-1008-0-53398000-1436019842_thumb.png

Edited by Lord Ganja

Share this post


Link to post
Share on other sites

8 answers to this question

Recommended Posts

  • 0

Probably this is parser issue.

You have syntax error in if condition

 

if( strcharinfo(3) == "guild_vs1" && ) {

Try delete "&&" from here

Share this post


Link to post
Share on other sites
  • 0

I can't see any error that 4144 didn't mention before, but is it intended to use a temporary character variable?

Since anyone could reset the @dead_pts variable just by returning to char select and log back in.

Share this post


Link to post
Share on other sites
  • 0

@@4144

Sorry, that was a typo coz I used to put another variable there. guess I haven't removed it when I paste it here. Anyway even if I removed that, it is still triggered twice :/

 

@@Winterfox

Yes, I intend to use a temporary character variable, since I want to to reset whenever they logged out.

 

@@Angelmelody

I already removed the gvg mapflag but it is still triggered twice. anyway will it really be triggered twice when I don't remove the gvg mapflag?

Share this post


Link to post
Share on other sites
  • 0

Try remove warp command. Probably if you using warp for dead player and it called second time after warp.

Share this post


Link to post
Share on other sites
  • 0

I tested it and it worked fine for me. If you did what the people here told you and did it correctly, it seems there has to be another script or a part of your script you didn't show, that causes your problem. 

 

Here is what i did to test your snippet:

1. I went to mapflag/gvg.txt and changed the line guild_vs1 to //guild_vs1.

2. I added this script:

-	script	test	-1,{	OnPCDieEvent:		if( strcharinfo(3) == "guild_vs1" ) {			@dead_pts += 1;				if ( @dead_pts == 1 ) {				message strcharinfo(0), "Reviving...";				sleep2(3000);				atcommand("@alive");				message(strcharinfo(0), "1 more life left.");				end;			}			if ( @dead_pts >= 2 ) {				@dead_pts = 0;				message(strcharinfo(0), "Sorry, but you failed the quest. Better luck next time!");				sleep2(5000);					warp("SavePoint",0,0);				end;			}		}	end;}

3. Warped to guild_vs1 and died 2 times and it worked as intended.

4. Repeated step 3 for 2 times to be sure.

 

Maybe someone else could give it a shot and test if he gets the same issue as @@Lord Ganja.

Edited by Winterfox

Share this post


Link to post
Share on other sites
  • 0

Add

atcommand "@alive";

Before warping,

 

It may be due to as he dies , warp out as dead, and server might recognize as he died on new location.(just assumptions)

Share this post


Link to post
Share on other sites
  • 0

Actually, no, there is a part inside warp command (pc_setpos in pc.c) that revives the person it's warping when dead.

 

My wild guess would be that there's some other label that triggers before, and it might be falling through to this one. In short, you might've forgotten to end/close piece of code above this part?

Share this post


Link to post
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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.