Campfire to regenerate HP/SP

Habilis

New member
Messages
225
Points
0
Age
36
Location
Montreal, Canada
IRC Nickname
Habilis
Emulator
Yesterday, after rambles on Discord with Dastgir and Asheraf,

I've got another Brilliant Idea for a Release from Habilis!

The Idea:

Camp Fire to restore / regenerate HP & SP.

When you sit by the Camp fire, you start feeling the warmth and the comfort, so your HP & SP begin to regenerate.

VvXo4vX.jpg


There is a nice contribution from Meko on that subject 

Menhir (Big rock that possesses magical powers and able to restore Health and Energy of Seekers)



Thanks Meko!

So, I thought to myself, well, that is wonderful, but why not make it portable?

Because, conveniently, there is this NPC sprite :

p63Qr0f.gif


4_BONFIREID: 10252 (0x280C)

Even more conveniently, there is this item:

7035.gif
 Matchstick    Item ID# 7035 (Matchstick)

7035.gif


A phosphorus tipped stick that can be used to start a fire.

http://ratemyserver.net/index.php?page=item_db&item_id=7035

Dastgir, suggested using this plugin to make this possible:

https://github.com/dastgirp/HPM-Plugins/blob/master/src/plugins/npc-duplicate.c

Mechanics

When you use the item   Matchstick   in your inventory, it will spawn a duplicate of the NPC called Camp Fire.

So that when you are in the field, farming, grinding you could rest.

VvXo4vX.jpg


- You need to sit close to the Camp Fire  (3 cells ) to feel the warmth.

- Anyone can sit by your Camp Fire and rest.

- Camp Fire lasts 2-3 minutes.

- Need to sit for at least 3 seconds to begin feeling the warmth and comfort.

- you cannot start a fire within 5 cells of another Camp Fire.

- If you use a match one more time, old Camp Fire disappears and a new one appears.

I think it will add an element of roleplay and romanticism to the gameplay.

(Habilis is a soft, sensitive and romantic type
B38cFIv.jpg
).

Expect the Release sometime soon...

 
Last edited by a moderator:
The animated fire is a relatively new NPC sprite.

I've had a little sprite problem. I will add all the instructions on how to add this sprite if you don't have it

(Basically instructions how to add a custom NPC, server side & client side)

dfUPJPu.jpg


Note that it says in the chat, 

You are feeling warm and cozy.

 
Here is the pre-releae version.

anyone, who feel like it,  can contribute!

prt_fild08,138,364,0 script Camp Fire#CF 4_BONFIRE,{

end;

OnRefill:
getmapxy(.@map$, .@x, .@y, UNITTYPE_PC);
getmapxy(.@npc_map$, .@npc_x, .@npc_y, UNITTYPE_NPC);
if (.@map$ != .@npc_map$ || distance(.@npc_x, .@npc_y, .@x, .@y) > .refill_distance || !(issit())) {
@camp_fire_regen = 0;
@camp_fire_tick = 0;
end;
}

if(@camp_fire_regen == 1) {
heal(.refillHP_rate, .refillSP_rate);
} else {
if(@camp_fire_tick >= .camp_fire_delay) {
@camp_fire_regen = 1;
@camp_fire_tick = 0;
dispbottom("You are feeling warm and cozy.");
} else {
@camp_fire_tick++;
}
}
end;


OnTimer500:
getmapxy(.@npc_map$, .@npc_x, .@npc_y, UNITTYPE_NPC);
.@count = getunits(BL_PC, .@units[0], false, .@npc_map$, (.@npc_x - .refill_distance),
(.@npc_y - .refill_distance), (.@npc_x + .refill_distance), (.@npc_y + .refill_distance));

for (.@i = 0; .@i < .@count; ++.@i) {
addtimer(rand(.refill_timer), strnpcinfo(NPC_NAME) + "::OnRefill", .@units[.@i]);
}

initnpctimer();
end;

OnRemoveDup:
deltimer(strnpcinfo(NPC_NAME) + "::OnRefill");
stopnpctimer();
duplicateremove(strnpcinfo(NPC_NAME));
end;

OnInit:
.refillHP_rate = 15; // number of HP to give every refill
.refillSP_rate = 5; // number of SP to give every refill
.refill_distance = 3; // max distance from fire HP/SP regeneration will work
.camp_fire_delay = 5; // Skip how many ticks before feel warm ;)
.refill_timer = 300; // wait rand(X) ms before refil
initnpctimer();
}


function script F_CreateCFDup {

.@nofire_distance = 5; // How far from other NPCs allowed to make fire.
.@fire_duration = 60000; //180000; // 3 minutes (How long will the Camp fire last)
.@curr_char_id = getarg(0);

attachrid(.@curr_char_id);
getmapxy(.@mapname$, .@mapx, .@mapy, UNITTYPE_PC);

if(getmapxy(.@dupe_mapname$, .@dupe_mapx, .@dupe_mapy, UNITTYPE_NPC, sprintf("Camp Fire#CF_%d",.@curr_char_id)) == 0) {
deltimer(sprintf("Camp Fire#CF_%d::OnRemoveDup", .@curr_char_id));
duplicateremove(sprintf("Camp Fire#CF_%d", .@curr_char_id));
}

if(getunits(BL_NPC, .@units[0], false, .@mapname$, (.@mapx - .@nofire_distance),(.@mapy - .@nofire_distance), (.@mapx + .@nofire_distance), (.@mapy + .@nofire_distance)) > 0) {
dispbottom("A fire cannot be started here.");
} else {
soundeffect ("strike-matchstick.wav",0);
duplicatenpc("Camp Fire#CF", "Camp Fire", sprintf("CF_%d", .@curr_char_id), .@mapname$, .@mapx, .@mapy, 0);
addtimer(.@fire_duration, sprintf("Camp Fire#CF_%d::OnRemoveDup", .@curr_char_id));
}
return();
}




Here is in the 

intem_db.conf

{
Id: 7035
AegisName: "Matchstick"
Name: "Matchstick"
Type: 2
Buy: 100
Weight: 10
BuyingStore: true
Delay: 15000
Script: <" callfunc("F_CreateCFDup", getcharid(CHAR_ID_CHAR)); ">
},




There is still some work to be done.

 
Last edited by a moderator:
Hi Habilis, this is my attempts..
https://pastebin.com/fksPdpFQ

Feel free to comment :D

-- EDIT

Updated the campfire:

- slowly decrease the effectiveness of healing rate and area range every 10 seconds.

- may use item like wooden block, tree root, to prolong the campfire duration, or increase healing rate and area range too.

v1.1

lol.gif


To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.


 
Last edited by a moderator:
Back
Top