Jump to content
  • 0
Sign in to follow this  
Juan Meissner

NPC Fixed effect for a time

Question

Hello guys, sorry for my bad English, i came here to ask something.

That's is the deal:

I'm trying make a Bonfire NPC, that have the option "Light Up".

This option make the Bonfire stay with a fire effect over a time and another options are avaiable if the fire is lit.

 

This is my attempt.

 

que_ng,27,66,4	script	Fogueira#Casa	649,{

	if (getcharid(0) != getpartyleader(getcharid(1),2))
	{
		unittalk getcharid(3), "Essa é a famosa "+strnpcinfo(1)+"!";
		end;
	}

	if(select("- Acender:- Sair") == 1)
		//Começar script de acender fogueira aqui .name
	callsub FogueiraOn;
	close;
	
	FogueiraOn:
	initnpctimer;
	end;
	
	OnTimer300:
	specialeffect2 634;
	end;
	
	OnTimer600:
	specialeffect2 634;
	end;
	
	OnTimer900:
	specialeffect2 634;
	stopnpctimer;
	end;
}

 

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Here you go.

prontera,151,159,4    script    Firewood    89,{
mes "[Fire]";
    if ( !.lit )
    {
        switch(select("Light firewood","Exit"))
        {
            
            case 1:
            if ( countitem(7035) >= 1 )
        {
            delitem 7035, 1;
            mes "Matchstick consumed. Lighting fire.";
            .lit = 1;
            donpcevent ("Firewood")+"::OnEnableFire";
            close;
        } else
            mes "Firewood needs 1 Matchstick to be lit.";
            close;
 
            case 2:
            mes "Fire was not lit.";
            close;
        }
} else
 
    if ( .lit )
        switch(select("Put out firewood","Exit"))
        {
            
            case 1:
            .lit= 0;
            dispbottom "You put out the fire.";
            stopnpctimer;
            close;
            
            case 2:
            close;
        }
OnEnableFire:
    initnpctimer;
    end;
 
OnTimer500:
    specialeffect 25;
    initnpctimer;
    end;
    }


Checks whether lit or not, consumes (1) Matchstick. A good idea I thought about is while its lit get the area around the fire, maybe 6x6, and any players that are near the bonfire will regenerate SP/HP relatively quickly? Just my idea behind the fires.

Share this post


Link to post
Share on other sites
  • 0

Checks whether lit or not, consumes (1) Matchstick. A good idea I thought about is while its lit get the area around the fire, maybe 6x6, and any players that are near the bonfire will regenerate SP/HP relatively quickly? Just my idea behind the fires.

To make it more interesting, we can also make it heal players faster (or heal more) who are sitting in the 6x6 area.

Share this post


Link to post
Share on other sites
  • 0

 

Checks whether lit or not, consumes (1) Matchstick. A good idea I thought about is while its lit get the area around the fire, maybe 6x6, and any players that are near the bonfire will regenerate SP/HP relatively quickly? Just my idea behind the fires.

To make it more interesting, we can also make it heal players faster (or heal more) who are sitting in the 6x6 area.

 

Lol my fishing script requires the player to be sitting in order to use the feature.

 

 

I'll do that let's see how this turns out :D I'll post the new one underneath this post.

 

If they want the fires to be all over the world of ragnarok I wonder how I will be able to get the mapxy coordinates of the duplicated npc... Hmmm making 1 of the fires with the feature might be easy but for a lot of them I might have to pull something different (Dastgir update your duplicatenpc command... xD)!

Share this post


Link to post
Share on other sites
  • 0

Figured it out.

All you need to do is the following:

Edit $@MaxDup to the TOTAL amount of duplicated NPCS + the original NPC is, so if we have 1 in prontera, 1 in geffen, 1 in izlude, it would be 3.
Added '@fireloc' command so you can view the locations of your fires. Get rid of the 99 requirement so players can use the command if need be.

Version 1.0 : Without Healing feature
 

prontera,151,159,4    script    Firewood#1    89,{
 
for ( .n = 1; .n <= $@MaxDups; .n++ ) {
    if ( strnpcinfo(0) == "Firewood#"+.n+"" && $@Lit[.n] == 0) {
    callsub OnStartFire;
end;
} else
    if ( strnpcinfo(0) == "Firewood#"+.n+"" && $@Lit[.n] == 1) {
    callsub OnEndFire;
end;
}
}
 
OnStartFire:
        mes "[Fire]";
        switch(select("Light firewood","Exit"))
        {
            
            case 1:
            if ( countitem(7035) >= 1 )
        {
            delitem 7035, 1;
            mes "Matchstick consumed. Lighting fire.";
            $@Lit[.n] = 1;
            donpcevent strnpcinfo(0)+"::OnEnableFire";
            close;
        } else
            mes "Firewood needs 1 Matchstick to be lit.";
            close;
 
            case 2:
            mes "Fire was not lit.";
            close;
        }
 
OnEndFire:
        switch(select("Put out firewood","Exit"))
        {
            
            case 1:
            $@Lit[.n] = 0;
            dispbottom "You put out the fire.";
            donpcevent strnpcinfo(0)+"::OnDisableFire";
            close;
            
            case 2:
            close;
        }
 
OnEnableFire:
    initnpctimer;
    end;
 
OnDisableFire:
    stopnpctimer;
    end;
 
OnTimer500:
    specialeffect 25;
    initnpctimer;
    end;
 
OnAtFireLoc:
for ( .@i = 1; .@i <= 3; .@i++ ) {
    mes ""+$@FireMap$[.@i]+","+$@FireX[.@i]+","+$@FireY[.@i]+".";
}
    close;
 
OnInit:
// Change this to how many duplicate fire's you make.
    $@MaxDups = 3;
// Command '@fireloc' to view the locations of your fires.
// For players to use this command, just get rid of the 99 requirement below.
    bindatcmd "fireloc",strnpcinfo(0)+"::OnAtFireLoc",99;
 
 for ( .@i = 1; .@i <= $@MaxDups; .@i++ ) {
getmapxy .@mapname$[.@i],.@mapx[.@i],.@mapy[.@i], 1, "Firewood#"+.@i+"";
// debugmes "NPC Firewood#"+.@i+": "+.@mapname$[.@i]+","+.@mapx[.@i]+","+.@mapy[.@i]+".";
    $@FireMap$[.@i] = .@mapname$[.@i];
    $@FireX[.@i] = .@mapx[.@i];
    $@FireY[.@i] = .@mapy[.@i];
}
end;
}


All I need to do now is add the feature for the healing..., maybe a refine system similar to Blade and Souls near a fire higher success chance? So many ideas  :heh:


Here's the new version.

Supports the top post but with the following now:

Heals at 3 second rate 5% for HP/SP

MUST be sitting down in order heal your HP/SP or to burn the fire out.

NOTE: Once you activate the fire, walk away and come back to it, it adds the timer on the 6x6 cell radius to your character. Could be a way for you to "leave" to go tell your friends about your campfire! xD

 

Version 2.0 : With Healing feature
 

prontera,151,159,4    script    Firewood#1    89,6,6,{
for ( .n = 1; .n <= $@MaxDups; .n++ ) {
    if ( strnpcinfo(0) == "Firewood#"+.n+"" && $@Lit[.n] == 0) {
    callsub OnStartFire;
end;
} else
    if ( strnpcinfo(0) == "Firewood#"+.n+"" && $@Lit[.n] == 1) {
    callsub OnEndFire;
end;
}
}
 
OnStartFire:
        mes "[Firewood]";
        switch(select("Light firewood","Exit"))
        {
            
            case 1:
            if ( countitem(7035) >= 1 )
        {
            delitem 7035, 1;
            mes "Matchstick consumed. Lighting fire.";
            $@Lit[.n] = 1;
            donpcevent strnpcinfo(0)+"::OnEnableFire";
            close;
        } else
            mes "Firewood needs 1 Matchstick to be lit.";
            close;
 
            case 2:
            mes "Fire was not lit.";
            close;
        }
 
OnEndFire:
mes "[Firewood]";
if ($@Lit[.n] && !issit() ) {
    mes "Please proceed to sitting down to heal your HP/SP or to put out the fire.";
    close;
}
        switch(select("Put out firewood","Exit"))
        {
            
            case 1:
            $@Lit[.n] = 0;
            dispbottom "You put out the fire.";
            donpcevent strnpcinfo(0)+"::OnDisableFire";
            close;
            
            case 2:
            close;
        }
 
OnEnableFire:
    initnpctimer;
    end;
 
OnDisableFire:
    stopnpctimer;
    end;
 
OnTimer500:
    specialeffect 25;
    initnpctimer;
    end;
 
OnAtFireLoc:
for ( .@i = 1; .@i <= 3; .@i++ ) {
    mes ""+$@FireMap$[.@i]+","+$@FireX[.@i]+","+$@FireY[.@i]+".";
}
    close;
 
OnInit:
$@MaxRange = 6;
// Change this to how many duplicate fire's you make.
    $@MaxDups = 3;
// Command '@fireloc' to view the locations of your fires.
// For players to use this command, just get rid of the 99 requirement below.
    bindatcmd "fireloc",strnpcinfo(0)+"::OnAtFireLoc",99;
 
 for ( .@i = 1; .@i <= $@MaxDups; .@i++ ) {
getmapxy .@mapname$[.@i],.@mapx[.@i],.@mapy[.@i], 1, "Firewood#"+.@i+"";
    $@FireMap$[.@i] = .@mapname$[.@i];
    $@FireX[.@i] = .@mapx[.@i];
    $@FireY[.@i] = .@mapy[.@i];
}
end;
    OnTouch:
    while ( $@Lit[.n] || !$@Lit[.n] ) {
for ( .n = 1; .n <= $@MaxDups; .n++ ) {
    if ( strnpcinfo(0) == "Firewood#"+.n+"" && $@Lit[.n] == 0) {
    callsub OnCheckFail;
end;
} else
    if ( strnpcinfo(0) == "Firewood#"+.n+"" && $@Lit[.n] == 1) {
    callsub OnCheckSuccess;
end;
}
}
}
OnCheckFail:
end;
 
OnCheckSuccess:
if ( Hp == MaxHp && Sp == MaxSp ) {
    end;
}
if ( !issit() ) {
    addtimer 3000,strnpcinfo(0)+"::OnTouch";
    end;
}
        percentheal 5,5; // 5% HP / 5% SP healing
        addtimer 3000,strnpcinfo(0)+"::OnTouch";
 
        if ( Hp == MaxHp && Sp == MaxSp ) {
        dispbottom "Health fully recovered.";
        end;
}
        end;
}

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...
Sign in to follow this  

×
×
  • Create New...

Important Information

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