Limiting the amount of times a ncp can be used

Join Discord

jamiedotco

Dedicated Member
Dedicated Member
Nov 16, 2006
140
0
62
Just wondering if it's possable to do this.

Have a pet npc, that you pay x amount of gold for, and for that gold you can get the pets say 5 times, then you have to pay again?
 

JSB123

LOMCN Veteran
Veteran
Aug 7, 2004
370
0
63
S.Yorkshire
A variable is the easiest way.

Example:

Add to QManage.txt under the @logon script:

#ACT
Var Integer Human PetLog
LoadVar Human PetLog ..\QuestDiary\Variables\PetLog.txt

Create a folder in QuestDiary called 'Variables' and in it a blank txt file called 'PetLog'

Then your NPC would read:

[@main]
#IF
CheckVar HUMAN PetLog > 0
#ACT
BREAK
#SAY
Blah... <$HUMAN(PetLog)> Pets left..\
<Take a Pet/@take>

#ELSESAY
You need to pay 10m for 5 pets..\
<Pay/@pay>


[@take]
#ACT
RECALLMOB Whatever
BREAK
#SAY
Here you scallywag..

[@pay]
#IF
CHECKGOLD 10000000
#ACT
TAKE GOLD 10000000
CalcVar HUMAN PetLog + 5
SaveVar HUMAN PetLog ..\QuestDiary\Variables\PetLog.txt
RECALLMOB Whatever
BREAK
#SAY
Blah blah now **** off...\
 

jamiedotco

Dedicated Member
Dedicated Member
Nov 16, 2006
140
0
62
A variable is the easiest way.

Example:

Add to QManage.txt under the @logon script:

#ACT
Var Integer Human PetLog
LoadVar Human PetLog ..\QuestDiary\Variables\PetLog.txt

Create a folder in QuestDiary called 'Variables' and in it a blank txt file called 'PetLog'

Then your NPC would read:

[@main]
#IF
CheckVar HUMAN PetLog > 0
#ACT
BREAK
#SAY
Blah... <$HUMAN(PetLog)> Pets left..\
<Take a Pet/@take>

#ELSESAY
You need to pay 10m for 5 pets..\
<Pay/@pay>


[@take]
#ACT
RECALLMOB Whatever
BREAK
#SAY
Here you scallywag..

[@pay]
#IF
CHECKGOLD 10000000
#ACT
TAKE GOLD 10000000
CalcVar HUMAN PetLog + 5
SaveVar HUMAN PetLog ..\QuestDiary\Variables\PetLog.txt
RECALLMOB Whatever
BREAK
#SAY
Blah blah now **** off...\

Thank you very much. Love you
 

JSB123

LOMCN Veteran
Veteran
Aug 7, 2004
370
0
63
S.Yorkshire
Sorry did this bit wrong...

[@take]
#ACT
CalcVar HUMAN PetLog - 1
SaveVar HUMAN PetLog ..\QuestDiary\Variables\PetLog.txt
RECALLMOB Whatever
BREAK
#SAY
Here you scallywag..
 

jamiedotco

Dedicated Member
Dedicated Member
Nov 16, 2006
140
0
62
A variable is the easiest way.

Example:

Add to QManage.txt under the @logon script:

#ACT
Var Integer Human PetLog
LoadVar Human PetLog ..\QuestDiary\Variables\PetLog.txt

Create a folder in QuestDiary called 'Variables' and in it a blank txt file called 'PetLog'

Then your NPC would read:

[@main]
#IF
CheckVar HUMAN PetLog > 0
#ACT
BREAK
#SAY
Blah... <$HUMAN(PetLog)> Pets left..\
<Take a Pet/@take>

#ELSESAY
You need to pay 10m for 5 pets..\
<Pay/@pay>


[@take]
#ACT
RECALLMOB Whatever
BREAK
#SAY
Here you scallywag..

[@pay]
#IF
CHECKGOLD 10000000
#ACT
TAKE GOLD 10000000
CalcVar HUMAN PetLog + 5
SaveVar HUMAN PetLog ..\QuestDiary\Variables\PetLog.txt
RECALLMOB Whatever
BREAK
#SAY
Blah blah now **** off...\

got it working now.
but this error in my m2server

[16/03/2007 12:21:46] [QuestAction] Variable not found:PetLog Command:SAVEVAR NPC:PetRental Map:0(307:288) Param1:HUMAN Param2:PetLog Param3:..\QuestDiary\Variables\PetLog.txt Param4: Param5: Param6:

Also i'm not really sure how this works, cus i have to pay for the pets every time, instead of going straight to a list of pets.
any ideas?
 
Last edited: