Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

npc quest identification

Status
Not open for further replies.
I would like a script, that is non-sdk and that doesn't modify the defaults, that uses a call script command to identify an npc who gives you a quest. This is how it would ideally work.

First, the player talks to an npc. The npc gives the player a quest. Once the npc gives the quest, an icon or animation, moreso an icon because it wouldn't run through an animation sequence, appears over the npc's head. And then, when the player completes the quest and speaks to the npc, the icon would disappear.

It might look like this.

removed image ~ alexia

The problem with doing it via animations is that I would have to somehow loop the animations which would cause lag. The problem with doing it with events and the change graphic command is that I would have to do it for each quest giving npc for each frame.

Also, I would like the option of changing the icon that appears over the head. So maybe the script could call the icon from the icons folder and could be called quest or something. Any help with this would be much appreciated.

**EDIT**
I'm not sure if this was clear, but I would like the icon to stay above the npc's head until the quest has been completed. This means that the icon would follow the npc. Thanks.
 

Kraft

Sponsor

switches?
Just make the event have severeal pages, and one of them displays a animation above his head. Or even better, get a charset of things like ! and ? signs in bubbles, and place one over his head that is activated by a switch, and then deactivated by turning off the switch.

AKA, you talk to him, he gives you a quest, and flips switch 1(or whatever number) on. then it switches pages. (self switch) and then it has a conditional branch for the quest being done, and if it is met, flips switch 1 off.

pretty simple, if you have a charset with exclamation and question makrs in it (not too hard to make if you dont)

Kraft
 
With an animation, I would have to keep it continally looping until the quest reqirements have been met. This, in itself, wouldn't be too bad. But I can just imagine the lag it would cause when, let's say, 14 quests have been initiated but not yet completed.
The icon charset is an option. But I would have to figure out a way to keep the charset above the npc's head. This would be complicated, especially when you have a roaming npc. I do have an event movement script in the game but I have the feeling that the icon may follow the character at it's heels instead of staying on top of it's head.
 
alexia;136507 said:
With an animation, I would have to keep it continally looping until the quest reqirements have been met. This, in itself, wouldn't be too bad. But I can just imagine the lag it would cause when, let's say, 14 quests have been initiated but not yet completed.
The icon charset is an option. But I would have to figure out a way to keep the charset above the npc's head. This would be complicated, especially when you have a roaming npc. I do have an event movement script in the game but I have the feeling that the icon may follow the character at it's heels instead of staying on top of it's head.

I believe that Kraft also indicated you could alter the charset. Have charsets that already have the icon over the NPC.
 
Then I would have to do that for every character that gives a quest. Not impossible, but I'm looking for something more efficient. If there isn't a simpler way, that's probably what I'll have to do.
 
:) Yeah, I try to do that whenever possible.

Try this out and see if there's anything you want different (Don't implement it in events beyond testing yet, I'll be fixing it up a little).

SG_EventIcon_DefaultOpacity = 60
SG_EventIcon_FadeInSpeed = 3

class Game_Temp
attr_accessor :sg_eventicon_sprites
end

class Game_Map
attr_accessor :sg_eventicons

alias sandgolem_eventicons_gmapsetup setup
def setup(map_id)
if !@sg_eventicons or @map_id != map_id
@sg_eventicons = []
if $game_temp.sg_eventicon_sprites
for i in $game_temp.sg_eventicon_sprites
i.dispose
end
end
$game_temp.sg_eventicon_sprites = []
end
sandgolem_eventicons_gmapsetup(map_id)
end

def sg_eventicon_opacity(opac = SG_EventIcon_DefaultOpacity)
if $game_temp.sg_eventicon_sprites
for i in $game_temp.sg_eventicon_sprites
i.opacity = opac
end
end
end

def sg_eventicon_show
if @sg_eventicons == nil
@sg_eventicons = []
$game_temp.sg_eventicon_sprites = []
end
return if @sg_eventicons == []
if !$game_temp.sg_eventicon_sprites
for i in 0...@sg_eventicons.size
z = @sg_eventicons
sg_eventicon(z[0],z[1],z[2],z[3])
end
end
sg_eventicon_opacity
end

def sg_eventicon(event,type,xoff,yoff)
if !$game_temp.sg_eventicon_sprites
$game_temp.sg_eventicon_sprites = []
end
$game_temp.sg_eventicon_sprites += [SG_EventIcon.new]
icon = $game_temp.sg_eventicon_sprites[
$game_temp.sg_eventicon_sprites.size - 1]
icon.event = @events[event]
icon.xoff = xoff
icon.yoff = yoff
icon.x = @events[event].screen_x + xoff
icon.y = @events[event].screen_y + yoff
icon.bitmap = RPG::Cache.icon(type)
icon.z = 541
icon.opacity = SG_EventIcon_DefaultOpacity
end
end

class Scene_Map
attr_reader :spriteset

alias trans transfer_player
def transfer_player
$game_map.sg_eventicon_opacity(0)
trans
$game_map.sg_eventicon_opacity
end

alias mainold main
def main
$game_map.sg_eventicon_show
mainold
for i in $game_temp.sg_eventicon_sprites
i.dispose
end
$game_temp.sg_eventicon_sprites = nil
end

alias mapupd update
def update
mapupd
for i in $game_temp.sg_eventicon_sprites
if i != nil
i.update
end
end
end
end

class Interpreter
def sg_eventicon(event,type,xoff,yoff)
$game_map.sg_eventicons += [[event,type,xoff,yoff - 24]]
$game_map.sg_eventicon(event,type,xoff,yoff - 24)
end

def sg_uneventicon(event)
for i in 0...$game_map.sg_eventicons.size
if $game_map.sg_eventicons != nil &&
$game_map.sg_eventicons[0] == event
$game_map.sg_eventicons = nil
$game_temp.sg_eventicon_sprites.dispose
$game_temp.sg_eventicon_sprites = nil
end
end
end
end

class SG_EventIcon < RPG::Sprite
attr_accessor :eventid, :event, :xoff, :yoff, :type

def update
self.opacity += SG_EventIcon_FadeInSpeed
self.x = @event.screen_x + @xoff
self.y = @event.screen_y + @yoff
end
end


Call it in an event, to show on #9:
Code:
sg_eventicon(9,'001-Weapon01',-12,-51)

The 2nd option is the icon name.
3rd is how far X from the character's spot, play around.
4th is Y, same, use negatives.

To get rid of an icon:
Code:
sg_uneventicon(9)

I also made them save with saved games and if you open the menu. You would need to use an autorun event to show it again on that map after you leave it though. :)
 
Thanks again for working on this. I received the following error when I implemented the script.

http://i145.photobucket.com/albums/r228 ... terror.png[/IMG]

Btw, are there supposed to be emoticons in the script? However, they don't appear in the script when I copy/paste it.

Also, you said that you need to run an autorun event to show the icon when the player returns to the map. Should it be a parallel process, instead, so that the player can move?
 
Nope! I forgot to hit disable smilies, sorry. Updated the post with that.

The autorun event would have an "Erase Event" command at the bottom. Once it's run once, it remembers to display & move the icon every screen frame. :)

I'll probably add remembering them per map so you could skip the autorun in the full version.
 
sandgolem, you are beyond awesome! This is exactly what I was looking for.
I love how it fades in and is fully customizable. I do see what you mean about the autorun event. Without the autorun event, an error occurs when opening the menu. Ideally, it would be nice if the script didn't rely on these autrun events but I would be completely happy to use it just the way it is.
In a previous post, you said not to use this script yet, except for testing. Please let me know when I'll be able to implement this script into my game.
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top