HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

I need a short look over my functions to help me figure out something

08-11-2004, 12:43 PM#1
MightyMonk
Hi all, :>

This function spawn a random creeps from the local array,
could it desync 'cause of the random function ? if so how could I do it in another way.

Code:
// Name: Creeps Middle Spawn
//=== S: ==================================================================//
function Trig_Creeps_Middle_Spawn_Actions takes nothing returns nothing
	
		local integer i = 1
		local integer intSetArrayEnd = 7
		local integer array arrCreepsHunt
		
		// Set the creeps array
		set arrCreepsHunt[0] = 'n00B'
		set arrCreepsHunt[1] = 'n00C'
		set arrCreepsHunt[2] = 'n00G'
		set arrCreepsHunt[3] = 'n00H'
		set arrCreepsHunt[4] = 'n00A'
		set arrCreepsHunt[5] = 'n00D'
		set arrCreepsHunt[6] = 'n00E'
		set arrCreepsHunt[7] = 'n00F'
	
	    loop
	    	exitwhen i > 3
	    	
	    	// Create a random creeps from a custom array
			call CreateGroupAtRect(1, arrCreepsHunt[GetRandomInt(0, intSetArrayEnd)], Player(PLAYER_NEUTRAL_AGGRESSIVE), gg_rct_Creeps_Hunt_1, bj_UNIT_FACING)
			call CreateGroupAtRect(1, arrCreepsHunt[GetRandomInt(0, intSetArrayEnd)], Player(PLAYER_NEUTRAL_AGGRESSIVE), gg_rct_Creeps_Hunt_2, bj_UNIT_FACING)
			call CreateGroupAtRect(1, arrCreepsHunt[GetRandomInt(0, intSetArrayEnd)], Player(PLAYER_NEUTRAL_AGGRESSIVE), gg_rct_Creeps_Hunt_3, bj_UNIT_FACING)
			call CreateGroupAtRect(1, arrCreepsHunt[GetRandomInt(0, intSetArrayEnd)], Player(PLAYER_NEUTRAL_AGGRESSIVE), gg_rct_Creeps_Hunt_4, bj_UNIT_FACING)	
				
	        set i = i + 1
	        call TriggerSleepAction(0.10)
	    endloop
	    
endfunction

function InitTrig_Creeps_Middle_Spawn takes nothing returns nothing
    set gg_trg_Creeps_Middle_Spawn = CreateTrigger()
    call TriggerRegisterTimerEventSingle(gg_trg_Creeps_Middle_Spawn, 5.00)
    call TriggerAddAction(gg_trg_Creeps_Middle_Spawn, function Trig_Creeps_Middle_Spawn_Actions)
endfunction
//=== E: ==================================================================//

this functions isn't desync though but I wanted to know how could I move
my unit instantly to the location I want and focus camera to that location also without being dependent on the player,
this function works great, but when I'm granting control over another player,
and time will come and that player would want to use one of my units, and he will try to move them to another location they will move instantly to the location and thats fine, but the camera won't be focus on him/them. so any idea how to do it without get desync ?

Code:
// Name: The Alliance Top Gate
//=== S: ==================================================================//
function Trig_The_Alliance_Top_Gate_Actions takes nothing returns nothing
	
	local player p = GetOwningPlayer(GetEnteringUnit())
	local location l = GetRectCenter(gg_rct_Force_1_Bottom_Gate_Passive)
	
    call SetUnitPositionLoc(GetTriggerUnit(), l)
    call PanCameraToTimedLocForPlayer(p, l, 1.00)
    
    //=== S: Memory Clean Up ===//
    call RemoveLocation(l)
    set l = null
    //=== E: Memory Clean Up ===//
     
endfunction

function InitTrig_The_Alliance_Top_Gate takes nothing returns nothing
    set gg_trg_The_Alliance_Top_Gate = CreateTrigger()
    call TriggerRegisterEnterRectSimple(gg_trg_The_Alliance_Top_Gate, gg_rct_Force_1_Top_Gate)
    call TriggerAddAction(gg_trg_The_Alliance_Top_Gate, function Trig_The_Alliance_Top_Gate_Actions)
endfunction
//=== E: ==================================================================//


thanks for the help :P .
08-11-2004, 01:08 PM#2
Aiursrage2k
PanCameraToTimedLocForPlayer could be the problem!
08-11-2004, 01:22 PM#3
Cubasis
aiur, he said that the second trigger didn't desync, but anyhow, there is nothing in the first trigger that is a subject to de-sync.

I'm not sure if there is any simple solution to the second problem. As there is no way to see what player is controlling a shared unit except perhaps "triggering player" from order events. Depending on your map type, (if you grant control over a unit, can you still control it?), you may just have a control-variable for each unit/player that tells what player is controlling it's units.

Or whatever

~Cubasis
08-11-2004, 02:07 PM#4
MightyMonk
well PanCameraToTimedLocForPlayer won't desync you well there are few newbie that could or may do something like that

PanCameraToTimedLocForPlayer(GetLocalPlayer(), l, 1.00)

that will 'cause a desync for sure,
'cause its not even logically right.

well anyway I guess I would leave it for now and focus on the important things I need to finish on my map,

thanks for helping.
btw Cub why aren't you join the IRC much :P .
I wasn't here for long time 2 months or more lol, I hope to see you there man. :D
08-12-2004, 12:32 PM#5
Cubasis
[offtopic]

Yeah, eh.

For some reason, my Internet Connection stopped working in my computer, which is very wierd, as it's just a shared internet connection with my brother's computer as the waygate. So the internet still works for him, but not for me. (And there is nothing wrong with the ethernet cable (we can browse each other's comps), and everything seems right).

Anyways, so, as i'm too lazy to go into the extreme to get this problem fixed, I just browse the internet in my brothers computer (as he does day-shifts and I do evening-shifts at work). And sadly, he doesn't have mIRC on his computer, and doesn't want it.

Anyways, it will likely not get fixed untill sometime next week, as we're moving this weekend, requiring a new internet connection.

Feel free to point this post to people who ask about me (and to people in #crimson and admins).

~Cubasis