addStructure

For AI and campaign script related discussions and questions
Post Reply
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

addStructure

Post by NoQ »

Still working on this "spectators" thing, now with new map-mod mechanism. That's what i have for a 4-player map with 2 of them being spectators:

spectate.wrf:

Code: Select all

directory       "multiplay/maps/4c-INSERTMAPNAMEHERE"
file		SCRIPT		"spectate.slo"
file		SCRIPTVAL	"spectate.vlo"
spectate.vlo:

Code: Select all

script "spectate.slo"
run
{
command      STRUCTURESTAT   "A0CommandCentre"
satlink      STRUCTURESTAT   "A0Sat-linkCentre"
}
spectate.slo:

Code: Select all

private      STRUCTURESTAT   command,satlink;

trigger spectateTr(every, 10);
event spectateEv(spectateTr)
{
	if ( getStructure(satlink , 2) == NULLOBJECT ) {
		addStructure(satlink, 2, 5*128, 6*128);
	}
	if ( getStructure(command , 2) == NULLOBJECT ) {
		addStructure(command, 2, 4*128, 8*128);
	}
	if ( getStructure(satlink , 3) == NULLOBJECT ) {
		addStructure(satlink, 3, 58*128, 121*128);
	}
	if ( getStructure(command , 3) == NULLOBJECT ) {
		addStructure(command, 3, 59*128, 119*128);
	}
}
Now here's the problem.

Even though the structures are created, players don't seem to benefit from it. The minimap doesn't appear, and the map doesn't get revealed, and they can't even be demolished by your truck. I'm sure the buildings do belong to the players i intended them to belong to.
User avatar
devastator
Trained
Trained
Posts: 241
Joined: 19 Oct 2008, 20:58
Location: Ukraine
Contact:

Re: addStructure

Post by devastator »

Ты вроде читос всё открывал, не легче?
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: addStructure

Post by NoQ »

:annoyed: how is this related? :hmm: :wink:
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: addStructure

Post by NoQ »

http://developer.wz2100.net/wiki/ScriptingManual told me to use enableStructure first:

Code: Select all

...
event spectateEv(spectateTr)
{
        enableStructure(command,2);
        enableStructure(command,3);
        enableStructure(satlink,2);
        enableStructure(satlink,3);
...
but it didn't help, the problem is still the same :(
User avatar
milo christiansen
Regular
Regular
Posts: 749
Joined: 02 Jun 2009, 21:23
Location: Perrinton Michigan

Re: addStructure

Post by milo christiansen »

NoQ wrote:private      STRUCTURESTAT   command,satlink;
This is part of your problem. When declaring things from a vlo use public. Not sure if this will fix it, but its still incorrect and so should be changed.

Also use the scripts dir for your scripts instead of the map dir. Something like scripts/spectate would be best. It's not needed but it will help keep things cleaner. The way the map/mod support works you won't have to worry about more than one map using scripts of the same name.
In general, if you see glowing, pulsating things in the game, you should click on them.
- Demigod Game Ganual
User avatar
Mysteryem
Global Moderator
Global Moderator
Posts: 728
Joined: 22 Sep 2008, 19:44
Location: UK
Contact:

Re: addStructure

Post by Mysteryem »

Hmm, if I use the debug menu to switch to player 2 or 3 it seems to work fine. In single player skirmish, you don't actually change which player you are when you move start positions.

My only change to what was in the first post was changing the directory line of the wrf file to

Code: Select all

directory       "script"
since I put the files there. So depending on where you put the files, what is in the first post works fine.

Edit: I was thinking, how do the away missions from the campaign handle this?
"...If pure awesomeness were bricks, this would be the Great Wall of China...
The glory of this has collapsed on its self so far, that even the neutrons have collapsed."
User avatar
Buginator
Professional
Professional
Posts: 3285
Joined: 04 Nov 2007, 02:20

Re: addStructure

Post by Buginator »

NoQ wrote:Still working on this "spectators" thing, now with new map-mod mechanism. That's what i have for a 4-player map with 2 of them being spectators:
FYI, that is going to be reverted, since it is broken. (Unless a fix is found...before the next release)
and it ends here.
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: addStructure

Post by NoQ »

Buginator wrote:
NoQ wrote:Still working on this "spectators" thing, now with new map-mod mechanism. That's what i have for a 4-player map with 2 of them being spectators:
FYI, that is going to be reverted, since it is broken. (Unless a fix is found...before the next release)
Hey that's not fair! :shock: Even if it's broken, reverting it breaks things even more in all situations! :shock: O_o
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: addStructure

Post by NoQ »

Hmm, if I use the debug menu to switch to player 2 or 3 it seems to work fine. In single player skirmish, you don't actually change which player you are when you move start positions.
So how are we identify players that should be spectators?
Upd: yeah, i noticed the radar of a wrong color after all; i didn't notice it when tried a deity cheat because i was player 0. Looks like they're created for a wrong player after all.
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: addStructure

Post by NoQ »

Anyway, i used objectInRange() to discriminate between the players and it's working now, thanks everybody (:
Post Reply