wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Warcraft III Modding > Developer's Corner > Triggers & Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 02-06-2010, 09:00 AM   #1
Tot
6
 
Tot's Avatar
 
Join Date: Oct 2008
Posts: 841

Tot will become famous soon enough (53)Tot will become famous soon enough (53)

Default creating fps feeling for 2 out of 12 players

I'm currently working on a friends project (has still no name...)

map description:
* 2 team with 6 players each
* each team has a tower to defend
* now each team has one player controlling the ballistae of the team's tower
--> cam eye position locked, can only look up and down and turn (xy:-45; 45| z: +30;-60); frist person cam

problem:
how to detect clicks and get the curser-position of the two ballistae-players?

2 ways:
1) cover everything around the tower with trackables
2) cover everything around the tower with alphaed-out units and detect spellcast

I'd prefer to use the first method

now I'm stuck how to set a trackables z and more important, how to calculate the positions of the trackables

I've seen some fps-mod flying around here, but didn't get it working for only 2 players instead of all


IMPORTANT: should be useable in lan and bnet

if anyone can help me he'll be +rep ed and mentioned in the maps credits
__________________
Current Projects:
  • Masters Of WarCraft: Some mixture of AoS and RPG
    Terrain: 100%, Coding: 75%, Heroes: 0%, Items: 0%, Creeps: 0%, Upgrades: 0%
  • hunting emos
____________________________________
scheiss kack dreck sausacksau bundeswehr

Last edited by Tot : 02-06-2010 at 09:05 AM.
Tot is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 02-06-2010, 09:48 AM   #2
fX_
User
 
fX_'s Avatar
 
Join Date: Jan 2007
Posts: 528

Submissions (2)

fX_ will become famous soon enough (38)fX_ will become famous soon enough (38)

Default

you can use a dummy targeting ability that is 'forced' for the ballista users:

- every short interval, force the ballista users to select units with the dummy targeting ability and do ForceUIKey(dummyAbilityHotkey) for them.
- detect when the units use/are-ordered-to-use the dummy ability. this will also give information on the target of the 'click'.

you can automate the missile by using pocket factory as the dummy ability: detect when the summon spawns and run your effects at its position.

Last edited by fX_ : 02-06-2010 at 09:53 AM.
fX_ is offline   Reply With Quote
Old 02-06-2010, 10:22 AM   #3
Tot
6
 
Tot's Avatar
 
Join Date: Oct 2008
Posts: 841

Tot will become famous soon enough (53)Tot will become famous soon enough (53)

Default

yea..., only problem is, that the cam is parallel to the ground, and the ability needs to target something --> can't target ground, cause most times the player can't see it --> needs to target something --> need to create units --> need to know the units positions --> can also use trackables

the main problem is the calculation, not the real mouselistener/clickdetection/whatever
__________________
Current Projects:
  • Masters Of WarCraft: Some mixture of AoS and RPG
    Terrain: 100%, Coding: 75%, Heroes: 0%, Items: 0%, Creeps: 0%, Upgrades: 0%
  • hunting emos
____________________________________
scheiss kack dreck sausacksau bundeswehr
Tot is offline   Reply With Quote
Old 02-06-2010, 03:21 PM   #4
Bobo_The_Kodo
oO
 
Bobo_The_Kodo's Avatar
 
Join Date: Jul 2008
Posts: 580

Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)Bobo_The_Kodo has a spectacular aura about (109)

Default

you want to use some struct for it;

Collapse Zinc:
library libTrackable {
    
    type trackableFunc extends function (Trackable);
    
    struct Trackable {
        private real m_x;
        private real m_y;
        private real m_z;
        private player m_p;
        private string m_model;
        
        trackable self;
        private trackableFunc m_onClick;
        private trackableFunc m_onMouseOver;
        
        private static trigger   actions;
        private static hashtable storage = InitHashtable();
        private static location  loc     = Location(0, 0);
        
        method operator x () -> real {
            return m_x;
        }
        method operator y () -> real {
            return m_y;
        }
        method operator z () -> real {
            return m_z;
        }
        method operator model () -> string {
            return m_model;
        }
        method operator owner () -> player {
            return m_p;
        }
        
        private static method registerEvent () {
            Trackable this = Trackable(LoadInteger(storage, 0, GetHandleId(GetTriggeringTrackable()));
            if (GetTriggerEventId() == EVENT_TRACKABLE_HIT) { // or w/e this is
                m_onClick.evaluate(this);
            } else {
                m_onMouseOver.evaluate(this);
            }
        }
        
        static method create (string model, player p, real x, real y, real z, trackableFunc onClick, trackableFunc onMouseOver) -> Trackable {
            Trackable this = allocate();
            destructable d;
            string s = "";
            if (GetLocalPlayer() == p) {
                s = model;
            }
            MoveLocation(loc, x, y);
            z += GetLocationZ(loc);
            d = CreateDestructableZ('OTip', x, y, z, 0.00, 1, 0);
            self = CreateTrackable(s, x, y, 270);
            RemoveDestructable(d);
            d = null;
            
            m_actions = CreateTrigger();
            m_onClick = onClick;
            m_onMouseOver = onMouseOver;
            m_model = model;
            m_x = x;
            m_y = y;
            m_z = z;
            
            TriggerRegisterTrackableHitEvent(actions, self, function registerEvent);
            TriggerRegisterTrackableTrackEvent(actions, self, function registerEvent);
            
            return this;
        }
        
        private static method onInit () {
            actions = CreateTrigger();
            TriggerAddAction(actions, function registerEvent);
        }
    }
}

Last edited by Bobo_The_Kodo : 02-06-2010 at 03:26 PM.
Bobo_The_Kodo is offline   Reply With Quote
Old 02-07-2010, 06:47 PM   #5
Tot
6
 
Tot's Avatar
 
Join Date: Oct 2008
Posts: 841

Tot will become famous soon enough (53)Tot will become famous soon enough (53)

Default

Quote:
Originally Posted by Bobo_The_Kodo
you want to use some struct for it;

Collapse Zinc:
library libTrackable {
    
    type trackableFunc extends function (Trackable);
    
    struct Trackable {
        private real m_x;
        private real m_y;
        private real m_z;
        private player m_p;
        private string m_model;
        
        trackable self;
        private trackableFunc m_onClick;
        private trackableFunc m_onMouseOver;
        
        private static trigger   actions;
        private static hashtable storage = InitHashtable();
        private static location  loc     = Location(0, 0);
        
        method operator x () -> real {
            return m_x;
        }
        method operator y () -> real {
            return m_y;
        }
        method operator z () -> real {
            return m_z;
        }
        method operator model () -> string {
            return m_model;
        }
        method operator owner () -> player {
            return m_p;
        }
        
        private static method registerEvent () {
            Trackable this = Trackable(LoadInteger(storage, 0, GetHandleId(GetTriggeringTrackable()));
            if (GetTriggerEventId() == EVENT_TRACKABLE_HIT) { // or w/e this is
                m_onClick.evaluate(this);
            } else {
                m_onMouseOver.evaluate(this);
            }
        }
        
        static method create (string model, player p, real x, real y, real z, trackableFunc onClick, trackableFunc onMouseOver) -> Trackable {
            Trackable this = allocate();
            destructable d;
            string s = "";
            if (GetLocalPlayer() == p) {
                s = model;
            }
            MoveLocation(loc, x, y);
            z += GetLocationZ(loc);
            d = CreateDestructableZ('OTip', x, y, z, 0.00, 1, 0);
            self = CreateTrackable(s, x, y, 270);
            RemoveDestructable(d);
            d = null;
            
            m_actions = CreateTrigger();
            m_onClick = onClick;
            m_onMouseOver = onMouseOver;
            m_model = model;
            m_x = x;
            m_y = y;
            m_z = z;
            
            TriggerRegisterTrackableHitEvent(actions, self, function registerEvent);
            TriggerRegisterTrackableTrackEvent(actions, self, function registerEvent);
            
            return this;
        }
        
        private static method onInit () {
            actions = CreateTrigger();
            TriggerAddAction(actions, function registerEvent);
        }
    }
}

thanks for the struct, man...(especially the set z-thingy...) +rep
only thing I don't get is why you evaluate the trackableFuncs and not execute them...
__________________
Current Projects:
  • Masters Of WarCraft: Some mixture of AoS and RPG
    Terrain: 100%, Coding: 75%, Heroes: 0%, Items: 0%, Creeps: 0%, Upgrades: 0%
  • hunting emos
____________________________________
scheiss kack dreck sausacksau bundeswehr
Tot is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 11:38 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services