RPTools.net

Discussion and Support

Skip to content

It is currently Wed May 22, 2013 10:15 am 






Reply to topic  [ 5 posts ] 

Previous topic | Next topic 

  Print view

Author Message
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 5489
Location: Netherlands
 Post subject: Need advise: ghost tokens
PostPosted: Tue Apr 10, 2012 5:02 pm 
Ive been playing with a new idea (which has been discussed before) for the bag of tricks: ghost tokens. What they do is very simple: if you teleport a token to another section or map a ghost of that token is created on the spot where the original left on the object layer: a ghost token. This ghost moves the same path as the original, which can be usefull when you eg split up a large chart over different maps, so the players that are left behind still see where the teleported token moves. The ghost can be given an aura indicating that the player is actually somewhere else.

The question is in the case when the original is teleported to another map.

There are two ways of updating the location of the ghost: running the move update macro (mum) from the player, this requires switching maps for that player each time she moves. Or sending the mum to another player which is on the same map as the ghost. I like the latter better (cause big maps cost a lot of loading time) but the question is how do I figure out which player is still on the ghost map?

Any other suggestions of how to tackle this in general is also welcome!

I hope this makes sense, if not, ask!

What I've done so far is store the ghost map location as a property on the original token. And ontokenmove simply checks if that value is present and if so it runs the mum. The ghost token has the same name as the original token but with "(ghost)" added as suffix to the name.

_________________
My stuff
Excel Tools: Table editor and Illumination Generator
MT Tools: Dungeon Builder Tool, Bag of Tricks: Teleport pads, Pits, Traps and Warded Areas and onMouseOverEvent
Framework: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade and Only War
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow

My dropbox referral. If you use this then both you and me get 500Mb extra space. 2.5Gb total.


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 5305
Location: Bay Area
 Post subject: Re: Need advise: ghost tokens
PostPosted: Tue Apr 10, 2012 8:18 pm 
You should be fine with switching maps, moving token, then switching back. The other map doesn't load fully until after the macro runs. So, if you switch back, it doesn't reload. It'll just flicker when it realizes it's switching to the current map and abort. In the past, I did a map search for a token where I looped through all the maps, switched to the map, did a findToken and then returned to original map. That was awhile ago, and some code may have changed since then, so this may not be the case anymore.. but worth a check.

Using an event handler in an open frame can update personal player lib tokens to specify the user's current map. This is something I planned on doing anyway. Create a change map event handler basically. I haven't tested anything yet for this, but I want to see if any of the defined handlers trigger by simply changing maps. I don't think so, but putting a hook in the setCurrentMap would be a start. Since the onTokenChange is updated all-the-time, I figured I use that as a base for other trigger events like onInitChange, onMapChange... where it tests those conditions. Do it the way I did it for onTokenSelect where I can tell when a new token is selected or a token is reselected.

_________________
Downloads:


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Sep 11, 2007 6:31 pm
Posts: 5228
 Post subject: Re: Need advise: ghost tokens
PostPosted: Tue Apr 10, 2012 9:45 pm 
I wonder if you could use a combination of moveTokenFromMap and moveTokenToMap to "trick" it from having to do the map switch. ie, move the token "to" the current map and then move right back to the it's original "ghost" map.

_________________
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.

Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 5489
Location: Netherlands
 Post subject: Re: Need advise: ghost tokens
PostPosted: Wed Apr 11, 2012 1:00 am 
@Am the map switch actually did occur in a map reload sometimes. You can test yourself using the bag of tricks framework and from map YAM doing an update on map BASE (one line of code, b87) occurred in a map reload for the YAM map.

A map switch event would be awesome and solve this pickle. I'm currently thinking of using the teleport macro itself as event that updates the token. This does require however that the users on,y use the teleports and not copy paste there tokens.... The thing also is is that I need to know at which map the USER is not her TOKEN, as the broadcast is send to the user.

@jfr ?? Care to elaborate?

_________________
My stuff
Excel Tools: Table editor and Illumination Generator
MT Tools: Dungeon Builder Tool, Bag of Tricks: Teleport pads, Pits, Traps and Warded Areas and onMouseOverEvent
Framework: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade and Only War
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow

My dropbox referral. If you use this then both you and me get 500Mb extra space. 2.5Gb total.


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 5489
Location: Netherlands
 Post subject: Re: Need advise: ghost tokens
PostPosted: Wed Apr 11, 2012 9:57 am 
ok given it a bit more thought and came up with the following:

as the add-on works with ghost tokens, it will need to not only create a ghost token of the teleported token, but also of the tokens left behind a ghost token needs to be created on the new map so that all players 'keep in view'. If I use the teleport moment as the event (cause thats a macro where I can place a hook), then the following needs to happen:
-Map A (starting point)
-Map B (destination point)
-OTokA (original toks on map A)
-GTokB (ghost toks on map B)
Lets say there are 4 players (P1,P2,P3,P4), each with one player token (1,2,3,4).

When a token 1 teleports from A to B
- a GTok1A is created on A and the OTok1B appears on B.
- GTok2B, GTok3B, GTok4B are created on B.
- all GToks are given the (hidden?) 'Ghost' state (which might interfere with FW states, so a better name needs to be found, any suggestions??)
- the GToks are given a property w42.mtt.ghostMap where the map name is stored where the OToks reside.
- the GTok is given 2 properties w42.mtt.TelCoordX/Y where the X/Y coords of the teleport on A are stored.
- the OTok is given a property w42.mtt.ghostMap where the map name is stored where the GTok resides.
- the OTok is given 2 properties w42.mtt.TelCoordX/Y where the X/Y coords of the teleport on B are stored.

When OTokB moves
first there is a check whether w42.mtt.ghostMap exists, if so then the following happens:
- the position offset versus the XY of the teleport are calculated
- the first token is picked from the resulting list of: getTokens(with state 'Ghost' AND w42.mtt.ghostMap==currentMap)
- The owner of that token is retrieved and a autoExec broadcast is send to that owner that:
- - asserts(the owner is on the correct map)
- - moves the GhostToken to the position with the same offset vs the teleport coords stored there.
In case of multiple owners, each owner will be send this update, however because the move offset is fixed in stead of relative, the Ghost Token will always be placed on the same spot.

When a OTokA moves the same happens but than the other way round.

When 1 eg OTok2A also moves to map B then in addition to the above, the GTok2B needs to be removed
When ALL OTokA are moved to map B then ALL GToks on map A need to be deleted.

Any comments? Gaps, critics, failures, missed stuff, etc.?

Now the one thing Im still wondering about is: what happens when e.g OTok3A does not teleport to map B but to map C...

_________________
My stuff
Excel Tools: Table editor and Illumination Generator
MT Tools: Dungeon Builder Tool, Bag of Tricks: Teleport pads, Pits, Traps and Warded Areas and onMouseOverEvent
Framework: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade and Only War
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow

My dropbox referral. If you use this then both you and me get 500Mb extra space. 2.5Gb total.


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 5 posts ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 2 guests





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman