Post new topic    
Liquid Metal Slime
Send private message
Question on script-triggering NPCs 
 PostWed Oct 17, 2007 4:41 am
Send private message Reply with quote
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.
Cornbread Juice Games
Super Slime
Send private message
 
 PostWed Oct 17, 2007 5:06 am
Send private message Reply with quote
Why don't you just use normal tags for them? The script can set the tag when it's done. If you want, you can pass the tag number as the argument to the script.
Liquid Metal Slime
Send private message
 
 PostWed Oct 17, 2007 1:27 pm
Send private message Reply with quote
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:
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

Cornbread Juice Games
Super Slime
Send private message
 
 PostWed Oct 17, 2007 3:42 pm
Send private message Reply with quote
Change it to say:

Code:
script,Eee,whichtag,begin
.
.
.
set tag(whichtag, on)
end


You'll also have to change the script declaration unless you're using the new declaration-free syntax.
Liquid Metal Slime
Send private message
 
 PostWed Oct 17, 2007 4:41 pm
Send private message Reply with quote
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.
Cornbread Juice Games
Liquid Metal Slime
Send private message
 
 PostFri Jan 16, 2015 7:06 am
Send private message Reply with quote
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.
My website, the home of Motrya:
http://www.jshgaming.com
Display posts from previous: