A Moving NPC script

Started by MiyumiChan, Jul 11, 2013, 08:05 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MiyumiChan

I've been thinking of an event map for my server, a fun game that everyone is able to play. I call it "Hell Run". Basically I got the map made from Browedit already, just looking for a code that has a moving NPC that moves 1 cell forward per a number of seconds. Then per each stage the moving NPC moves faster.

My goal, this Moving NPC will have a thunder effect chasing after you from behind and on touch it will kill you. I already have the special effect script, kill command and the invisible NPC script ready for the chase down but I don't know how to make it move or move forward replaying the thunder script.

Time = Thunder
Move Up one Cell > Time = Thunder
Move Up one Cell > Time = Thunder
etc.
etc.



Septentrio

I don't think you can make NPCs move like players can, sadly.
The only thing that came to my mind was technically disabling the NPC and enabling it on another location.
So just write a crap load of NPC scripts with all the locations and then hide all except one.

Triper

You actually can and google can give the answer quite fast if you search, for example, moving npc eathena or moving npc rathena:

http://www.eathena.ws/board/index.php?showtopic=271324
http://rathena.org/board/topic/58985-moving-npc/

And you should ask for support related to that at their forums :\ Not here. Codes = eathena/hercules/rathena/etc, here is client support. The only reason is just because they can give you better support then people here.

Thoth

the game seems to let "monsters" move. but npcs you click on seem to require clicking on a specific cell where theres anything there or not. so you'd need to make a script "monster" that moves around as you wish, and the npc location cell (where you click to talk to it) keeps changing to follow it...? be alot easier if you just only let it "talk" (have the invisible talk bubble appear on that cell) after it moves to a destination.
and then ofc, you have the problem of multiple players using the same npc, do they see the same npc location, and interfere with each other?
RO wasn't designed to handle this very well.

Atchiro

You can put NPCs on several cells and make them hide and unhide as if they were moving.

MiyumiChan

Quotefunction   script   StartThunder   {

if (countitem(15558) > 0) {
delitem 15558,1;
startnpctimer "DT";
startnpctimer "DT2";
startnpctimer "DT3";
npcspeed 30;
npcwalkto 19,10;
end;
   }
}

function   script   ThunderStop   {

setnpctimer 0,"DT";
detachnpctimer "DT";
setnpctimer 0,"DT2";
detachnpctimer "DT2";
setnpctimer 0,"DT3";
detachnpctimer "DT3";
end;

}

zer_map01,22,13,3   script   Death Thunder::DT   111,1,1,{

OnTouch:
callfunc "StartThunder";


OnTimer2000:
specialeffect 30;
npcwalkto 19,10;
end;

OnTimer3000:
npcwalkto 19,14;
specialeffect 30;
end;

OnTimer4000:
npcwalkto 19,18;
specialeffect 30;
end;

OnTimer5000:
npcwalkto 19,22;
specialeffect 30;
end;

OnTimer6000:
npcwalkto 19,26;
specialeffect 30;
end;

OnTimer7000:
npcwalkto 19,30;
specialeffect 30;
end;

OnTimer8000:
npcwalkto 19,34;
specialeffect 30;
end;

OnTimer9000:
npcwalkto 19,38;
specialeffect 30;
end;

OnTimer10000:
npcwalkto 19,42;
specialeffect 30;
end;

OnTimer11000:
npcwalkto 19,46;
specialeffect 30;
end;

OnTimer12000:
npcwalkto 19,50;
specialeffect 30;
end;

OnTimer13000:
npcwalkto 19,50;
specialeffect 30;
end;

OnTimer14000:
npcwalkto 22,20;
end;

OnTimer15000:
callfunc "ThunderStop";
npcwalkto 22,13;
end;

}


//==================================
zer_map01,22,13,3   script   Death Thunder::DT2   111,1,1,{

OnTouch:
callfunc "StartThunder";

OnTimer2000:
npcspeed 30;
specialeffect 30;
npcwalkto 19,10;
end;

OnTimer3000:
npcwalkto 19,14;
specialeffect 30;
end;

OnTimer4000:
npcwalkto 19,18;
specialeffect 30;
end;

OnTimer5000:
npcwalkto 19,22;
specialeffect 30;
end;

OnTimer6000:
npcwalkto 19,26;
specialeffect 30;
end;

OnTimer7000:
npcwalkto 19,30;
specialeffect 30;
end;

OnTimer8000:
npcwalkto 19,34;
specialeffect 30;
end;

OnTimer9000:
npcwalkto 19,38;
specialeffect 30;
end;

OnTimer10000:
npcwalkto 19,42;
specialeffect 30;
end;

OnTimer11000:
npcwalkto 19,46;
specialeffect 30;
end;

OnTimer12000:
npcwalkto 19,50;
specialeffect 30;
end;

OnTimer13000:
npcwalkto 19,50;
specialeffect 30;
end;

OnTimer14000:
npcwalkto 22,20;
end;

OnTimer15000:
callfunc "ThunderStop";
npcwalkto 22,13;
end;

}

//==================================
zer_map01,22,13,3   script   Death Thunder::DT3   111,1,1,{

OnTouch:
callfunc "StartThunder";


OnTimer2000:
npcspeed 30;
specialeffect 30;
npcwalkto 19,10;
end;

OnTimer3000:
npcwalkto 19,14;
specialeffect 30;
end;

OnTimer4000:
npcwalkto 19,18;
specialeffect 30;
end;

OnTimer5000:
npcwalkto 19,22;
specialeffect 30;
end;

OnTimer6000:
npcwalkto 19,26;
specialeffect 30;
end;

OnTimer7000:
npcwalkto 19,30;
specialeffect 30;
end;

OnTimer8000:
npcwalkto 19,34;
specialeffect 30;
end;

OnTimer9000:
npcwalkto 19,38;
specialeffect 30;
end;

OnTimer10000:
npcwalkto 19,42;
specialeffect 30;
end;

OnTimer11000:
npcwalkto 19,46;
specialeffect 30;
end;

OnTimer12000:
npcwalkto 19,50;
specialeffect 30;
end;

OnTimer13000:
npcwalkto 19,50;
specialeffect 30;
end;

OnTimer14000:
npcwalkto 22,20;
end;

OnTimer15000:
callfunc "ThunderStop";
npcwalkto 22,13;

MiyumiChan

That's what I have so far. But since its a death run and all has to move up in a line. I have problems getting them to go at the same time or initiating them at the same time. 2nd problem is that If I do put percentheal -100 -100 whatever, It wont carry on throughout the rest of the script if I make the first movement safe so on and so fourth.

It moves, perfectly on one row sadly it doesn't do the killing function I want it to do. Or make multiple ones that go in sync with it by using one trigger to start them all.

Bue

You've a lot to learn if you're writing scripts that inefficiently.

A better idea would be this:

1. Create monsters to kill the player rather than killing the player instantly.
  * Killing a player instantly will make the mini-game feel unnatural, even if you mask the kill with a special effect, the effect may not always sync correctly or there isn't that 'impact' effect.
* Monsters allow you to add some dynamics into the game by assigning different properties, i.e. speed and skills, that can make the mini-game more interesting, also this method is more natural.

2. Store the account ID of all players in an array, which can be use to locate the player's coordinates on that map the mini-game is assigned to.

3. Create the monsters assigned to the mini-game and command each monster to randomly select and attack the player registered in the mini-game.

4. Use the timer as an 'update timer' to send commands to the monsters, i.e. you can enforce difficultly by adjusting the frequency at which the timer updates the mini-game.

5. The timer should also be used to check the victory / defeat conditions of the game.