|
|
This is more for other coders than anything. I've been working on an alternate custom game for my heroes/map, and decided to do a CTF mode.
I had more or less psuedocoded the idea beforehand, but thus far have had little success in implementation.
Flag is a unit. Unit has an "aura" ability, which triggers when a unit is nearby. When the aura "triggers", the unit is "killed" and a state is applied to the triggering unit (State_IHAZFLAG). If the state "expires" i.e. on the death of the unit that has the state, a new unit is "spawned". If an ally is the first to come in contact with it, the flag teleports to the original spawn location, otherwise if the enemy is the first to come in contact with it, they have the state applied to them.
Alternatively, the flag could be an item box that is picked up, and the rest would work when the unit is in inventory etc.
The state applied to the target that has the flag is silenced and perplexed (rely on allies to keep you alive or fend off foes, you can attack, but no spells or items).
In addition, there's a "device" that checks if your own team's "flag" is present. If it is, you can score by coming within an aura range of it, otherwise the aura is turned off, and you can't score until the flag has teleported home.
Thus far I've been attempting to use a unit as the flag (neutral, for whatever reason gadgets weren't spawning correctly or being placed correctly, but units seemed to work fine). The unit has two aura abilities, one for allies and one for enemies. The rest is done from there. My block right now: The "aura" never seems to apply a state and kill the "flag", so right now it's just sitting in the base.
Would there be a better way to go about this that you can think of? Any ideas?
HONOR- If you need it defined, you don't have it.
Look at empath's ult.
^ Above, lol'ed hard.
Not much into coding, so forgive me if my idea is crap or language w/e.
Why not make it into an item like you suggested, perplex, silence etc - whoever bears the item in inventory.
And when capturing the flag, could you make a somewhat 'stash' kind of object with one slot only allowing the flag item, and when current object is placed within the stash, make up some score tally??
In terms of death, make it the same with Doombringer?
Last edited by I_Purpose_I; 04-19-2011 at 10:55 PM.
Hero Suggestions:
http://tinyurl.com/6bkjuoc - Weaver
http://tinyurl.com/38eam2t - BEAUTY ASSASSIN
My Deviantart
I think you need some modifiers on the flag, Home, Carried and Dropped.
And a disabled state for the carrier.
When Home, it has an ontouch for enemy heroes, binding itself to them (unbindondeath="true"), apply state Disabled to target and setmodifier Carried to self. Also ismobile="false" in declaration.
When Carried, it has an onrelease, that sets modifier Dropped and expires the Disabled state. Also, onframe an areaofeffect targeting other flags, testing hasmodifier Home, and then rewarding the player/team.
Otherwise you can make a Flag Socket gadget entity with an aura (modifier keys are good here as well). The aura is off when the ally flag is stolen.
When Dropped, it has the ontouch for ALL heroes, comparing the team, binding itself to enemy heroes (like in Home) in case of enemy, and teleporting to base in case of ally. Then set the corresponding modifierkey.
All this shizz in one gadget (or unit), instead of a unit with 2 abilities with each there states.
Additionally I recommend setting the carrier as proxy of the flag for easy access.
Dropping the flag with tauntkey is a good idea, this is an ability that does an unbind, sets modifierkey to Dropped on the flag and expires Disabled state on self.
Furthermore you can give the heroes an onkill event, with an areaofeffect target flag to give extra gold for "defending the flag" assist or "capturing flag" assist.
Edit: typos
Last edited by Tafelpoot; 04-21-2011 at 06:16 AM.
My Custom Maps
Rampage Runner (SP) - showthread.php?t=255701
SokoHoN (SP) - showthread.php?t=246141
Chess of Newerth (MP) - showthread.php?t=312907
Well, this is how I've approached it so far... and things are... not working as intended, and I can't find where my issue lies.
I'm using a neutral for my flag, it has an ability that on frame spawns an affector, the affector then does one of two things; applies a state to an enemy, or teleports the flag back to the starting position. I'll work on the logistics for determining whether the flag is in the base or not later, right now I just want to get the actions set up.
The neutral as the flag works fine. Spawns and has the ability. For whatever reason it appears the "affector" part isn't working.
Ability to find targets and spawn affector
Affector, which applies the state or resets the flagCode:<?xml version="1.0" encoding="UTF-8"?> <ability name="Ability_Flag" icon="icon.tga" maxlevel="1" requiredlevel="1" actiontype="passive" > <onframe> <spawnaffector name="Affector_Target_Finder" param="source_position" /> <printdebuginfo /> </onframe> </ability>
State, that when expired spawns a flag at the location of the carrier.Code:<?xml version="1.0" encoding="UTF-8"?> <affector name="Affector_Target_Finder" radius="100" targetselection="closest" targetscheme="all_heroes" effecttype="" > <onimpact> <cantarget targetscheme="enemy_heroes"> <applystate name="State_Red_Flag" target="target_entity" continuous="true"/> </cantarget> <cantarget targetscheme="ally_heroes"> <spawnunit name="Neutral_AntloreHealer" count="1" target="param" /> </cantarget> <printdebuginfo /> <kill target="source_entity" /> </onimpact> </affector>
See any problems or have any suggestions? It's not complete, I know, but I just wanted to start with the basics and move up from there.Code:<?xml version="1.0" encoding="UTF-8"?> <state name="State_Red_Flag" icon="icon.tga" passiveeffect="/items/powerups/damage/effects/state.effect" effecttype="StatusBuff" > <onexpired> <condition test="not_hasstate State_Scoring_Aura"> <spawnunit name="Powerup_Damage" count="1" target="source_position" /> </condition> <else> <!-- do point stuff here --> </else> </onexpired> </state>
HONOR- If you need it defined, you don't have it.
I really can't get your point of view. You spawn affector every frame to check if there is any hero in 100 units radius? And later u 'kill' flag applying state? That u must walk into flag instead of touching it is strange for me.
All in all, becouse ur flag is neutral you can give him aura ( or 2 ) which applies on heroes insted of spawning affector.
PS. Add "revealed" into Carrier_state, taking flag during stealth time from invisible rune could be op
PPS. I suggest also to add
isselectable="false"
mapicon="/shared/icons/minimap_tower.tga"
mapiconsize="0.03"
in flag ( not sure that mapicon works)
EDIT:
In carrier state add aura, which affects only Well ( or Flag_spawner) to get easy trigger (Add your point stuff here)
I don't know if you can pass an entity/position as your param. Use proxy to pass entities (and with it their position). And why do you spawn an Neutral_AntloreKeeper ?? Just make a new entity CTF_Gadget_Flag or so.
Also, as tojooko said, it's quite resource have to spawn an affector every frame, an aura applying a state with onimpact event is more then enough.
But, as tojooko said, you should give your flag an ontouch, (look at the powerup entities !).
I feel challenged to try it outI'll look into it now
![]()
My Custom Maps
Rampage Runner (SP) - showthread.php?t=255701
SokoHoN (SP) - showthread.php?t=246141
Chess of Newerth (MP) - showthread.php?t=312907
I personally prefer to use aura rather than affectors if you want to do a "proximity trigger". If you want to use an instant affector (no delay and no multiple impact) I would recommend you to use an <areaofeffect /> action.
I don't really have time to look at all of your script since I'm at work, but I think that changing the affector for a aura or a areaofeffect could really help.
Maps:
Enfo's Team Survival Beta [Dream] - v1.019 (18/07/2011)
BeHoNeled Alpha (Bejeweled clone) [Dream]
I made this quickly, it's still a bit messy but works pretty well.
flag.entity
state_hazflag.entity
You should use a flag socket entity, I just used legion and hellbourneBase now. I made a map with both bases close to eachother, tested this with a legion hero and a hellbourne hero. Works fine, read console output as prove. I hope you can use it !
My Custom Maps
Rampage Runner (SP) - showthread.php?t=255701
SokoHoN (SP) - showthread.php?t=246141
Chess of Newerth (MP) - showthread.php?t=312907
Your code is very similar to what I had initially tried. My first attempt was with powerups, but I could never get it to work correctly, which is why I tried the method I had initially posted here. I had very limited success with it, but was overly complicated.
I went back and used your code, almost exactly as you have it, and it still won't work.
A few questions for clarification... do you have those entities already spawned into your map? And if so, did you simply add them manually into your entitylist? As far as I know, there's no way to load your custom entities into the map editor.
I have tried both methods (modifying existing entities i.e. damage/speed powerups, and manually adding custom entities via entitylist) and neither seem to work. The powerups are there, but whenever "grabbed" by either faction's units, they simply consume and don't apply a state at all (and never respawn).
HONOR- If you need it defined, you don't have it.
I use practice mode, and spawn them with the test menu (cg_dev = 1).
Make sure you put the right team on each of the flags, if you use my exact code.
My Custom Maps
Rampage Runner (SP) - showthread.php?t=255701
SokoHoN (SP) - showthread.php?t=246141
Chess of Newerth (MP) - showthread.php?t=312907
Okay. So spawning them in practice mode for the most part works, but the problem still remains: to have them actually work in a normal game (without manual spawning), they would need to work and be placed when the game starts. Everything that I've tried in that regard has not worked.
I know in order to get my BfComination game to work properly, the units would have to have abilities that did the same thing as what would (at least for now) be in the bottom portion of the powerup entity.
HONOR- If you need it defined, you don't have it.
Yeh i just made a small map to test it, you cannot spawn them at start (in entitylist).
Also there are some small mechanics mistakes, setting the correct modifier and team, in case of a dropped flag. But it's friday evening now, and I've got other plans...
Maybe I'll find a fix tomorrow![]()
My Custom Maps
Rampage Runner (SP) - showthread.php?t=255701
SokoHoN (SP) - showthread.php?t=246141
Chess of Newerth (MP) - showthread.php?t=312907
have to slow down flag carrier for obviouse reasons along with disabling movement skills
I havent read any of the above but wouldnt people just get a team full of disablers and a tp stone and tp to base and get capture?
srry for double post but read some of the main posts and thats it.
In my game, I have 16 unique heroes (as in, no nymphora, no TP stones, etc). The person carrying the flag is intended to have a debuff on them that basically prevents anything from causing them to "teleport" or "blink" any substantial distance.
HONOR- If you need it defined, you don't have it.
Alright, I got it to work
I made a small map so you can test it easily.
Some lessons I learned in this map :
- when you put the flags in the entitylist, they won't work. The proper solution is to make a flagspawner, with the ability "spawn_flags". I was lazy and set "spawn_flags" as the ulti of your hero. This is similar to your conquest map where the buildings didn't react.
- if you push an entity to stack in a compare event, it's not remembered outside of it.
- use <deactivatemodifierkey name="dropped"/> instead of <activatemodifierkey name=""/>. Probably you can fix this with the modpriority or exclusive="true"
How to test this : load the map (twice, so that everything is loaded well)
Use panda to pick up the hellbourne flag, and bring it back to base. You should get 100 gold on panda. Also, CTRL+F8 and read the console logs.
Use behemoth to pick up the legion flag, and bring it back to hb base. You get 100 gold on behe.
Use behe to pick up the legion flag. Kill him (with panda or test button). Return the flag with panda. Or with behemoth.
The movespeed buff when carrying the flag is just to make testing faster and for pretty graphics.
Edit : extra note on spawning them at start : you should make an invisible spawner entity (you can define it in entitylist), with the "spawn_creeps" ability. In game_info.entity put after the foreachplayer part :
<setent0 name="your_spawner_gadget"/>
<useability slot="0" source="ent0"/>
Also, the scriptthread "spawn_runes" in my game_info.entity does NOT work. I forgot to delete that part. I would appreciate though if someone could tell me why it doesn't work.
Last edited by Tafelpoot; 04-23-2011 at 06:24 PM.
My Custom Maps
Rampage Runner (SP) - showthread.php?t=255701
SokoHoN (SP) - showthread.php?t=246141
Chess of Newerth (MP) - showthread.php?t=312907