Getting the engine to count

Discuss IB/IBx engine ideas, bugs, etc.
Post Reply
cartons
Posts: 73
Joined: Mon Jan 11, 2021 5:38 pm

Getting the engine to count

Post by cartons »

Very basic question here.

I'm programming a simple fetch quest where NPC tells PC "You have X fetchits remaining." everytime you return one or more fetchits.

I've opted to use LocalInts where once the quest is initiated I set the LocalInt for thisprop to '3'.

This is where I get confused.

When I return a fetchit, I use SetLocalInt for thisprop with '--' in parm3. This doesn't seem correct as I'd also want to denote when the PC brings in more than 1 fetchit at a time.

I'd like to set the LocalInt on thisprop to '3', and then, depending on whether I bring in 1, 2, or 3 fetchits, subtract from initial value, leading to the quest finished conversation text once it hits '0'.

Can someone help me with the logic here? Between SetLocalInt and CheckLocalInt, how does GetLocalInt fit in?
User avatar
slowdive
Site Admin
Posts: 509
Joined: Wed Jan 15, 2020 4:37 am

Re: Getting the engine to count

Post by slowdive »

I'm not sure what the best approach would be here, but I would probably use a combination of checking for an item (or number of items) and then increment the localint accordingly. You could do this by having a number of NPC nodes that check for a certain quantity of the item. So the first NPC node would check for 3 fetchits and if they don't have 3 then t goes to the next NPC which checks for 2 fetchits, etc. Then if they had 3 fetchits, you run the setLocalInt with the "--" three times (could probably be on the same action node). I guess you would also probably check first to see if the localint is already at 0 before checking for number of items. This could end up being a complex conversation, but it is probably doable.
Post Reply