This was asked about right around the time CP went down, and I can't seem to remember what was concluded.
Basically, I have several one-time use npcs that trigger different scripts. If possible, I would like to make it so that the npc goes away after the script is run rather than before.
I'm pretty sure of a way to do this with multiple tags, but i'm sure there might be a better way than this.
Question on script-triggering NPCs
Moderators: Bob the Hamster, marionline, SDHawk
- Meatballsub
- Liquid Metal Slime
- Posts: 996
- Joined: Mon Oct 15, 2007 6:39 pm
- Location: Northwest Georgia
- Contact:
- Meatballsub
- Liquid Metal Slime
- Posts: 996
- Joined: Mon Oct 15, 2007 6:39 pm
- Location: Northwest Georgia
- Contact:
I guess it would work fine, but i'm not so sure how to set up my script so that it can read the tag that is being used on that NPC. Here is a sample code for the npc:
Code: Select all
script,Eee,begin
suspend player
suspend random enemies
set hero speed (0)
set caterpillar mode (off)
swap by position (0,find hero(0))
walk hero (0,right,1)
wait for hero (0)
set hero picture (0,29,outside battle)
wait for hero (0)
wait (10)
play sound (15,false,false)
set hero direction (0,left)
wait for hero (0)
wait (10)
set hero direction (0,right)
wait for hero (0)
wait (10)
play sound (15,false,false)
set hero direction (0,left)
wait for hero (0)
wait (10)
set hero direction (0,right)
wait for hero (0)
wait (10)
play sound (15,false,false)
set hero direction (0,left)
wait for hero (0)
wait (10)
set hero direction (0,right)
wait for hero (0)
wait (10)
play sound (15,false,false)
set hero direction (0,left)
wait for hero (0)
wait (10)
set hero direction (0,right)
wait for hero (0)
wait (10)
set hero picture (0,11,outside battle)
walk hero (0,left,1)
wait for hero (0)
set hero direction (0,south)
wait for hero (0)
variable (r)
r := random(0, 3)
if (r == 0) then (
show textbox (42)
wait for textbox
)
if (r == 1) then (
show textbox (43)
wait for textbox
)
if (r == 2) then (
show textbox (44)
wait for textbox
get item (13,2)
)
if (r == 3) then (
show textbox (45)
wait for textbox
get item (13,3)
)
resume player
resume npcs
set caterpillar mode (on)
resume random enemies
wait for all
end
Change it to say:
You'll also have to change the script declaration unless you're using the new declaration-free syntax.
Code: Select all
script,Eee,whichtag,begin
.
.
.
set tag(whichtag, on)
end
- Meatballsub
- Liquid Metal Slime
- Posts: 996
- Joined: Mon Oct 15, 2007 6:39 pm
- Location: Northwest Georgia
- Contact:
Thanks for the help. I could never figure out how to call the tag that was being used for each npc though. Maybe one day my scripting skills won't suck as bad.
I fixed my problem by setting up a textbox to display until the script is finished.
Easy fix. Don't know why I didn't think about that before.
I fixed my problem by setting up a textbox to display until the script is finished.
Easy fix. Don't know why I didn't think about that before.
- JSH357
- Liquid Metal Slime
- Posts: 1341
- Joined: Mon Oct 15, 2007 7:38 pm
- Location: Columbia, SC
- Contact:
LIFE2~!
Nowadays you should always add trigger warnings in case an NPC gets activated by something you say or do in a work of fiction.
Nowadays you should always add trigger warnings in case an NPC gets activated by something you say or do in a work of fiction.
My website, the home of Motrya:
http://www.jshgaming.com
http://www.jshgaming.com