Go Back   Savage 2: A Tortured Soul Forum > Savage 2 Modding > Documentation

Notices

Documentation Post useful tutorials and other informative material.

Reply
 
Thread Tools Display Modes
Old 06-27-2011, 02:20 PM   #1
rohezal

rohezal's Avatar
 
Join Date: Mar 2008
Posts: 2,610
Thanks: 112
Thanked 136 Times in 106 Posts
Default Commander Selection

CommSelectionIndex is working for buildings. Other units that are selected are saved in MultiSelectIndex0 till MultiSelectIndex9. Pidgi wrote i scriptinput script to get UI information to the server.

MultiSelectActive0 = "true"
MultiSelectActive1 = "false"
MultiSelectActive2 = "false"
MultiSelectActive3 = "false"
MultiSelectActive4 = "false"
MultiSelectActive5 = "false"
MultiSelectActive6 = "false"
MultiSelectActive7 = "false"
MultiSelectActive8 = "false"
MultiSelectActive9 = "false"
MultiSelectDead0
MultiSelectDead1
MultiSelectDead2
MultiSelectDead3
MultiSelectDead4
MultiSelectDead5
MultiSelectDead6
MultiSelectDead7
MultiSelectDead8
MultiSelectDead9
MultiSelectHealthPercent0 = "1.0000"
MultiSelectHealthPercent1
MultiSelectHealthPercent2
MultiSelectHealthPercent3
MultiSelectHealthPercent4
MultiSelectHealthPercent5
MultiSelectHealthPercent6
MultiSelectHealthPercent7
MultiSelectHealthPercent8
MultiSelectHealthPercent9
MultiSelectIcon0 = "/human/units/builder/icons/icon.tga"
MultiSelectIcon1
MultiSelectIcon2
MultiSelectIcon3
MultiSelectIcon4
MultiSelectIcon5
MultiSelectIcon6
MultiSelectIcon7
MultiSelectIcon8
MultiSelectIcon9
MultiSelectIndex0 = "613"
MultiSelectIndex1
MultiSelectIndex2
MultiSelectIndex3
MultiSelectIndex4
MultiSelectIndex5
MultiSelectIndex6
MultiSelectIndex7
MultiSelectIndex8
MultiSelectIndex9
MultiSelectManaPercent0 = "0.0000"
MultiSelectManaPercent1
MultiSelectManaPercent2
MultiSelectManaPercent3
MultiSelectManaPercent4
MultiSelectManaPercent5
MultiSelectManaPercent6
MultiSelectManaPercent7
MultiSelectManaPercent8
MultiSelectManaPercent9
MultiSelectSquadColor0 = "white"
MultiSelectSquadColor1
MultiSelectSquadColor2
MultiSelectSquadColor3
MultiSelectSquadColor4
MultiSelectSquadColor5
MultiSelectSquadColor6
MultiSelectSquadColor7
MultiSelectSquadColor8
MultiSelectSquadColor9
__________________

http://xs229.xs.to/xs229/08295/image_get.php939.jpeg

I love VOIP
sing: "base, base, base, base, base, base, base"

Why only 15 year old girls? Since 4 Years, damn I'm doing something wrong...

One day I will find out who is responsible for the K2 scripting "language" and the modding "support". And then...

rohezal is offline   Reply With Quote
The Following User Says Thank You to rohezal For This Useful Post:
meankitty2 (05-04-2013)
Old 02-04-2013, 03:58 PM   #2
Durwyn

 
Join Date: Jul 2011
Location: Belgium
Posts: 264
Thanks: 47
Thanked 67 Times in 54 Posts
Default

I need to know more about this. Can you add some details please?

Important one:
such as how to get those variables usable in a script?

Secondary:
10 units maximum?
Is it necessary to fill in all the details? SquadColor, Mana.. if i only want the index?

I read you wrote a "scriptinput" script, can you paste it somewhere so i can read it?

Thanks :-)
__________________
Operating System: Windows 7 x64
Graphic card : Geforce GT 540M
RAM : 8gb
Savage2MapsAI
Durwyn is offline   Reply With Quote
Old 02-04-2013, 04:20 PM   #3
Pidgeoni

Pidgeoni's Avatar
 
Join Date: Jul 2009
Posts: 1,734
Thanks: 185
Thanked 317 Times in 190 Posts
Default

Those triggers get automatically updated when the commander selects units. I'm pretty sure that the commander needs to be a real player for them to work.
____

If you are, say, playing a match as commander and want to know the index of the player you selected, use a command like this:

if #MultiSelectActive0# "echo #MultiSelectIndex0#"
else "echo no selection"

Yes, it appears to be for 10 units maximum i'm afraid.

All the variables are updated automatically, so if you want to know the squad color, you got it. No need to edit anything if you just want the index.
____

I remember nothing about that script, but it should be something like this:

script code:
sendscriptinput what commselection value #MultiSelectIndex0#

scriptinput worldtrigger:
if #stringequals(|#getparam(what)|#,commselection)# "echo commander selected index #getparam(value)#"
____

You could even expand the above, adding a ui watch to send information to the server whenever the commander selects anything. Something like:

<panel width="0" height="0" watch="MultiSelectActive0"
ontrigger="If(param, SendScriptInput('what','commselection','value',Mul tiSelectIndex0));"/>
____

Hope this turns out to be at least a bit useful
Pidgeoni is offline   Reply With Quote
Old 02-04-2013, 04:29 PM   #4
Durwyn

 
Join Date: Jul 2011
Location: Belgium
Posts: 264
Thanks: 47
Thanked 67 Times in 54 Posts
Default

Yes this is plenty useful! :-)
__________________
Operating System: Windows 7 x64
Graphic card : Geforce GT 540M
RAM : 8gb
Savage2MapsAI
Durwyn is offline   Reply With Quote
Old 04-24-2013, 08:21 PM   #5
Durwyn

 
Join Date: Jul 2011
Location: Belgium
Posts: 264
Thanks: 47
Thanked 67 Times in 54 Posts
Default

Is it possible to know the name of a selected unit in UI?
my dummy npc is being shown if you "multi select" them

i wanna block that like this:

Quote:
Originally Posted by game_commander
<template name="multi_select_unit">
<panel width="50" height="61" watch="MultiSelectActive{index} MultiSelectIndex{index}" ontrigger="if(StringEquals(GetNameFromIndex(param1 ), 'Dummy'),SetVisible(false),SetVisible(true));">
Quote:
Originally Posted by dummy npc
<?xml version="1.0" encoding="UTF-8"?>
<npc
type="Dummy"
scale="1.0"
width="1.0"
height="1.0"
maxhealth="50000"
speed="0"
minimapiconsize="0"
selectionradius="0"
>
</npc>
I tried just like that, but it doesn't work ^^'
__________________
Operating System: Windows 7 x64
Graphic card : Geforce GT 540M
RAM : 8gb
Savage2MapsAI

Last edited by Durwyn; 04-24-2013 at 09:25 PM.
Durwyn is offline   Reply With Quote
Old 04-24-2013, 10:09 PM   #6
rohezal

rohezal's Avatar
 
Join Date: Mar 2008
Posts: 2,610
Thanks: 112
Thanked 136 Times in 106 Posts
Default

Do you want the name of the unit or the type of the unit (Pet_Savage vs my_spawned_savage1)?
__________________

http://xs229.xs.to/xs229/08295/image_get.php939.jpeg

I love VOIP
sing: "base, base, base, base, base, base, base"

Why only 15 year old girls? Since 4 Years, damn I'm doing something wrong...

One day I will find out who is responsible for the K2 scripting "language" and the modding "support". And then...

rohezal is offline   Reply With Quote
Old 04-24-2013, 10:26 PM   #7
Durwyn

 
Join Date: Jul 2011
Location: Belgium
Posts: 264
Thanks: 47
Thanked 67 Times in 54 Posts
Default

the thing that correspond to type="Dummy" in my npc file
__________________
Operating System: Windows 7 x64
Graphic card : Geforce GT 540M
RAM : 8gb
Savage2MapsAI
Durwyn is offline   Reply With Quote
Old 04-24-2013, 11:52 PM   #8
Pidgeoni

Pidgeoni's Avatar
 
Join Date: Jul 2009
Posts: 1,734
Thanks: 185
Thanked 317 Times in 190 Posts
Default

There is that function: GetNPCProperty
Eg: echo #GetNPCProperty(eyebolt_1,type)# >>> Eyebolt

Should be usable in ui with smthing like:
ontrigger="Cmd('Set bla #GetNPCProperty(' # MultiSelectIndex{index} # ',type)#'); SetVisible(!StringEquals(bla,'Dummy'));"
Not sure how it would work with many selections, you might need to define many variables instead of one, eg: bla{index} instead of just bla.

Another option would be to take a dummy state, eg State_BehemothToughSkin, set intaglibility, dispellability etc, then apply to all dummies when you spawn them. That way, you could make commanders unable to select dummies in the first place.

Ow, and your original code should work if you spawn your npcs like this:
SpawnEntityAtEntity #target# NPC_Critter definition /npcs/dummy/dummy.npc name Dummy team 0
Note the "name" parameter. Then you could play more with the code if you don't like all dummies having the same name ^^

Hope i helped ^^

Last edited by Pidgeoni; 04-24-2013 at 11:59 PM.
Pidgeoni is offline   Reply With Quote
Old 04-26-2013, 03:05 PM   #9
Durwyn

 
Join Date: Jul 2011
Location: Belgium
Posts: 264
Thanks: 47
Thanked 67 Times in 54 Posts
Default

Thanks for the ideas, but none of them worked :/ I will just leave it like this at the moment, after all the "multi select" problem only occurs when you try to "multi select" enemies, not allies. Who the hell (except me) does that XD
__________________
Operating System: Windows 7 x64
Graphic card : Geforce GT 540M
RAM : 8gb
Savage2MapsAI
Durwyn is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

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



All times are GMT. The time now is 07:44 PM.