View previous topic :: View next topic |
Author |
Message |
New-Gen Living in Obscurity...

Joined: 08 Apr 2009 Posts: 13 Location: South Africa, Pretoria
|
Posted: Wed Apr 08, 2009 2:14 am Post subject: Question involving NPCS for use as enemys |
|
|
I'm trying to work out an easy way to create dead enemy NPC's on a map.
Each enemy NPC is randomly placed on a map (without plotscripting). When the player runs into the NPC a battle will occur...just like on 'Cresent Dream'. Thats the easy part...
Now when a player has killed an enemy NPC I want to make it that the body of that enemy is lieing on the floor (change the image of the NPC, etc...) and then allow the player to click on that NPC and do something with it. E.g. If Tag (Search corpse skill) = true then Search corpse.
That I kinda know how to do...but the problem comes in when I'm trying to replace the enemy NPC with the NEW Dead NPC in the same place the enemy NPC was on the map when the player ran into it.
Because its easy to change the NPC's image but now the New Dead NPC needs to have its own seperate plotscript.
Any answers/help to my dilema? _________________
 |
|
Back to top |
|
 |
Spoon Weaver

Joined: 18 Nov 2008 Posts: 421 Location: @home
|
Posted: Wed Apr 08, 2009 7:54 am Post subject: |
|
|
use the change npc ID command instead. That should be all you need. |
|
Back to top |
|
 |
New-Gen Living in Obscurity...

Joined: 08 Apr 2009 Posts: 13 Location: South Africa, Pretoria
|
Posted: Wed Apr 08, 2009 11:48 pm Post subject: |
|
|
Change NPC ID? Hmm...I'll take a look. Thanks.  _________________
 |
|
Back to top |
|
 |
msw188
Joined: 02 Jul 2003 Posts: 1041
|
Posted: Sat Apr 11, 2009 10:26 am Post subject: |
|
|
Just be aware that this method will require that every 'random' NPC on the map will require its own unique ID, as will each dead body. So if you have two of the same enemy in an area, they still need separate IDs.
I'm not sure if there is a method that would not require this, but just wanted to clarify. _________________ My first completed OHR game, Tales of the New World:
http://castleparadox.com/gamelist-display.php?game=161
This website link is for my funk/rock band, Euphonic Brew:
www.euphonicbrew.com |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Sat Apr 11, 2009 12:14 pm Post subject: |
|
|
No, using change NPC ID won't require giving every NPC a unique ID. change NPC ID changes the ID of a single NPC instance to something else, so it's actually a pretty nice solution, while set NPC picture WILL require each NPC to have a different ID.
If you want a corpse to be lootable just once, look at NPC extra
But what do you want to happen after you leave and reenter the map? Do you want the corpses to stay there, disappear, or the enemies to respawn?
The default behaviour will be to reset the map to its original state when you reenter.
If you set 'Save NPC State' in the map's General Map Settings, then the corpses will remain when you reenter.
However, even then the map will still be reloaded when you save and load your game. If that's a problem, it can be worked around with tags. _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
Spoon Weaver

Joined: 18 Nov 2008 Posts: 421 Location: @home
|
Posted: Sat Apr 11, 2009 12:17 pm Post subject: |
|
|
Quote: | Just be aware that this method will require that every 'random' NPC on the map will require its own unique ID, as will each dead body. So if you have two of the same enemy in an area, they still need separate IDs.
I'm not sure if there is a method that would not require this, but just wanted to clarify. |
hmm well, if you are using the normal npc activation. then yes you might need seperate ID's per dude.
unless there's a way in scripting to call up which npc has activated on you which I'm not exactly sure of. the distance of the npc could totally work though. You could just change all the npcs that are close to you after you win a fight. though that could cause a problem if 2 npcs that are suppost to cause a fight were fairly close to you.
That said, I would be possible to make a script that would cause a different 3rd fight to happen if 2 npcs that cause fights to happen were close enough to you. but thats kind of off topic.
Anyways, I'm gonna go research a way to call up the npc that's been activated. |
|
Back to top |
|
 |
lost.pebble There must be some kinda way outta here!

Joined: 11 Apr 2009 Posts: 9 Location: South Africa
|
Posted: Sat Apr 11, 2009 3:18 pm Post subject: |
|
|
Quote: | unless there's a way in scripting to call up which npc has activated on you which I'm not exactly sure of |
I wish they would implement this. It would be quite easy, I think, since you would just have to make the NPC ID a sendable argument on the running of a script through an NPC. Oh, how it would make life so much easier...
Being able to get NPC coordinates, direction, and other such things with such ease would be great! It would make the creation of generic scripts dealing with NPCs much easier to make.
Unless I'm missing something easier or just as simple enough. Which is probable, since I'm not very familiar with plotscripting yet. _________________ *Remembering the days of RPGspOt* |
|
Back to top |
|
 |
Spoon Weaver

Joined: 18 Nov 2008 Posts: 421 Location: @home
|
Posted: Sat Apr 11, 2009 6:00 pm Post subject: |
|
|
Quote: | Being able to get NPC coordinates, direction, and other such things with such ease would be great! It would make the creation of generic scripts dealing with NPCs much easier to make.
|
um you totally can |
|
Back to top |
|
 |
TwinHamster ♫ Furious souls, burn eternally! ♫

Joined: 07 Mar 2004 Posts: 1352
|
Posted: Sat Apr 11, 2009 6:20 pm Post subject: |
|
|
Spoon Weaver wrote: | Quote: | Being able to get NPC coordinates, direction, and other such things with such ease would be great! It would make the creation of generic scripts dealing with NPCs much easier to make.
|
um you totally can |
To emphasize:
'Plot:NPC_X', 'Plot:NPC_Y' return an npc's x and y coordinates.
'Plot:NPC_direction' returns the npc's direction. |
|
Back to top |
|
 |
New-Gen Living in Obscurity...

Joined: 08 Apr 2009 Posts: 13 Location: South Africa, Pretoria
|
Posted: Sun Apr 12, 2009 12:01 am Post subject: |
|
|
Quote: | If you want a corpse to be lootable just once, look at NPC extra
But what do you want to happen after you leave and reenter the map? Do you want the corpses to stay there, disappear, or the enemies to respawn?
|
There will be three kinds of NPC on the map. The enemies, the dead enemies (after battle) and chest lids and doors, ect...
The enemy NPC will be respawnable when exiting and leaving a map and the bodies will also dissapear. But doors and chest lids will remain. I spoke to 'Adrian X' on how he did this and thats easy.
So now, ive got enemy NPC's that dissapear after battle and respawn when you walk off and then back onto the map and chests the door NPC's that say off.
But the problem is the bodies that need to appear in the same position as when they fought the enemy NPC counterpart and have a new plotscipt attached to them.
The only time a body will dissapear from the map when a player is still on is if they have the 'Cannibal' feat and then choose that option when useing the dead body.
Ive got my friend working on these heavy plotscripts at the moment and so will reply when we have something else to show.
Thanks for all your help guys  _________________
 |
|
Back to top |
|
 |
lost.pebble There must be some kinda way outta here!

Joined: 11 Apr 2009 Posts: 9 Location: South Africa
|
Posted: Sun Apr 12, 2009 1:16 am Post subject: |
|
|
Quote: | To emphasize:
Plot:NPC_X, Plot:NPC_Y return an npc's x and y coordinates.
Plot:NPC_direction returns the npc's direction. |
Yes, this I understand perfectly and is not the problem I am referring to.
Say now, I want to get the X position of a random NPC who happened to bump into me.
NPC X (who)
What would I put into the brackets for "who"?
This is why I say that the NPC ID should be a sendable argument to a plotscript set off by an NPC. Then I would be able to do something like this:
thenpcx = NPC X (argument1)
and use it for similar such situations. Basically, giving me full control over any random NPC on the map [whom I happen to bump into or click on]. _________________ *Remembering the days of RPGspOt* |
|
Back to top |
|
 |
msw188
Joined: 02 Jul 2003 Posts: 1041
|
Posted: Sun Apr 12, 2009 2:22 am Post subject: |
|
|
An NPC that calls a script DOES send a reference to itself as an argument. I can't remember if it's the first or second argument though, because it also sends the value assigned in custom as a script argument. But I am 99.78% sure that it sends both of these things.
And as for 'Change NPC ID' and TMC's comments, I wasn't thinking about that aspect, I was thinking about how to make dead bodies 'one-time' searchable, or 'one-time' anything. It seems like you would want a different NPC ID for each possible dead body if they all need to have one-time only features, because they would all need to be affected by different tags. _________________ My first completed OHR game, Tales of the New World:
http://castleparadox.com/gamelist-display.php?game=161
This website link is for my funk/rock band, Euphonic Brew:
www.euphonicbrew.com |
|
Back to top |
|
 |
lost.pebble There must be some kinda way outta here!

Joined: 11 Apr 2009 Posts: 9 Location: South Africa
|
Posted: Sun Apr 12, 2009 3:05 am Post subject: |
|
|
Quote: | An NPC that calls a script DOES send a reference to itself as an argument. I can't remember if it's the first or second argument though, because it also sends the value assigned in custom as a script argument. But I am 99.78% sure that it sends both of these things. |
I would really love to know how this works. If what you say is true, I am a very happy guy right now! If anyone knows how it works, please do tell!
I think using this method for encountering NPCs, going into battle, and leaving a corpse in the same position would be the most efficient. _________________ *Remembering the days of RPGspOt* |
|
Back to top |
|
 |
Moogle1 Scourge of the Seas Halloween 2006 Creativity Winner


Joined: 15 Jul 2004 Posts: 3377 Location: Seattle, WA
|
Posted: Sun Apr 12, 2009 8:21 am Post subject: |
|
|
Pretty sure this is correct. An NPC always sends its "argument" value as the first argument, and I'm pretty sure it sends its reference as the second. _________________
|
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Sun Apr 12, 2009 4:54 pm Post subject: |
|
|
That's right. Scripts always recieve the custom argument if there is one as the first argument, and any extra information after that, except for menu item scripts which are more complex.
I realise this is badly documented. In fact, I think this is the only place you can find it: 'Plotscripting Tutorial#Other Ways to Start a Script '
I was thinking that a good place to display it would be directly in the editor. Eg:
Code: | Run Script: corpse search (8, <NPC reference>)
Script Argument: 8 |
New-Gen wrote: |
So now, ive got enemy NPC's that dissapear after battle and respawn when you walk off and then back onto the map and chests the door NPC's that say off.
But the problem is the bodies that need to appear in the same position as when they fought the enemy NPC counterpart and have a new plotscipt attached to them.
The only time a body will dissapear from the map when a player is still on is if they have the 'Cannibal' feat and then choose that option when useing the dead body. |
Suppose NPC ID 1 becomes a corpse with NPC ID 2.
NPC 1's activation script could look like this:
Code: | plotscript, fight enemy, custom arg, npc ref, begin
fight formation (3)
set NPC ID (npc ref, 2)
end |
If you want to make a corpse one-time lootable, I would use NPC extra and write an NPC use script like this:
Code: | plotscript, use corpse, custom arg, npc ref, begin
if (npc extra (npc ref, 0) == 0) then (
# NPC hasn't been used before
show textbox (10) # "You find some gold"
set NPC extra (npc ref, 0, 1)
) else (
show textbox (11) # "There's nothing else"
)
end |
Notice that changing NPC ID, setting NPC extra, and any other changes to NPCs will by default be reset if you leave and reenter. (Tags of course don't reset) _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
|