|
|
Hey guys,
I am trying to skip the hero pick screen and auto assign every player
a hero (valkyrie for each one) and spawn them at 2 different locations
depending on the players team. That's why I have tried
The result is the following:PHP Code:game_info.entity
<game
name="Game_Rules"
...
noheroselect="true"
>
<onaddplayer>
<foreachplayer>
<condition target="target_entity" test="team eq 1" >
<setent0 name="Legion_Spawn" />
<spawnunit name="Hero_Valkyrie" source="target_entity" target="ent0" pushentity="true" team="1" proxy="target_entity" />
<setowner entity="stack_entity" player="target_entity" />
<sethero entity="target_entity" hero="stack_entity" />
</condition>
<else>
<setent0 name="Hellbourne_Spawn" />
<spawnunit name="Hero_Valkyrie" source="target_entity" target="ent0" pushentity="true" team="2" proxy="target_entity" />
<setowner entity="stack_entity" player="target_entity" />
<sethero entity="target_entity" hero="stack_entity" />
</else>
</foreachplayer>
</onaddplayer>
</game>
- Hero Pick Screen is skipped
- A Valkyrie is spawned
- the Hero is not assigned to me
- the Hero is ported to the default (wrong ) position (left bottom corner)
Maybe someone can help me?
[Custom Map] Valkyrie Wars [Dream]
[Guide] How to create a neutral creep spot | [Map] Borderland [Dream]
[MineCraft Server] CraftCraft 20Slot 24/7 [84.200.47.30]
I think that when you join the game (= just after loading the map), the onaddplayer event is produced. At that time you are still a spectator.
I also think that there is a problem with your location, did you try to <printdebuginfo/> ? I assume you gave names to your bases in the entitylist file?
Eventually add a <setpos0 name="legion_spawn"/> ... maybe it helps.
My Custom Maps
Rampage Runner (SP) - showthread.php?t=255701
SokoHoN (SP) - showthread.php?t=246141
Chess of Newerth (MP) - showthread.php?t=312907
maybe the <onentergame> tag will be better, guess <onaddplayer>
is called when player joins the game and enters the lobby.
The position could work like you sad, will try both tomorrow when
I am at home. Thx a lot, hope it works.
[Custom Map] Valkyrie Wars [Dream]
[Guide] How to create a neutral creep spot | [Map] Borderland [Dream]
[MineCraft Server] CraftCraft 20Slot 24/7 [84.200.47.30]
Okay last post were speculations, I tested it now. The onaddplayer happens when you are loading the map, the onentergame happens when you see the lobby. What you need is the event that happens after RequestMatchStart().
I'm searching for the scriptvalue that know if the game is started, but I didn't find it yet. It would allow you to use <waituntilscriptcondition test="game_started eq 1"/>, so you can spawn valkyries for each player. Use target_team when comparing.
Another small problem is that these events are called for each player ... and you do for each player a foreachplayer
For now you can just put a wait duration="10000" in your script and make sure you started your game in those 10 sec
I'm looking into 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
I just found out that onaddplayer is called even before the world is loaded. Use some <print text="SOME CAPS THAT YOU CANNOT MISS"/> in both events, and you'll see that onentergame is a bit better, it's called after loading the world and custom resources. You can use onaddplayer to enter a team automatically.
<setgamephase name="prematch" duration="5000" />
can be used in the lobby as well as in the game itself. It might be useful.
I'm searching for other events, I found <onstart> but it doesn't trigger.
My Custom Maps
Rampage Runner (SP) - showthread.php?t=255701
SokoHoN (SP) - showthread.php?t=246141
Chess of Newerth (MP) - showthread.php?t=312907
hm still not like I want it to be.
Maybe Element knows something? Is there any command to check
if the game started ( all players are in game and can shop, so loby with
team picking and hero picking is gone ) ?
[Custom Map] Valkyrie Wars [Dream]
[Guide] How to create a neutral creep spot | [Map] Borderland [Dream]
[MineCraft Server] CraftCraft 20Slot 24/7 [84.200.47.30]
As far as I know there is no even that is triggered when the game start. This is really sad and I hope too that at some point there will be one.
There is one way I know that works and also another that might work and would be better but I never tried. The one that works but isn't that good is by creating a gadget when a player join (onaddplayer).
The gadget has a aura that target self. The state given by the aura will have a <onspawn> event.PHP Code:<onaddplayer>
<setent0 name="custom_spawn" /> <!-- Custom spawn position !-->
<spawnunit name="Gadget_Spawner" source="target_entity" proxy="target_entity" target="ent0" pushentity="true" />
</onaddplayer>
The <onspawn> of the state will only trigger when the game start, because even if the unit is actually spawned when the player join, the aura will not propagate. Since we spawned the gadget with the player set as the proxy, you can then use the proxy of the gadget from the aura to do your things:
I don't really know what will happen if a player join the game, but then leave, since it will have a gadget spawned for him.PHP Code:<state
name="State_Player_Spawner"
icon=""
>
<onspawn>
<pushentityproxy entity="source_entity" />
<setent0 entity="stack_entity" />
<spawnunit name="Hero_Andromeda" target="source_entity" pushentity="true" />
<setowner entity="stack_entity" player="ent0" />
<sethero entity="ent0" hero="stack_entity" />
<delete target="source_entity" />
</onspawn>
</state>
The other way that would be better is that you could try to simply put a gadget in the map from the start (only one) and not spawn it with scripts. Then in the <onspawn> of the state you could do a <foreachplayer> to do the usual. I think this would be a lot simpler and would work even if a player join and leave. So I would try this way first and if it doesn't work, you can try the way I explained above.
Maps:
Enfo's Team Survival Beta [Dream] - v1.019 (18/07/2011)
BeHoNeled Alpha (Bejeweled clone) [Dream]
Maybe I am doing it wrong but the 2nd version seems not to work.
That's the code I use.
[Custom Map] Valkyrie Wars [Dream]
[Guide] How to create a neutral creep spot | [Map] Borderland [Dream]
[MineCraft Server] CraftCraft 20Slot 24/7 [84.200.47.30]
You are using aura the wrong way. Aura are not handled the same way as event, at least I don't think so. Your targetscheme on the aura is also wrong, the targetscheme is not the position of the aura, its what type of target the aura can hit. There is a list of all the targetscheme in the game mechanic file. Anyway, it should look like this:
<aura state="State_Hero_Spawner" radius="900" targetscheme="self" />
The state looks alright at first glance. The only thing I would try to change is the condition. Since conditions are slower than using "compare" and that I think target_team exist, I would try the following:
That's only a tip for optimized code.PHP Code:<compare a="target_team" b="1" op="eq">
...
</compare>
<else>
...
</else>
Last edited by Oloko; 05-03-2011 at 11:18 AM.
Maps:
Enfo's Team Survival Beta [Dream] - v1.019 (18/07/2011)
BeHoNeled Alpha (Bejeweled clone) [Dream]
Alright Oloko, now it works just fine. Thanks a lot. There is the code
for those who want to use the code for own maps here it is.
Last edited by Schm0ftie; 06-05-2011 at 09:25 AM.
[Custom Map] Valkyrie Wars [Dream]
[Guide] How to create a neutral creep spot | [Map] Borderland [Dream]
[MineCraft Server] CraftCraft 20Slot 24/7 [84.200.47.30]
Minimap bug:
1. If I move my mouse over the "item shops" this white box appears.
Q: Can I dissable it or if not how can I add a custom picture into it?
2. I am using my own custom rune system, it uses gadgets to know where
a Rune location is. As you can see the locations are revealed on minimap
if you have vision on them (white dots in center). The gadgets are invisible, not selectable (in game if you move your mouse over it your mouse
still becomes red for "attackble" ), it hast no model, drawonmap="false" and
hoveronmap="false". Now why are they still revealed (no there is no reveal ward
next to them)
[Custom Map] Valkyrie Wars [Dream]
[Guide] How to create a neutral creep spot | [Map] Borderland [Dream]
[MineCraft Server] CraftCraft 20Slot 24/7 [84.200.47.30]
1. You can edit the shop like any other entity, change their hoveronmap attribute (or something like that). It should work unless they hard coded that part (maybe there is a variable for this in the game setting file). Also, I think you can change the picture. It's either set in the game settings file or in an attribute, I can't remember which one and I can't look at it since I'm at work.
2. That's really strange. Can you try posting the gadget entity file so that people can try to take a look? Make sure there isn't something else at those spots other than your gadgets (maybe you have a old entity you forgot there).
Maps:
Enfo's Team Survival Beta [Dream] - v1.019 (18/07/2011)
BeHoNeled Alpha (Bejeweled clone) [Dream]
The Gadget spawned at a rune location every 30 seconds
The Rune Gadget itselfPHP Code:<gadget
name="Custom_Runes"
model=""
canattack="false"
canrotate="false"
drawonmap="false"
hoveronmap="false"
icon=""
immunity="DefuseKitImmunity"
invisible="true"
invulnerable="true"
isselectable="false"
>
<onspawn>
<chance threshold="1.00" >
<spawnunit name="Custom_Rune_Javelin" target="this_entity" lifetime="15000" />
</chance>
<else />
<delete source="" target="this_entity" />
</onspawn>
</gadget>
The Rune LocationsPHP Code:<gadget
name="Custom_Rune_Javelin"
icon="icon.tga"
portrait="icon.tga"
model="/heroes/valkyrie/projectile/effects/spear.mdf"
skin=""
passiveeffect=""
spawneffect=""
respawneffect=""
selectsound=""
orderconfirmedsound=""
preglobalscale="1.7"
modelscale="1"
effectscale="0.9"
boundsheight="32"
boundsradius="16"
selectionradius="64"
targetoffset="0 0 64"
maxhealth="75"
immunity="DefuseKitImmunity"
attacktype="none"
combattype="Ranged"
corpsetime="300"
corpsefadetime="0"
deathtime="0"
prefertouch="true"
unitwalking="true"
>
<ontouched>
<applystate name="State_Custom_Rune_Javelin" target="target_entity" proxy="target_entity" duration="500" />
<kill target="this_entity" />
</ontouched>
</gadget>
PHP Code:<gadget
name="Gadget_Rune_Loc">
model=""
canattack="false"
canrotate="false"
drawonmap="false"
hoveronmap="false"
icon=""
immunity="DefuseKitImmunity"
invisible="true"
invulnerable="true"
isselectable="false"
>
</gadget>
[Custom Map] Valkyrie Wars [Dream]
[Guide] How to create a neutral creep spot | [Map] Borderland [Dream]
[MineCraft Server] CraftCraft 20Slot 24/7 [84.200.47.30]
Is there really a "invisible" attribute? I thought you had to use "stealthtype" to make entities invisible, there is a list of all stealthtype in the game mechanic file. Also you don't seems to put the drawonmap="false" on your Custom_Rune_Javelin gadget.
Maps:
Enfo's Team Survival Beta [Dream] - v1.019 (18/07/2011)
BeHoNeled Alpha (Bejeweled clone) [Dream]
The Gadget_Rune_Javelin is the powerup you have to pick up. So it
should be visible.
Will try to use the normal invisible with undetectable type.
Last edited by Schm0ftie; 05-03-2011 at 01:40 PM.
[Custom Map] Valkyrie Wars [Dream]
[Guide] How to create a neutral creep spot | [Map] Borderland [Dream]
[MineCraft Server] CraftCraft 20Slot 24/7 [84.200.47.30]
One small tip : for runes, you can use <powerup/> instead of <gadget/>. They will be destroyed automatically after the ontouched event.
I doubt that the "invisible" attribute works .. normally all you need is drawonmap="false" and model="". That works for my maps. Eventually add flying="true" so it doesn't block anything. Feel free to pm a link to your map if you need help !
Like Oloko said, maybe the minimap is showing the runes, not the spawners? To make this clear : drawonmap means draw_this_on_the_minimap , it has nothing to do with invisibility.
Last edited by Tafelpoot; 05-03-2011 at 03:51 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
Can someone give me a blank map with only this? I tried to take it from the valkyrie map but it just doesn't seem to work and I am tired of trying to make it work.
edit: NVM got it to work!
Last edited by Jonathan; 07-24-2011 at 10:34 AM.