The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to create a counter?
Author Message
daedelus
Journeyman
*

Posts: 69
Likes Given: 0
Likes Received: 2 in 1 posts
Joined: Aug 2012
Reputation: 0



Post: #1
Question how to create a counter?
Someone gives me an initial aid to create a counter. for example I want to do a quest where you have to kill X number of zombies but I need an accountant to do a check and so on. I just need help or example, and so learn Smile.

Thanks
08-15-2012 12:23 PM
Find all posts by this user Like Post Quote this message in a reply
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #2
RE: how to create a counter?
Stick an event on all your NPC's that fires under the ON=@Death trigger

Code:
[events e_killcount]
ON=@Death
    IF (<act.tag0.questkill<src.id>>)
                IF (<eval <act.tag0.<src.id>kills>> < <eval <act.tag0.requiredzombiekill>>)
                        act.tag0.<src.id>kills = (<EVAL <act.tag0.<src.id>kills>>+1)
                ELIF (<eval <act.tag0.<src.id>kills>> == <eval <act.tag0.requiredzombiekill>>)
                                act.sysmessage quest complete
                                // blah blah give reward wipe the tags or freeze the counter and tell player to go to npc for rewards
                ENDIF
    ENDIF

Now all you have to do is put the tags on the player to set the kills to count and say how many kills are needed....
I have no doubt there are probably even simpler way, this is what I had off the top of my head.
Using the questkill tag like I have there, this event would be valid for any NPC in the world, all you have to do is set the tag on the player when the quest is given, though use the target NPC's actual ID tag.questkillc_zombie for example.

[EDIT]Actually thought about this and realized I had forgotted about the @kill trigger...
Script is pretty much the same:
Code:
[events e_killcount]
ON=@KILL
    IF (<src.tag0.questkill<act.id>>)
                IF (<eval <src.tag0.<act.id>kills>> < <eval <src.tag0.requiredzombiekill>>)
                        src.tag0.<src.id>kills = (<EVAL <src.tag0.<act.id>kills>>+1)
                ELIF (<eval <src.tag0.<src.id>kills>> == <eval <src.tag0.requiredzombiekill>>)
                               src.sysmessage quest complete
                                // blah blah give reward wipe the tags or freeze the counter and tell player to go to npc for rewards
                ENDIF
    ENDIF

Except as you can see src & act are switched... This way would actually work better I think

[Image: 2nis46r.jpg]
(This post was last modified: 08-17-2012 02:58 AM by Mordaunt.)
08-15-2012 01:13 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)